欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php调用c#soap---no operations defined in the WSDL document!

程序员文章站 2022-05-12 16:13:48
...
PHP soap
Service definition of function ns__SendMessageService definition of function ns__QuerySendHistService definition of function ns__RecvMessageService definition of function ns__SendMessageExt                        gSOAP 2.7.8c generated service definition


include_once('soap/nusoap.php');			$client = new nusoap_client('http://127.0.0.1:10000','wsdl');			$client->soap_defencoding = 'utf-8';			$client->decode_utf8 = false;			$client->xml_encoding = 'utf-8';			$sContent=SetToHexString('test发送数据');//字符串转16进制			$param=array(array("sUserName"=>'xx',"sSender"=>'051000000000','sRecvs'=>'13851400500','nRecvCount'=>1,'sContent'=>$sContent,'nFeeType'=>0));			$result = $client->call('ns__SendMessage', $param);			print_r($client->getError())."
"; print_r($result);


分数不多了。请见谅
运行后出现
no operations defined in the WSDL document!

回复讨论(解决方案)

自己up一下

你的 WSDL 只提供了这些方法
[0] => string SendMessage(string $sUserName, string $sSender, string $sRecvs, int $nRecvCount, string $sContent, int $nFeeType)
[1] => string QuerySendHist(string $sUserName, int $nInMsgId)
[2] => string RecvMessage(string $sUserName, string $sRecv)
[3] => string SendMessageExt(string $sUserName, string $sSender, string $sRecvs, int $nRecvCount, string $sContent, int $nFeeType)

即便是需要这样写
$result = $client->call('ns__SendMessage', $param);
那么 $param 也应该是一维数组
因为 SendMessage 的参数不是结构

用Nusoap即可解决