Php 如何调用&x201C;SOAP-WSDL”;来自不同wsdl:binding类型的函数,而其具有相同的函数名

Php 如何调用&x201C;SOAP-WSDL”;来自不同wsdl:binding类型的函数,而其具有相同的函数名,php,xml,soap,wsdl,Php,Xml,Soap,Wsdl,请在下面的编码中找到主要的WDSL响应。 <wsdl:binding name="BasicHttpBinding_IProductService" type="i0:IProductService"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="RetrieveByKey"> <soap:operation soapActi

请在下面的编码中找到主要的WDSL响应。

<wsdl:binding name="BasicHttpBinding_IProductService" type="i0:IProductService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="RetrieveByKey">
<soap:operation soapAction="WSTRX/Product/IProductService/RetrieveByKey" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="RetrieveCollection">
<soap:operation soapAction="WSTRX/Product/IProductService/RetrieveCollection" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Validate">
<soap:operation soapAction="WSTRX/Product/IProductService/Validate" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="BasicHttpBinding_ICustomerService" type="i1:ICustomerService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="RetrieveByKey">
<soap:operation soapAction="WSTRX/Customer/ICustomerService/RetrieveByKey" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="RetrieveCollection">
<soap:operation soapAction="WSTRX/Customer/ICustomerService/RetrieveCollection" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Validate">
<soap:operation soapAction="WSTRX/Customer/ICustomerService/Validate" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="BasicHttpBinding_ISalesOrderService" type="i2:ISalesOrderService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="RetrieveCollection">
<soap:operation soapAction="WSTRX/SalesOrder/ISalesOrderService/RetrieveCollection" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Store">
<soap:operation soapAction="WSTRX/SalesOrder/ISalesOrderService/Store" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Validate">
<soap:operation soapAction="WSTRX/SalesOrder/ISalesOrderService/Validate" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="BasicHttpBinding_ISalesOrder_lineService" type="i3:ISalesOrder_lineService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="RetrieveCollection">
<soap:operation soapAction="WSTRX/SalesOrder_line/ISalesOrder_lineService/RetrieveCollection" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Validate">
<soap:operation soapAction="WSTRX/SalesOrder_line/ISalesOrder_lineService/Validate" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="BasicHttpBinding_ICustomer_deliveryContactService" type="i4:ICustomer_deliveryContactService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="RetrieveCollection">
<soap:operation soapAction="WSTRX/Customer_deliveryContact/ICustomer_deliveryContactService/RetrieveCollection" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Validate">
<soap:operation soapAction="WSTRX/Customer_deliveryContact/ICustomer_deliveryContactService/Validate" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
array(13) {
  [0]=>
  string(62) "RetrieveByKeyResponse RetrieveByKey(RetrieveByKey $parameters)"
  [1]=>
  string(77) "RetrieveCollectionResponse RetrieveCollection(RetrieveCollection $parameters)"
  [2]=>
  string(47) "ValidateResponse Validate(Validate $parameters)"
  [3]=>
  string(62) "RetrieveByKeyResponse RetrieveByKey(RetrieveByKey $parameters)"
  [4]=>
  string(77) "RetrieveCollectionResponse RetrieveCollection(RetrieveCollection $parameters)"
  [5]=>
  string(47) "ValidateResponse Validate(Validate $parameters)"
  [6]=>
  string(77) "RetrieveCollectionResponse RetrieveCollection(RetrieveCollection $parameters)"
  [7]=>
  string(38) "StoreResponse Store(Store $parameters)"
  [8]=>
  string(47) "ValidateResponse Validate(Validate $parameters)"
  [9]=>
  string(77) "RetrieveCollectionResponse RetrieveCollection(RetrieveCollection $parameters)"
  [10]=>
  string(47) "ValidateResponse Validate(Validate $parameters)"
  [11]=>
  string(77) "RetrieveCollectionResponse RetrieveCollection(RetrieveCollection $parameters)"
  [12]=>
  string(47) "ValidateResponse Validate(Validate $parameters)"
}
另外,$client->\uu getFunctions()函数调用响应如下:

我的问题是:当我调用“RetrieveCollection”函数时,它会返回所有产品详细信息。同一功能仅用于获取客户、订单、客户交付、产品服务…

    $options = array(
            'uri'=>'http://schemas.xmlsoap.org/soap/envelope/',
            'style'=>SOAP_RPC,
            'use'=>SOAP_ENCODED,
            'soap_version'=>SOAP_1_1,
            'cache_wsdl'=>WSDL_CACHE_NONE,
            'connection_timeout'=>500000,
            'trace'=>true,
            'encoding'=>'UTF-8',
            'exceptions'=>true,
            'keep_alive' => false,
        );
    try {
        $soap = new SoapClient($wsdl, $options);    
        $data = $soap->RetrieveCollection('BasicHttpBinding_ICustomerService');
    }
    catch(Exception $e) {
        die($e->getMessage());
    }  
    echo "<pre>";
    var_dump($client->__getFunctions());  
    print_r($data);
    die;
我们如何使用相同的功能获取客户、订单详细信息?


谢谢大家!

尝试使用SoapClient::\uu setLocation()函数将端点更改为,然后调用特定的函数名。

您好,先生,使用setLocation时,下面显示错误,如下所示:仅供参考。同时,我正在根据您的评论检查解决方案**$soap=新的SoapClient($wsdl,$options)$soap->设置位置(')**错误由于EndpointDispatcher上的ContractFilter不匹配,无法在接收器上处理带有操作“WSTRX/Product/IPProductService/RetrieveCollection”的消息。这可能是因为合同不匹配(发送方和接收方之间的操作不匹配)或发送方和接收方之间的绑定/安全不匹配。检查发送方和接收方是否具有相同的合同和相同的绑定(包括安全要求,例如消息、传输、无)。
array(13) {
  [0]=>
  string(62) "RetrieveByKeyResponse RetrieveByKey(RetrieveByKey $parameters)"
  [1]=>
  string(77) "RetrieveCollectionResponse RetrieveCollection(RetrieveCollection $parameters)"
  [2]=>
  string(47) "ValidateResponse Validate(Validate $parameters)"
  [3]=>
  string(62) "RetrieveByKeyResponse RetrieveByKey(RetrieveByKey $parameters)"
  [4]=>
  string(77) "RetrieveCollectionResponse RetrieveCollection(RetrieveCollection $parameters)"
  [5]=>
  string(47) "ValidateResponse Validate(Validate $parameters)"
  [6]=>
  string(77) "RetrieveCollectionResponse RetrieveCollection(RetrieveCollection $parameters)"
  [7]=>
  string(38) "StoreResponse Store(Store $parameters)"
  [8]=>
  string(47) "ValidateResponse Validate(Validate $parameters)"
  [9]=>
  string(77) "RetrieveCollectionResponse RetrieveCollection(RetrieveCollection $parameters)"
  [10]=>
  string(47) "ValidateResponse Validate(Validate $parameters)"
  [11]=>
  string(77) "RetrieveCollectionResponse RetrieveCollection(RetrieveCollection $parameters)"
  [12]=>
  string(47) "ValidateResponse Validate(Validate $parameters)"
}