Skip to content

Categories:

soap:php使用nusoap调用.NET接口的方法

//soap为你的nusoap存放路径,nusoap.php为主要接口文件
include('soap/nusoap.php');
 
//目标地址
$url = 'http://www.oseschool.com/ValidateAccount.aspx'
 
//发送请求的参数设定
$parms = array ('userName' => 'test', 'password' => '123456' );
 
//实例化一个soap请求,直接调用soap方法
$client = new SoapClient ( $url, array('parameters' =>$parms));
 
//返回结果
$result = $result->ValidateAccountResult;

这边的ValidateAccountResult是.net接口中定义好的返回结果。

也可以使用$result = $client->__call(”ValidateAccountResult”,array(’parameters’ =>$parms));来接收。

nusoap是一个PHP扩展类,无须安装,他可以让我们很简单的创建和使用soap webservice。

nusoap是开源的,目前最高版本0.7.3,支持SOAP 1.1, WSDL 1.1 和HTTP 1.0/1.1.,项目在sourceforge上,下载地址:按这里

Posted in php.

Tagged with , .


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.