上头给的文档是这个
服务名称 方法名称 请求参数 WebService地址
yktyevwebservice getyktyewebservice RYBH,SIGN http://10.10.5.133/zfsjzx/services/yktyevwebservice?wsdl先贴下c#的代码ykt.yktyevwebservice yktye = new ykt.yktyevwebservice();
string ye = yktye.getyktyewebservice("abc", "abc");其中ye就是正确的内容然后我用php代码先用 SoapClient 来读取,都不行ini_set('default_socket_timeout',5000);
ini_set('soap.wsdl_cache_ttl',0);
 
function soapGet($url,$fun,$arg){
     
    $params = array (
    'encoding' => 'UTF-8', 
    'trace'=>1,
    'cache_wsdl'=>WSDL_CACHE_NONE,
    'soap_version' => SOAP_1_2, 
    'connection_timeout'=>5000,
    'uri'=>'http://ws.apache.org/axis2',
    );
    $client=new SoapClient($url,$params);
    return $client->$fun($arg[0],$arg[1]);
}
 
var_dump(soapGet('http://10.10.5.133/zfsjzx/services/yktyevwebservice?wsdl','getyktyewebservice',array(
    'abc',
    'abc',
 
)));
提示这个错误
<b>Fatal error</b>:  Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://10.10.5.133/zfsjzx/services/yktyevwebservice?wsdl' : failed to load external entity &quot;http://10.10.5.133/zfsjzx/services/yktyevwebservice?wsdl&quot;
 in D:\webhosts\weixin\web\t\t.php:22
Stack trace:
#0 D:\webhosts\weixin\web\t\t.php(22): SoapClient-&gt;SoapClient('http://10.10.5....', Array)
#1 D:\webhosts\weixin\web\t\t.php(43): soapGet('http://10.10.5....', 'getyktyewebserv...', Array)
#2 {main}
  thrown in <b>D:\webhosts\weixin\web\t\t.php</b> on line <b>22</b><br />
soapclient的各种参数调试了好久,网上查,然后换,还是不行
我直接file_get_contents($url) 是有正确的xml出来的-------------------------
后来又用了nusoap的代码如下require_once('nusoap/lib/nusoap.php');
function soapGet($url,$fun,$arg){
    $client=new nusoap_client($url);
    $client->soap_defencoding='utf-8';
    $client->decode_utf8=false;
    $result = $client->call($fun, $arg,'http://ws.apache.org/axis2','http://ws.apache.org/axis2');
 
    return $result;
}
var_dump(soapGet2('http://10.10.5.133/zfsjzx/services/yktyevwebservice?WSDL','getyktyewebservice',array(
    'RYBH'=>'abc',
    'SIGN'=>'abc',
)));这次返回<errors><error>密钥信息不匹配!请重新调用</error></errors>
开始我以为是sign不对,但是翻看上面的c#也是这么写的,我就郁闷了,不知道怎么办

解决方案 »

  1.   

    如果可能的话,请贴出 WSDL 的内容
    否则应贴出
    print_r( $client->__getFunctions ()); 
    print_r($client->__getTypes () ); 
    的结果
      

  2.   

    http://10.10.5.133/zfsjzx/services/yktyevwebservice?wsdl 的内容贴出来看看。
      

  3.   


    <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://ws.apache.org/axis2" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://ws.apache.org/axis2">
        <wsdl:types>
            <xs:schema attributeFormDefault="qualified" elementFormDefault="unqualified" targetNamespace="http://ws.apache.org/axis2">
                <xs:element name="yktyevwebserviceException">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element minOccurs="0" name="yktyevwebserviceException" nillable="true" type="ns:Exception"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:complexType name="Exception">
                    <xs:sequence>
                        <xs:element minOccurs="0" name="Message" nillable="true" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
                <xs:element name="getyktyewebservice">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element minOccurs="0" name="RYBH" nillable="true" type="xs:string"/>
                            <xs:element minOccurs="0" name="SIGN" nillable="true" type="xs:string"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="getyktyewebserviceResponse">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:schema>
        </wsdl:types>
        <wsdl:message name="getyktyewebserviceRequest">
            <wsdl:part name="parameters" element="ns:getyktyewebservice"/>
        </wsdl:message>
        <wsdl:message name="getyktyewebserviceResponse">
            <wsdl:part name="parameters" element="ns:getyktyewebserviceResponse"/>
        </wsdl:message>
        <wsdl:message name="yktyevwebserviceException">
            <wsdl:part name="parameters" element="ns:yktyevwebserviceException"/>
        </wsdl:message>
        <wsdl:portType name="yktyevwebservicePortType">
            <wsdl:operation name="getyktyewebservice">
                <wsdl:input message="ns:getyktyewebserviceRequest" wsaw:Action="urn:getyktyewebservice"/>
                <wsdl:output message="ns:getyktyewebserviceResponse" wsaw:Action="urn:getyktyewebserviceResponse"/>
                <wsdl:fault message="ns:yktyevwebserviceException" name="yktyevwebserviceException" wsaw:Action="urn:getyktyewebserviceyktyevwebserviceException"/>
            </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="yktyevwebserviceSoap11Binding" type="ns:yktyevwebservicePortType">
            <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
            <wsdl:operation name="getyktyewebservice">
                <soap:operation soapAction="urn:getyktyewebservice" style="document"/>
                <wsdl:input>
                    <soap:body use="literal"/>
                </wsdl:input>
                <wsdl:output>
                    <soap:body use="literal"/>
                </wsdl:output>
                <wsdl:fault name="yktyevwebserviceException">
                    <soap:fault use="literal" name="yktyevwebserviceException"/>
                </wsdl:fault>
            </wsdl:operation>
        </wsdl:binding>
        <wsdl:binding name="yktyevwebserviceSoap12Binding" type="ns:yktyevwebservicePortType">
            <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
            <wsdl:operation name="getyktyewebservice">
                <soap12:operation soapAction="urn:getyktyewebservice" style="document"/>
                <wsdl:input>
                    <soap12:body use="literal"/>
                </wsdl:input>
                <wsdl:output>
                    <soap12:body use="literal"/>
                </wsdl:output>
                <wsdl:fault name="yktyevwebserviceException">
                    <soap12:fault use="literal" name="yktyevwebserviceException"/>
                </wsdl:fault>
            </wsdl:operation>
        </wsdl:binding>
        <wsdl:binding name="yktyevwebserviceHttpBinding" type="ns:yktyevwebservicePortType">
            <http:binding verb="POST"/>
            <wsdl:operation name="getyktyewebservice">
                <http:operation location="getyktyewebservice"/>
                <wsdl:input>
                    <mime:content type="application/xml" part="parameters"/>
                </wsdl:input>
                <wsdl:output>
                    <mime:content type="application/xml" part="parameters"/>
                </wsdl:output>
            </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="yktyevwebservice">
            <wsdl:port name="yktyevwebserviceHttpSoap11Endpoint" binding="ns:yktyevwebserviceSoap11Binding">
                <soap:address location="http://10.10.5.133/zfsjzx/services/yktyevwebservice.yktyevwebserviceHttpSoap11Endpoint/"/>
            </wsdl:port>
            <wsdl:port name="yktyevwebserviceHttpSoap12Endpoint" binding="ns:yktyevwebserviceSoap12Binding">
                <soap12:address location="http://10.10.5.133/zfsjzx/services/yktyevwebservice.yktyevwebserviceHttpSoap12Endpoint/"/>
            </wsdl:port>
            <wsdl:port name="yktyevwebserviceHttpEndpoint" binding="ns:yktyevwebserviceHttpBinding">
                <http:address location="http://10.10.5.133/zfsjzx/services/yktyevwebservice.yktyevwebserviceHttpEndpoint/"/>
            </wsdl:port>
        </wsdl:service>
    </wsdl:definitions>
      

  4.   


    <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://ws.apache.org/axis2" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://ws.apache.org/axis2">
        <wsdl:types>
            <xs:schema attributeFormDefault="qualified" elementFormDefault="unqualified" targetNamespace="http://ws.apache.org/axis2">
                <xs:element name="yktyevwebserviceException">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element minOccurs="0" name="yktyevwebserviceException" nillable="true" type="ns:Exception"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:complexType name="Exception">
                    <xs:sequence>
                        <xs:element minOccurs="0" name="Message" nillable="true" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
                <xs:element name="getyktyewebservice">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element minOccurs="0" name="RYBH" nillable="true" type="xs:string"/>
                            <xs:element minOccurs="0" name="SIGN" nillable="true" type="xs:string"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="getyktyewebserviceResponse">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:schema>
        </wsdl:types>
        <wsdl:message name="getyktyewebserviceRequest">
            <wsdl:part name="parameters" element="ns:getyktyewebservice"/>
        </wsdl:message>
        <wsdl:message name="getyktyewebserviceResponse">
            <wsdl:part name="parameters" element="ns:getyktyewebserviceResponse"/>
        </wsdl:message>
        <wsdl:message name="yktyevwebserviceException">
            <wsdl:part name="parameters" element="ns:yktyevwebserviceException"/>
        </wsdl:message>
        <wsdl:portType name="yktyevwebservicePortType">
            <wsdl:operation name="getyktyewebservice">
                <wsdl:input message="ns:getyktyewebserviceRequest" wsaw:Action="urn:getyktyewebservice"/>
                <wsdl:output message="ns:getyktyewebserviceResponse" wsaw:Action="urn:getyktyewebserviceResponse"/>
                <wsdl:fault message="ns:yktyevwebserviceException" name="yktyevwebserviceException" wsaw:Action="urn:getyktyewebserviceyktyevwebserviceException"/>
            </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="yktyevwebserviceSoap11Binding" type="ns:yktyevwebservicePortType">
            <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
            <wsdl:operation name="getyktyewebservice">
                <soap:operation soapAction="urn:getyktyewebservice" style="document"/>
                <wsdl:input>
                    <soap:body use="literal"/>
                </wsdl:input>
                <wsdl:output>
                    <soap:body use="literal"/>
                </wsdl:output>
                <wsdl:fault name="yktyevwebserviceException">
                    <soap:fault use="literal" name="yktyevwebserviceException"/>
                </wsdl:fault>
            </wsdl:operation>
        </wsdl:binding>
        <wsdl:binding name="yktyevwebserviceSoap12Binding" type="ns:yktyevwebservicePortType">
            <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
            <wsdl:operation name="getyktyewebservice">
                <soap12:operation soapAction="urn:getyktyewebservice" style="document"/>
                <wsdl:input>
                    <soap12:body use="literal"/>
                </wsdl:input>
                <wsdl:output>
                    <soap12:body use="literal"/>
                </wsdl:output>
                <wsdl:fault name="yktyevwebserviceException">
                    <soap12:fault use="literal" name="yktyevwebserviceException"/>
                </wsdl:fault>
            </wsdl:operation>
        </wsdl:binding>
        <wsdl:binding name="yktyevwebserviceHttpBinding" type="ns:yktyevwebservicePortType">
            <http:binding verb="POST"/>
            <wsdl:operation name="getyktyewebservice">
                <http:operation location="getyktyewebservice"/>
                <wsdl:input>
                    <mime:content type="application/xml" part="parameters"/>
                </wsdl:input>
                <wsdl:output>
                    <mime:content type="application/xml" part="parameters"/>
                </wsdl:output>
            </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="yktyevwebservice">
            <wsdl:port name="yktyevwebserviceHttpSoap11Endpoint" binding="ns:yktyevwebserviceSoap11Binding">
                <soap:address location="http://10.10.5.133/zfsjzx/services/yktyevwebservice.yktyevwebserviceHttpSoap11Endpoint/"/>
            </wsdl:port>
            <wsdl:port name="yktyevwebserviceHttpSoap12Endpoint" binding="ns:yktyevwebserviceSoap12Binding">
                <soap12:address location="http://10.10.5.133/zfsjzx/services/yktyevwebservice.yktyevwebserviceHttpSoap12Endpoint/"/>
            </wsdl:port>
            <wsdl:port name="yktyevwebserviceHttpEndpoint" binding="ns:yktyevwebserviceHttpBinding">
                <http:address location="http://10.10.5.133/zfsjzx/services/yktyevwebservice.yktyevwebserviceHttpEndpoint/"/>
            </wsdl:port>
        </wsdl:service>
    </wsdl:definitions>
      

  5.   

    $client=new SoapClient($url,$params);
    return $client->$fun(array('RYBH' => $arg[0], 'SIGN' => $arg[1]));
      

  6.   


    也不行,主要是报错的是这一句 $client=new SoapClient($url,$params);<b>Fatal error</b>:  Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://10.10.5.133/zfsjzx/services/yktyevwebservice?wsdl' : failed to load external entity &quot;http://10.10.5.133/zfsjzx/services/yktyevwebservice?wsdl&quot;
     in D:\webhosts\weixin\web\t\t.php:18
    Stack trace:
    #0 D:\webhosts\weixin\web\t\t.php(18): SoapClient-&gt;SoapClient('http://10.10.5....', Array)
    #1 D:\webhosts\weixin\web\t\t.php(38): soapGet('http://10.10.5....', 'getyktyewebserv...', Array)
    #2 {main}
      thrown in <b>D:\webhosts\weixin\web\t\t.php</b> on line <b>18</b><br />