> 백엔드 개발 > PHP 튜토리얼 > php调用c#soap---no operations defined in the WSDL document!

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

WBOY
풀어 주다: 2016-06-23 14:15:52
원래의
937명이 탐색했습니다.

PHP soap

<?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!

回复讨论(解决方案)

自己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即可解决

원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿