Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jan 2010
    Location
    Cardiff, UK
    Posts
    24
    Thanks
    2
    Thanked 0 Times in 0 Posts

    PHP call to SOAP web service that has multiple read() methods in the same service

    Using PHP, I need to call a SOAP web service that has multiple read() methods in the same service, but with different port names.

    By default the service is calling the BasicHttpBinding_SalesInvoiceService version of the read() method,
    but I need to call the BasicHttpBinding_SalesOrderService version of the read() method.

    PHP Code:
    $service_name 'RoutingService';
    $port_name_01 'BasicHttpBinding_SalesInvoiceService';
    $port_name_02 'BasicHttpBinding_SalesOrderService'
    How do I force it to call the correct read() method?

    WSDL PART:

    Code:
    <wsdl:service name="RoutingService">
    
    	<wsdl:port name="reqReplyEndpoint" binding="tns:reqReplyEndpoint">
    	<soap:address location="http://gtcu17aosv03.utility.local/SalesOrderHttp/xppservice.svc" /> 
    	</wsdl:port>
    
    	<wsdl:port name="BasicHttpBinding_SalesInvoiceService" binding="tns:BasicHttpBinding_SalesInvoiceService">
    	<soap:address location="http://gtcu17aosv03.utility.local/SalesOrderHttp/xppservice.svc" /> 
    	</wsdl:port>
    
    	<wsdl:port name="BasicHttpBinding_SalesOrderService" binding="tns:BasicHttpBinding_SalesOrderService">
    	<soap:address location="http://gtcu17aosv03.utility.local/SalesOrderHttp/xppservice.svc" /> 
    	</wsdl:port>
    
    </wsdl:service>
    MY CODE:
    PHP Code:
    $wsdl "http://MY_DOMAIN/SalesOrderHttp/xppservice.svc?wsdl";
    $arr_options = array();
    $arr_options['trace'] = 1;
    $arr_options['soap_version'] = SOAP_1_1;
    $arr_options['compression']  = SOAP_COMPRESSION_ACCEPT;
    $client = new SoapClient($wsdl$arr_options);
    $entityKeyList = new StdClass();
    $entityKeyList->EntityKey->KeyData->KeyField["Field"] = "SalesId";
    $entityKeyList->EntityKey->KeyData->KeyField["Value"] = "ABC-12345";
    $response $client->read(array("EntityKeyList" => $entityKeyList)); 
    I guess I need to do one of the following, but cannot work it out:
    1. Add another $arr_option value.
    2. Add a parameter to SoapClient() or
    3. Add a parameter to $client->read()

    Thanks in advance.

    John.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    There's not enough information here. Its been awhile since I've dealt with manual wsdl, and I have to admit PHP's soap client's aren't the easiest to work with, but we should be able to figure this out.
    Post the entire WSDL in use. I'm not sure the rules around overloading in wsdl or if its even possible.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    New Coder
    Join Date
    Jan 2010
    Location
    Cardiff, UK
    Posts
    24
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Multiple read() methods in the same WSDL

    Hi - thanks for the interest - here is the whole WSDL:

    Code:
    <?xml version="1.0" encoding="utf-8" ?>
    <wsdl:definitions name="RoutingService" 
         targetNamespace="http://tempuri.org/" 
         xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
    	 xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    	 xmlns:i1="http://schemas.microsoft.com/dynamics/2008/01/services" 
    	 xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
    	 xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
    	 xmlns:tns="http://tempuri.org/" 
    	 xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" 
    	 xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" 
    	 xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
    	 xmlns:wsa10="http://www.w3.org/2005/08/addressing" 
    	 xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 
    	 xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" 
    	 xmlns:i0="http://schemas.microsoft.com/netfx/2009/05/routing" 
    	 xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" 
    	 xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
    
      <wsdl:import namespace="http://schemas.microsoft.com/netfx/2009/05/routing" location="http://MY_DOMAIN/SalesOrderHttp/xppservice.svc?wsdl=wsdl0" /> 
    
      <wsdl:import namespace="http://schemas.microsoft.com/dynamics/2008/01/services" location="http://MY_DOMAIN/SalesOrderHttp/xppservice.svc?wsdl=wsdl1" /> 
    
      <wsdl:types /> 
    
    <wsdl:binding name="reqReplyEndpoint" type="i0:IRequestReplyRouter">
    
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> 
    
      </wsdl:binding>
    
    <wsdl:binding name="BasicHttpBinding_SalesInvoiceService" type="i1:SalesInvoiceService">
    
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> 
    
    <wsdl:operation name="read">
    
      <soap:operation soapAction="http://schemas.microsoft.com/dynamics/2008/01/services/SalesInvoiceService/read" style="document" /> 
    
    <wsdl:input name="SalesInvoiceServiceReadRequest">
    
      <soap:header message="i1:SalesInvoiceServiceReadRequest_Headers" part="context" use="literal" /> 
    
      <soap:body use="literal" /> 
    
      </wsdl:input>
    
    <wsdl:output name="SalesInvoiceServiceReadResponse">
    
      <soap:body use="literal" /> 
    
      </wsdl:output>
    
    <wsdl:fault name="AifFaultFault">
    
      <soap:fault name="AifFaultFault" use="literal" /> 
    
      </wsdl:fault>
    
      </wsdl:operation>
    
    <wsdl:operation name="getKeys">
    
      <soap:operation soapAction="http://schemas.microsoft.com/dynamics/2008/01/services/SalesInvoiceService/getKeys" style="document" /> 
    
    <wsdl:input name="SalesInvoiceServiceGetKeysRequest">
    
      <soap:header message="i1:SalesInvoiceServiceGetKeysRequest_Headers" part="context" use="literal" /> 
    
      <soap:body use="literal" /> 
    
      </wsdl:input>
    
    <wsdl:output name="SalesInvoiceServiceGetKeysResponse">
    
      <soap:body use="literal" /> 
    
      </wsdl:output>
    
    <wsdl:fault name="AifFaultFault">
    
      <soap:fault name="AifFaultFault" use="literal" /> 
    
      </wsdl:fault>
    
      </wsdl:operation>
    
    <wsdl:operation name="getChangedKeys">
    
      <soap:operation soapAction="http://schemas.microsoft.com/dynamics/2008/01/services/SalesInvoiceService/getChangedKeys" style="document" /> 
    
    <wsdl:input name="SalesInvoiceServiceGetChangedKeysRequest">
    
      <soap:header message="i1:SalesInvoiceServiceGetChangedKeysRequest_Headers" part="context" use="literal" /> 
    
      <soap:body use="literal" /> 
    
      </wsdl:input>
    
    <wsdl:output name="SalesInvoiceServiceGetChangedKeysResponse">
    
      <soap:body use="literal" /> 
    
      </wsdl:output>
    
    <wsdl:fault name="AifFaultFault">
    
      <soap:fault name="AifFaultFault" use="literal" /> 
    
      </wsdl:fault>
    
      </wsdl:operation>
    
    <wsdl:operation name="find">
    
      <soap:operation soapAction="http://schemas.microsoft.com/dynamics/2008/01/services/SalesInvoiceService/find" style="document" /> 
    
    <wsdl:input name="SalesInvoiceServiceFindRequest">
    
      <soap:header message="i1:SalesInvoiceServiceFindRequest_Headers" part="context" use="literal" /> 
    
      <soap:body use="literal" /> 
    
      </wsdl:input>
    
    <wsdl:output name="SalesInvoiceServiceFindResponse">
    
      <soap:body use="literal" /> 
    
      </wsdl:output>
    
    <wsdl:fault name="AifFaultFault">
    
      <soap:fault name="AifFaultFault" use="literal" /> 
    
      </wsdl:fault>
    
      </wsdl:operation>
    
    <wsdl:operation name="findKeys">
    
      <soap:operation soapAction="http://schemas.microsoft.com/dynamics/2008/01/services/SalesInvoiceService/findKeys" style="document" /> 
    
    <wsdl:input name="SalesInvoiceServiceFindKeysRequest">
    
      <soap:header message="i1:SalesInvoiceServiceFindKeysRequest_Headers" part="context" use="literal" /> 
    
      <soap:body use="literal" /> 
    
      </wsdl:input>
    
    <wsdl:output name="SalesInvoiceServiceFindKeysResponse">
    
      <soap:body use="literal" /> 
    
      </wsdl:output>
    
    <wsdl:fault name="AifFaultFault">
    
      <soap:fault name="AifFaultFault" use="literal" /> 
    
      </wsdl:fault>
    
      </wsdl:operation>
    
      </wsdl:binding>
    
    <wsdl:binding name="BasicHttpBinding_SalesOrderService" type="i1:SalesOrderService">
    
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> 
    
    <wsdl:operation name="update">
    
      <soap:operation soapAction="http://schemas.microsoft.com/dynamics/2008/01/services/SalesOrderService/update" style="document" /> 
    
    <wsdl:input name="SalesOrderServiceUpdateRequest">
    
      <soap:header message="i1:SalesOrderServiceUpdateRequest_Headers" part="context" use="literal" /> 
    
      <soap:body use="literal" /> 
    
      </wsdl:input>
    
    <wsdl:output name="SalesOrderServiceUpdateResponse">
    
      <soap:body use="literal" /> 
    
      </wsdl:output>
    
    <wsdl:fault name="AifFaultFault">
    
      <soap:fault name="AifFaultFault" use="literal" /> 
    
      </wsdl:fault>
    
      </wsdl:operation>
    
    <wsdl:operation name="read">
    
      <soap:operation soapAction="http://schemas.microsoft.com/dynamics/2008/01/services/SalesOrderService/read" style="document" /> 
    
    <wsdl:input name="SalesOrderServiceReadRequest">
    
      <soap:header message="i1:SalesOrderServiceReadRequest_Headers" part="context" use="literal" /> 
    
      <soap:body use="literal" /> 
    
      </wsdl:input>
    
    <wsdl:output name="SalesOrderServiceReadResponse">
    
      <soap:body use="literal" /> 
    
      </wsdl:output>
    
    <wsdl:fault name="AifFaultFault">
    
      <soap:fault name="AifFaultFault" use="literal" /> 
    
      </wsdl:fault>
    
      </wsdl:operation>
    
    <wsdl:operation name="create">
    
      <soap:operation soapAction="http://schemas.microsoft.com/dynamics/2008/01/services/SalesOrderService/create" style="document" /> 
    
    <wsdl:input name="SalesOrderServiceCreateRequest">
    
      <soap:header message="i1:SalesOrderServiceCreateRequest_Headers" part="context" use="literal" /> 
    
      <soap:body use="literal" /> 
    
      </wsdl:input>
    
    <wsdl:output name="SalesOrderServiceCreateResponse">
    
      <soap:body use="literal" /> 
    
      </wsdl:output>
    
    <wsdl:fault name="AifFaultFault">
    
      <soap:fault name="AifFaultFault" use="literal" /> 
    
      </wsdl:fault>
    
      </wsdl:operation>
    
    <wsdl:operation name="findKeys">
    
      <soap:operation soapAction="http://schemas.microsoft.com/dynamics/2008/01/services/SalesOrderService/findKeys" style="document" /> 
    
    <wsdl:input name="SalesOrderServiceFindKeysRequest">
    
      <soap:header message="i1:SalesOrderServiceFindKeysRequest_Headers" part="context" use="literal" /> 
    
      <soap:body use="literal" /> 
    
      </wsdl:input>
    
    <wsdl:output name="SalesOrderServiceFindKeysResponse">
    
      <soap:body use="literal" /> 
    
      </wsdl:output>
    
    <wsdl:fault name="AifFaultFault">
    
      <soap:fault name="AifFaultFault" use="literal" /> 
    
      </wsdl:fault>
    
      </wsdl:operation>
    
    <wsdl:operation name="getChangedKeys">
    
      <soap:operation soapAction="http://schemas.microsoft.com/dynamics/2008/01/services/SalesOrderService/getChangedKeys" style="document" /> 
    
    <wsdl:input name="SalesOrderServiceGetChangedKeysRequest">
    
      <soap:header message="i1:SalesOrderServiceGetChangedKeysRequest_Headers" part="context" use="literal" /> 
    
      <soap:body use="literal" /> 
    
      </wsdl:input>
    
    <wsdl:output name="SalesOrderServiceGetChangedKeysResponse">
    
      <soap:body use="literal" /> 
    
      </wsdl:output>
    
    <wsdl:fault name="AifFaultFault">
    
      <soap:fault name="AifFaultFault" use="literal" /> 
    
      </wsdl:fault>
    
      </wsdl:operation>
    
    <wsdl:operation name="getKeys">
    
      <soap:operation soapAction="http://schemas.microsoft.com/dynamics/2008/01/services/SalesOrderService/getKeys" style="document" /> 
    
    <wsdl:input name="SalesOrderServiceGetKeysRequest">
    
      <soap:header message="i1:SalesOrderServiceGetKeysRequest_Headers" part="context" use="literal" /> 
    
      <soap:body use="literal" /> 
    
      </wsdl:input>
    
    <wsdl:output name="SalesOrderServiceGetKeysResponse">
    
      <soap:body use="literal" /> 
    
      </wsdl:output>
    
    <wsdl:fault name="AifFaultFault">
    
      <soap:fault name="AifFaultFault" use="literal" /> 
    
      </wsdl:fault>
    
      </wsdl:operation>
    
    <wsdl:operation name="delete">
    
      <soap:operation soapAction="http://schemas.microsoft.com/dynamics/2008/01/services/SalesOrderService/delete" style="document" /> 
    
    <wsdl:input name="SalesOrderServiceDeleteRequest">
    
      <soap:header message="i1:SalesOrderServiceDeleteRequest_Headers" part="context" use="literal" /> 
    
      <soap:body use="literal" /> 
    
      </wsdl:input>
    
    <wsdl:output name="SalesOrderServiceDeleteResponse">
    
      <soap:body use="literal" /> 
    
      </wsdl:output>
    
    <wsdl:fault name="AifFaultFault">
    
      <soap:fault name="AifFaultFault" use="literal" /> 
    
      </wsdl:fault>
    
      </wsdl:operation>
    
    <wsdl:operation name="find">
    
      <soap:operation soapAction="http://schemas.microsoft.com/dynamics/2008/01/services/SalesOrderService/find" style="document" /> 
    
    <wsdl:input name="SalesOrderServiceFindRequest">
    
      <soap:header message="i1:SalesOrderServiceFindRequest_Headers" part="context" use="literal" /> 
    
      <soap:body use="literal" /> 
    
      </wsdl:input>
    
    <wsdl:output name="SalesOrderServiceFindResponse">
    
      <soap:body use="literal" /> 
    
      </wsdl:output>
    
    <wsdl:fault name="AifFaultFault">
    
      <soap:fault name="AifFaultFault" use="literal" /> 
    
      </wsdl:fault>
    
      </wsdl:operation>
    
      </wsdl:binding>
    
    <wsdl:service name="RoutingService">
    
    <wsdl:port name="reqReplyEndpoint" binding="tns:reqReplyEndpoint">
    
      <soap:address location="http://MY_DOMAIN/SalesOrderHttp/xppservice.svc" /> 
    
      </wsdl:port>
    
    <wsdl:port name="BasicHttpBinding_SalesInvoiceService" binding="tns:BasicHttpBinding_SalesInvoiceService">
    
      <soap:address location="http://MY_DOMAIN/SalesOrderHttp/xppservice.svc" /> 
    
      </wsdl:port>
    
    <wsdl:port name="BasicHttpBinding_SalesOrderService" binding="tns:BasicHttpBinding_SalesOrderService">
    
      <soap:address location="http://MY_DOMAIN/SalesOrderHttp/xppservice.svc" /> 
    
      </wsdl:port>
    
      </wsdl:service>
    
      </wsdl:definitions>

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Okay, so it sounds like WSDL1.1 specification supported the use of overloading. In order to do this, you need to provide different arguments to the input signature. I don't know if you can simply modify an action (it doesn't sound like it I'm afraid :/). So in otherwords, I don't believe there's any way to perform the task you are looking to do (1.2 is the WSDL version).
    I don't think there's any way to trick it directly. I'll try a few things in both 1.1 and 1.2 to see if it gets me anywhere though (PHP doesn't cope well with overloading in any situation). Otherwise, methinks you'll need to create unique names for the soap operations (and use your backend to map whatever you need from there).
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •