热搜:NVER node 开发 php

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

2024-09-18 10:50:01
php调用c#soap---no operations defined in the WSDL document!

PHP soap

<?xml version="1.0" encoding="UTF-8"?>                           Service definition of function ns__SendMessage        Service definition of function ns__QuerySendHist        Service definition of function ns__RecvMessage        Service 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即可解决