php调用soap接口出报错

php中文网
发布: 2016-10-11 14:23:28
原创
1451人浏览过

<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>
登录后复制

上面是报错

挖错网
挖错网

一款支持文本、图片、视频纠错和AIGC检测的内容审核校对平台。

挖错网 28
查看详情 挖错网
<code>$client = new SoapClient("http://27.148.153.106:9090/mpserver/services/CykProcService");
print_r($client->__getFunctions());
</code>
登录后复制

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

立即学习PHP免费学习笔记(深入)”;

<code><?xml version="1.0" encoding="UTF-8"?>
<wsdl: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)-->

   <wsdl:message name="doProcResponse">

      <wsdl:part name="doProcReturn" type="xsd:int"/>

   </wsdl:message>

   <wsdl:message name="doProcRequest">

      <wsdl:part name="seq" type="xsd:string"/>

      <wsdl:part name="userId" type="xsd:string"/>

      <wsdl:part name="type" type="xsd:int"/>

      <wsdl:part name="sign" type="xsd:string"/>

   </wsdl:message>

   <wsdl:portType name="CykProcService">

      <wsdl:operation name="doProc" parameterOrder="seq userId type sign">

         <wsdl:input message="impl:doProcRequest" name="doProcRequest"/>

         <wsdl:output message="impl:doProcResponse" name="doProcResponse"/>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="CykProcServiceSoapBinding" type="impl:CykProcService">

      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="doProc">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="doProcRequest">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://client.webservice.mpserver.ptnetwork.com" use="encoded"/>

         </wsdl:input>

         <wsdl:output name="doProcResponse">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://client.webservice.mpserver.ptnetwork.com" use="encoded"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="CykProcServiceService">

      <wsdl:port binding="impl:CykProcServiceSoapBinding" name="CykProcService">

         <wsdlsoap:address location="http://27.148.153.106:9090/mpserver/services/CykProcService"/>

      </wsdl:port>

   </wsdl:service>

</wsdl: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

立即学习PHP免费学习笔记(深入)”;

<code><?xml version="1.0" encoding="UTF-8"?>
<wsdl: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)-->

   <wsdl:message name="doProcResponse">

      <wsdl:part name="doProcReturn" type="xsd:int"/>

   </wsdl:message>

   <wsdl:message name="doProcRequest">

      <wsdl:part name="seq" type="xsd:string"/>

      <wsdl:part name="userId" type="xsd:string"/>

      <wsdl:part name="type" type="xsd:int"/>

      <wsdl:part name="sign" type="xsd:string"/>

   </wsdl:message>

   <wsdl:portType name="CykProcService">

      <wsdl:operation name="doProc" parameterOrder="seq userId type sign">

         <wsdl:input message="impl:doProcRequest" name="doProcRequest"/>

         <wsdl:output message="impl:doProcResponse" name="doProcResponse"/>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="CykProcServiceSoapBinding" type="impl:CykProcService">

      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="doProc">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="doProcRequest">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://client.webservice.mpserver.ptnetwork.com" use="encoded"/>

         </wsdl:input>

         <wsdl:output name="doProcResponse">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://client.webservice.mpserver.ptnetwork.com" use="encoded"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="CykProcServiceService">

      <wsdl:port binding="impl:CykProcServiceSoapBinding" name="CykProcService">

         <wsdlsoap:address location="http://27.148.153.106:9090/mpserver/services/CykProcService"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>
</code>
登录后复制

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

<code>$ch = curl_init();
curl_setopt ( $ch, CURLOPT_HTTPHEADER, array (//不知道为什么一定要这个他们才能接收到post数据
    'content-type: text/html'
));</code>
登录后复制
相关标签:
php
PHP速学教程(入门到精通)
PHP速学教程(入门到精通)

PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号