Loading ...
Sorry, an error occurred while loading the content.

5562SOAP::Lite client, .Net web service, and complex parameter types - HELP!

Expand Messages
  • Terrence Beard
    Aug 22, 2006
    • 0 Attachment
      All:

      I'm having some difficulties, and was hoping someone here would have
      the answer. I have a SOAP::List client that's calling a .Net web
      service. The web service has been configured as an RPC service, per
      the documentation. I'm able to connect to the service, and
      successfully invoke methods with simple parameter types (either none
      or strings or the like).

      The problem comes in when I attempt to communicate with methods that
      take complex types (i.e. - a class). The call is failing on the web
      service side; specifically, the method states that the parameter is
      coming in null.

      I also have a .Net client that is able to successfully commmunicate
      with the web service.

      Note: the method I'm about to detail also takes a SOAP header with
      user authentication information. I wrote a quick test method, and
      the SOAP header is also NOT being received properly.

      The following is the relevant sections of the WSDL for the web
      service:

      <?xml version="1.0" encoding="utf-8"?>
      <wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
      xmlns:s="http://www.w3.org/2001/XMLSchema"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:tns="http://tmnclarifywebclient.gcintranet.net/WS/"
      xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
      xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
      targetNamespace="http://tmnclarifywebclient.gcintranet.net/WS/"
      xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
      <wsdl:types>
      <s:schema
      targetNamespace="http://tmnclarifywebclient.gcintranet.net/WS/">
      <s:import
      namespace="http://schemas.xmlsoap.org/soap/encoding/" />
      <s:import namespace="http://schemas.xmlsoap.org/wsdl/" />
      <s:complexType name="AuthHeaderCS">
      <s:sequence>
      <s:element minOccurs="1" maxOccurs="1" name="Username"
      type="s:string" />
      <s:element minOccurs="1" maxOccurs="1" name="Password"
      type="s:string" />
      <s:element minOccurs="1" maxOccurs="1" name="SessionID"
      type="s:string" />
      </s:sequence>
      </s:complexType>
      <s:complexType name="CaseDetailsRequest">
      <s:sequence>
      <s:element minOccurs="1" maxOccurs="1" name="caseID"
      type="s:string" />
      <s:element minOccurs="1" maxOccurs="1" name="audience"
      type="s:string" />
      <s:element minOccurs="1" maxOccurs="1"
      name="orderNotesAscending" type="s:boolean" />
      <s:element minOccurs="1" maxOccurs="1" name="detailsOnly"
      type="s:boolean" />
      </s:sequence>
      </s:complexType>
      <s:complexType name="CaseDetailResult">
      <s:complexContent mixed="false">
      <s:extension base="tns:ResultBase">
      <s:sequence>
      <s:element minOccurs="1" maxOccurs="1" name="details"
      type="tns:CaseDetailsData" />
      <s:element minOccurs="1" maxOccurs="1" name="notes"
      type="tns:ArrayOfNotesData" />
      </s:sequence>
      </s:extension>
      </s:complexContent>
      </s:complexType>
      </s:complexType>
      </s:schema>
      </wsdl:types>
      <wsdl:message name="CaseDetailsSoapIn">
      <wsdl:part name="cdr" type="tns:CaseDetailsRequest" />
      </wsdl:message>
      <wsdl:message name="CaseDetailsSoapOut">
      <wsdl:part name="CaseDetailsResult"
      type="tns:CaseDetailResult" />
      </wsdl:message>
      <wsdl:message name="CaseDetailsAuthHeaderCS">
      <wsdl:part name="AuthHeaderCS" type="tns:AuthHeaderCS" />
      </wsdl:message>
      <wsdl:portType name="GCWS_CaseSoap">
      <wsdl:operation name="CaseDetails">
      <documentation
      xmlns="http://schemas.xmlsoap.org/wsdl/">Retrieves the details of a
      case, and any associated notes </documentation>
      <wsdl:input message="tns:CaseDetailsSoapIn" />
      <wsdl:output message="tns:CaseDetailsSoapOut" />
      </wsdl:operation>
      </wsdl:portType>
      <wsdl:binding name="GCWS_CaseSoap" type="tns:GCWS_CaseSoap">
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
      style="rpc" />
      <wsdl:operation name="CaseDetails">
      <soap:operation
      soapAction="http://tmnclarifywebclient.gcintranet.net/WS/CaseDetails"
      style="rpc" />
      <wsdl:input>
      <soap:body use="encoded"
      namespace="http://tmnclarifywebclient.gcintranet.net/WS/"
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      <soap:header message="tns:CaseDetailsAuthHeaderCS"
      part="AuthHeaderCS" use="encoded"
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </wsdl:input>
      <wsdl:output>
      <soap:body use="encoded"
      namespace="http://tmnclarifywebclient.gcintranet.net/WS/"
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      <soap:header message="tns:CaseDetailsAuthHeaderCS"
      part="AuthHeaderCS" use="encoded"
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </wsdl:output>
      </wsdl:operation>
      </wsdl:binding>
      <wsdl:service name="GCWS_Case">
      <documentation xmlns="http://schemas.xmlsoap.org/wsdl/">Provides
      services for creating cases, retrieving their detail, and associated
      data.</documentation>
      <wsdl:port name="GCWS_CaseSoap" binding="tns:GCWS_CaseSoap">
      <soap:address
      location="http://localhost/gx/webServices/GlobalClarifyWS/GCWS_Case.a
      smx" />
      </wsdl:port>
      </wsdl:service>
      </wsdl:definitions>

      Here is the SOAP request and response from the SOAP::Lite client:

      -----SoapRequest at 8/21/2006 4:28:11 PM
      <?xml version="1.0" encoding="UTF-8"?><soap:Envelope
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><
      AuthHeaderCS
      xmlns="http://tmnclarifywebclient.gcintranet.net/WS/"><Username
      xsi:type="xsd:string">USER</Username><Password
      xsi:type="xsd:string">PSWD</Password></AuthHeaderCS></soap:Header><so
      ap:Body><CaseDetails
      xmlns="http://tmnclarifywebclient.gcintranet.net/WS/"><cdr><caseID
      xsi:type="xsd:string">921521</caseID><audience
      xsi:type="xsd:string">external</audience><orderNotesAscending
      xsi:type="xsd:boolean">true</orderNotesAscending><detailsOnly
      xsi:type="xsd:boolean">true</detailsOnly></cdr></CaseDetails></soap:B
      ody></soap:Envelope>

      -----SoapResponse at 8/21/2006 4:28:12 PM
      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <soap:Body>
      <soap:Fault>
      <faultcode>soap:Server</faultcode>
      <faultstring>Server was unable to process request. -->
      Object reference not set to an instance of an object.</faultstring>
      <detail />
      </soap:Fault>
      </soap:Body>
      </soap:Envelope>


      Here is the SOAP Request from the .Net client:

      -----SoapRequest at 8/21/2006 4:30:08 PM
      <?xml version="1.0" encoding="utf-8"?><soap:Envelope
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:tns="http://tmnclarifywebclient.gcintranet.net/WS/"
      xmlns:types="http://tmnclarifywebclient.gcintranet.net/WS/encodedType
      s" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Header><tns:AuthHe
      aderCS id="h_id1"><Username
      xsi:type="xsd:string">USER</Username><Password
      xsi:type="xsd:string">PSWD</Password></tns:AuthHeaderCS></soap:Header
      ><soap:Body
      soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><tns:C
      aseDetails><cdr
      href="#id1" /></tns:CaseDetails><tns:CaseDetailsRequest id="id1"
      xsi:type="tns:CaseDetailsRequest"><caseID
      xsi:type="xsd:string">921521</caseID><audience
      xsi:type="xsd:string">external</audience><orderNotesAscending
      xsi:type="xsd:boolean">true</orderNotesAscending><detailsOnly
      xsi:type="xsd:boolean">true</detailsOnly></tns:CaseDetailsRequest></s
      oap:Body></soap:Envelope>


      As you will note, the request is formulated quite differently. Not
      only do I not understand why the requests are so different, I have
      no idea how to formulate a similar request through SOAP::Lite, or
      whether it's proper to even do so.

      Moreover, for your reference, here's the meat of the Perl code
      making the SOAP::Lite call:

      my($proxy, $uri) = (shift, shift);
      my $soap = SOAP::Lite->proxy($proxy)->on_fault(sub{});
      $soap->uri($uri) if $uri;

      my $soap_header = SOAP::Header->attr({"xmlns" => $uri})->name
      ("AuthHeaderCS" =>
      \SOAP::Data->value(SOAP::Data->name("Username" => "USER"),
      SOAP::Data->name("Password" => "PSWD")));

      $soap->on_action(sub {join '', @_});

      my $res = $soap->CaseDetails($soap_header,
      SOAP::Data->name("cdr" =>
      \SOAP::Data->value(
      SOAP::Data->type("string")->name("caseID"
      => "921521"),
      SOAP::Data->type("string")->name("audience"
      => "external"),
      SOAP::Data->type("boolean")->name
      ("orderNotesAscending" => false),
      SOAP::Data->name("detailsOnly" => "false")
      )
      )
      );

      If necessary, I can post the section of C# code from web service
      itself.

      I would appreciate any suggestions on how to resolve this problem.

      Thanks!