php - codeigniter nusoap client error: wsdl error: XML error parsing WSDL Mismatched tag -
this controller.
class cteam extends my_controller { //this server public function server(){ if($this->uri->rsegment(3) == "wsdl") { $_server['query_string'] = "wsdl"; } else { $_server['query_string'] = ""; } //$ns= site_url()."cteam/cteam/server/wsdl"; $ns= site_url()."cteam/cteam/wsdl"; $endpoint = site_url()."cteam/cteam/server/wsdl"; $this->load->library("nusoap_library"); //load library here $this->load->library('xmlrpc'); $this->nusoap_server = new soap_server(); $this->nusoap_server->configurewsdl('sever','urn:'.$ns,$endpoint); $this->nusoap_server->wsdl->schematargetnamespace='urn:'.$ns; $input_array = array ('count' => 'xsd:integer', 'type' => "xsd:string"); // method parameters $return_array = array ("fruit" => "xsd:string"); $this->nusoap_server->register( 'fruits', $input_array, $return_array, "urn:soapserverwsdl", "urn:".$ns."/fruits", "rpc", "encoded", "fruit types" ); function fruits($count,$type){ switch($type){ case 'red': return $count." apple"; break; case 'yellow': return $count." banana"; break; } } $this->nusoap_server->service(file_get_contents("php://input")); } //this client function test_soap2(){ $this->load->library("nusoap_library"); $n_params = array("count" => 4, "type" => "red"); $this->nusoap_client = new nusoap_client('http://localhost/desimd/cteam/cteam/wsdl/',array('soap_version' => soap_1_1)); $this->nusoap_client->soap_defencoding = 'utf-8'; $err = $this->nusoap_client->geterror(); if ($err){ echo '<h2>constructor error</h2><pre>' . $err . '</pre>'; } $result = $this->nusoap_client->call('fruits', array('parameters' => $n_params)); echo $result; // check fault if ($this->nusoap_client->fault) { echo '<h2>fault</h2><pre>'; print_r($result1); echo '</pre>'; } else { // check errors $err = $this->nusoap_client->geterror(); if ($err) { // display error echo '<h2>error</h2><pre>' . $err . '</pre>'; } else { // display result echo '<h2>result</h2><pre>'; print_r($result1); echo '</pre>'; } } } }
controller located in controller/cteam/ folder. router:
$route['cteam/cteam/wsdl'] = 'cteam/cteam/server/wsdl';
when call server: http://localhost/desimd/cteam/cteam/wsdl/ getting xml.
when call client: http://localhost/desimd/cteam/cteam/test_soap2/ giving me error: wsdl error: xml error parsing wsdl.... mismatched tag
can me?
Comments
Post a Comment