douque8855 2017-01-19 14:43
浏览 136

如何从不同的wsdl:binding类型调用“SOAP WSDL”函数,而它具有相同的函数名称

Please find main WDSL response in below coding.

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

Below is the PHP code I have used to call "RetrieveCollection" function.

    $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;

Above coding response will be like below array

stdClass Object
(
    [RetrieveCollectionResult] => stdClass Object
        (
            [AnyMorePages] => 
            [ExceptionInformation] => 
            [Items] => stdClass Object
                (
                    [Product] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [Id] => 21479131965317
                                    [Category] => stdClass Object
                                        (
                                            [Id] => 21487721936886
                                            [Code] => 046
                                            [Description] => DISCONTINUED
                                        )

                                    [Code] => 96RT
                                    [D_CreativeBarcode] => 761236103018
                                    [ECommerceSettings_ECommerceStatus] => Disabled
                                    [Measurements_NetWeight] => 0.110000
                                    [SellingPrice6] => 5.200200
                                    [Statistics_AvailableStockLevel] => 0.000000
                                )

                            [1] => stdClass Object
                                (
                                    [Id] => 21479131965338
                                    [Category] => stdClass Object
                                        (
                                            [Id] => 21487721936836
                                            [Code] => 021
                                            [Description] => CC Novelties
                                        )

                                    [Code] => CCBJK
                                    [D_CreativeBarcode] => 847878001384
                                    [ECommerceSettings_ECommerceStatus] => Enabled
                                    [Measurements_NetWeight] => 0.000000
                                    [SellingPrice6] => 9.166700
                                    [Statistics_AvailableStockLevel] => 61.000000
                                )

Also, $client->__getFunctions() function call response will be like below:

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)"
}

My question is: while I call the "RetrieveCollection" function, its returning all product details. Same function only used to get the Customers, order, Customer_delivery, ProductService...

How could we get customer, order details using same function?

Thank you!

  • 写回答

1条回答 默认 最新

  • doulvyi2172 2017-01-24 14:13
    关注

    Try the SoapClient:: __setLocation() function to change the end point to http://..../WSTRX/Product, http://..../WSTRX/Customer and then call the specific function name.

    评论

报告相同问题?

悬赏问题

  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算