开发者

call WSDL by PHP

I need to use an WSDL, and call some functions. I need my request will hav开发者_运维技巧e 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜