PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

php调用soap接口出报错

原创
2016-10-11 14:23:28 1003浏览

<code>SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://27.148.153.106:9090/mpserver/services/CykProcService' : Extra content at the end of the document in /Users/haua/Desktop/zuji_web/www/quan.189go.cn/test2.php:47 Stack trace: #0 /Users/haua/Desktop/zuji_web/www/quan.189go.cn/test2.php
</code>

上面是报错

<code>$client = new SoapClient("http://27.148.153.106:9090/mpserver/services/CykProcService");
print_r($client->__getFunctions());
</code>

上面是我的代码,下面是wsdl

<code><?xml version="1.0" encoding="UTF-8"?><definitions targetnamespace="http://client.webservice.mpserver.ptnetwork.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://client.webservice.mpserver.ptnetwork.com" xmlns:intf="http://client.webservice.mpserver.ptnetwork.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)--><message name="doProcResponse"><part name="doProcReturn" type="xsd:int"></part></message><message name="doProcRequest"><part name="seq" type="xsd:string"></part><part name="userId" type="xsd:string"></part><part name="type" type="xsd:int"></part><part name="sign" type="xsd:string"></part></message><porttype name="CykProcService"><operation name="doProc" parameterorder="seq userId type sign"><input message="impl:doProcRequest" name="doProcRequest"><output message="impl:doProcResponse" name="doProcResponse"></output></operation></porttype><binding name="CykProcServiceSoapBinding" type="impl:CykProcService"><binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"></binding><operation name="doProc"><operation soapaction=""></operation><input name="doProcRequest"><output name="doProcResponse"><body encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://client.webservice.mpserver.ptnetwork.com" use="encoded"></body>

         </output></operation></binding><service name="CykProcServiceService"><port binding="impl:CykProcServiceSoapBinding" name="CykProcService"><address location="http://27.148.153.106:9090/mpserver/services/CykProcService"></address>

      </port></service></definitions></code>

上回有一次调用他们的http接口,也是设置了header才可以(代码见下方),不知道这个soap怎样设置

<code>$ch = curl_init();
curl_setopt ( $ch, CURLOPT_HTTPHEADER, array (//不知道为什么一定要这个他们才能接收到post数据
    'content-type: text/html'
));</code>

回复内容:

<code>SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://27.148.153.106:9090/mpserver/services/CykProcService' : Extra content at the end of the document in /Users/haua/Desktop/zuji_web/www/quan.189go.cn/test2.php:47 Stack trace: #0 /Users/haua/Desktop/zuji_web/www/quan.189go.cn/test2.php
</code>

上面是报错

<code>$client = new SoapClient("http://27.148.153.106:9090/mpserver/services/CykProcService");
print_r($client->__getFunctions());
</code>

上面是我的代码,下面是wsdl

<code><?xml version="1.0" encoding="UTF-8"?><definitions targetnamespace="http://client.webservice.mpserver.ptnetwork.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://client.webservice.mpserver.ptnetwork.com" xmlns:intf="http://client.webservice.mpserver.ptnetwork.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)--><message name="doProcResponse"><part name="doProcReturn" type="xsd:int"></part></message><message name="doProcRequest"><part name="seq" type="xsd:string"></part><part name="userId" type="xsd:string"></part><part name="type" type="xsd:int"></part><part name="sign" type="xsd:string"></part></message><porttype name="CykProcService"><operation name="doProc" parameterorder="seq userId type sign"><input message="impl:doProcRequest" name="doProcRequest"><output message="impl:doProcResponse" name="doProcResponse"></output></operation></porttype><binding name="CykProcServiceSoapBinding" type="impl:CykProcService"><binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"></binding><operation name="doProc"><operation soapaction=""></operation><input name="doProcRequest"><output name="doProcResponse"><body encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://client.webservice.mpserver.ptnetwork.com" use="encoded"></body>

         </output></operation></binding><service name="CykProcServiceService"><port binding="impl:CykProcServiceSoapBinding" name="CykProcService"><address location="http://27.148.153.106:9090/mpserver/services/CykProcService"></address>

      </port></service></definitions></code>

上回有一次调用他们的http接口,也是设置了header才可以(代码见下方),不知道这个soap怎样设置

<code>$ch = curl_init();
curl_setopt ( $ch, CURLOPT_HTTPHEADER, array (//不知道为什么一定要这个他们才能接收到post数据
    'content-type: text/html'
));</code>
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。