<?xml version="1.0" encoding="UTF-8"?>
<definitions name="WebSmsSrv"
 targetNamespace="http://127.0.0.1:10000/WebSmsSrv.wsdl"
 xmlns:tns="http://127.0.0.1:10000/WebSmsSrv.wsdl"
 xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:ns="urn:WebSmsSrv"
 xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/"
 xmlns:MIME="http://schemas.xmlsoap.org/wsdl/mime/"
 xmlns:DIME="http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/"
 xmlns:WSDL="http://schemas.xmlsoap.org/wsdl/"
 xmlns="http://schemas.xmlsoap.org/wsdl/"><types> <schema targetNamespace="urn:WebSmsSrv"
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:ns="urn:WebSmsSrv"
  xmlns="http://www.w3.org/2001/XMLSchema"
  elementFormDefault="unqualified"
  attributeFormDefault="unqualified">
  <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
 </schema></types><message name="SendMessageRequest">
 <part name="sUserName" type="xsd:string"/>
 <part name="sSender" type="xsd:string"/>
 <part name="sRecvs" type="xsd:string"/>
 <part name="nRecvCount" type="xsd:int"/>
 <part name="sContent" type="xsd:string"/>
 <part name="nFeeType" type="xsd:int"/>
</message><message name="SendMessageResponse">
 <part name="sResp" type="xsd:string"/>
</message><message name="QuerySendHistRequest">
 <part name="sUserName" type="xsd:string"/>
 <part name="nInMsgId" type="xsd:int"/>
</message><message name="QuerySendHistResponse">
 <part name="sResp" type="xsd:string"/>
</message><message name="RecvMessageRequest">
 <part name="sUserName" type="xsd:string"/>
 <part name="sRecv" type="xsd:string"/>
</message><message name="RecvMessageResponse">
 <part name="sResp" type="xsd:string"/>
</message><message name="SendMessageExtRequest">
 <part name="sUserName" type="xsd:string"/>
 <part name="sSender" type="xsd:string"/>
 <part name="sRecvs" type="xsd:string"/>
 <part name="nRecvCount" type="xsd:int"/>
 <part name="sContent" type="xsd:string"/>
 <part name="nFeeType" type="xsd:int"/>
</message><message name="SendMessageExtResponse">
 <part name="sResp" type="xsd:string"/>
</message><portType name="WebSmsSrvPortType">
 <operation name="SendMessage">
  <documentation>Service definition of function ns__SendMessage</documentation>
  <input message="tns:SendMessageRequest"/>
  <output message="tns:SendMessageResponse"/>
 </operation>
 <operation name="QuerySendHist">
  <documentation>Service definition of function ns__QuerySendHist</documentation>
  <input message="tns:QuerySendHistRequest"/>
  <output message="tns:QuerySendHistResponse"/>
 </operation>
 <operation name="RecvMessage">
  <documentation>Service definition of function ns__RecvMessage</documentation>
  <input message="tns:RecvMessageRequest"/>
  <output message="tns:RecvMessageResponse"/>
 </operation>
 <operation name="SendMessageExt">
  <documentation>Service definition of function ns__SendMessageExt</documentation>
  <input message="tns:SendMessageExtRequest"/>
  <output message="tns:SendMessageExtResponse"/>
 </operation>
</portType><binding name="WebSmsSrv" type="tns:WebSmsSrvPortType">
 <SOAP:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
 <operation name="SendMessage">
  <SOAP:operation style="rpc" soapAction=""/>
  <input>
     <SOAP:body use="encoded" namespace="urn:WebSmsSrv" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  </input>
  <output>
     <SOAP:body use="encoded" namespace="urn:WebSmsSrv" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  </output>
 </operation>
 <operation name="QuerySendHist">
  <SOAP:operation style="rpc" soapAction=""/>
  <input>
     <SOAP:body use="encoded" namespace="urn:WebSmsSrv" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  </input>
  <output>
     <SOAP:body use="encoded" namespace="urn:WebSmsSrv" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  </output>
 </operation>
 <operation name="RecvMessage">
  <SOAP:operation style="rpc" soapAction=""/>
  <input>
     <SOAP:body use="encoded" namespace="urn:WebSmsSrv" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  </input>
  <output>
     <SOAP:body use="encoded" namespace="urn:WebSmsSrv" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  </output>
 </operation>
 <operation name="SendMessageExt">
  <SOAP:operation style="rpc" soapAction=""/>
  <input>
     <SOAP:body use="encoded" namespace="urn:WebSmsSrv" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  </input>
  <output>
     <SOAP:body use="encoded" namespace="urn:WebSmsSrv" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  </output>
 </operation>
</binding><service name="WebSmsSrv">
 <documentation>gSOAP 2.7.8c generated service definition</documentation>
 <port name="WebSmsSrv" binding="tns:WebSmsSrv">
  <SOAP:address location="http://127.0.0.1:10000/WebSmsSrv.cgi"/>
 </port>
</service></definitions>
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())."<bR>";
print_r($result);
分数不多了。请见谅
运行后出现
no operations defined in the WSDL document!PHPsoap

解决方案 »

  1.   

    你的 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 的参数不是结构