Tutorial :call WSDL by PHP



Question:

I need to use an WSDL, and call some functions. I need my request will have this format:

username password

I can not get any data back from server, the server can not recognize my transfer parameters.

Thanks for your support.


Solution:1

If you want to call the web service, which is described be your WSDL, try something like this:

class myWebServiceParameter {      public $username = "me";      public $password = "secret";  }    try{      $client = new SoapClient("http://example.org/myWebService.wsdl",          array('location' =>"http://example.org/myWebServiceEndpoint"));      $parameter1 = new myWebServiceParameter();      $result = $client->myWebServiceFunction($parameter1);  } catch (Exception $e) {      // handle errors  }  

myWebServiceParameter must be any class with a member variable foreach WSDL message attribute of the same name. And myWebServiceFunction is the name of the web service method.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »