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

HELP!!! - Interop problem with .NET (LONG)

Expand Messages
  • pfconrey
    I have a SOAP::Lite web service that returns essentially an array of hashrefs to a .NET client. The service works fine with a Perl client, parsing an
    Message 1 of 1 , Mar 30, 2005
    • 0 Attachment
      I have a SOAP::Lite web service that returns essentially an array of
      hashrefs to a .NET client. The service works fine with a Perl client,
      parsing an displaying the results as intended, but the .NET client
      gives me the following error:

      Cannot assign object of type System.Xml.XmlNode[] to an object of
      type Summary[].

      It appears to be a problem with the way .NET handles SOAP-encoded
      arrays (or the way I'm handling them :) ). The WSDL uses RPC
      encoding, as I have not been able to make the Perl side work when
      using Doc-Literal (I'm limited to SOAP::Lite 0.60a since 0.65 won't be
      production-ready by our release date of June 1).

      Here is the pertinent WSDL information, Perl server reply code, and
      the resulting response message. Any advise you can give me regarding
      returning complex structures to a .NET client will be helpful. I can
      also post the proxy class that's generated by .NET if that would be
      helpful:

      ~~~~~~~~~~~Begin WSDL~~~~~~~~~~~~~~~~
      ...
      <xsd:complexType name="Summary">
      <xsd:all>
      <xsd:element name="StayID" type="xsd:int"/>
      <xsd:element name="GuestID" type="xsd:int"/>
      <xsd:element name="ConfirmationNumber" type="xsd:string"/>
      <xsd:element name="CancellationNumber" type="xsd:string"/>
      <xsd:element name="LastName" type="xsd:string"/>
      <xsd:element name="FirstName" type="xsd:string"/>
      <xsd:element name="BrandCode" type="xsd:string" />
      <xsd:element name="PropertyCode" type="xsd:string"/>
      <xsd:element name="ArrivalDate" type="xsd:date"/>
      <xsd:element name="DepartDate" type="xsd:date"/>
      </xsd:all>
      </xsd:complexType>

      <xsd:complexType name="ArrayOfSummary">
      <xsd:complexContent>
      <xsd:restriction base="enc:Array">
      <xsd:attribute ref="enc:arrayType"
      wsdl:arrayType="tns:Summary[]"/>
      </xsd:restriction>
      </xsd:complexContent>
      </xsd:complexType>

      ...

      <message name="SearchByConfirmationRequest">
      <part name="ConfirmationNumber" type="xsd:string"/>
      </message>

      <message name="SearchResponse">
      <part name="StayList" type="tns:ArrayOfSummary"/>
      </message>

      ...
      <portType name="StayPortType">
      <operation name="SearchByConfirmationNumber">
      <input message="tns:SearchByConfirmationRequest"/>
      <output message="tns:SearchResponse"/>
      </operation>
      </portType>

      <binding name="StayBinding" type="tns:StayPortType">
      <soap:binding style="rpc"
      transport="http://schemas.xmlsoap.org/soap/http"/>

      <operation name="SearchByConfirmationNumber">
      <soap:operation
      soapAction="http://crm.hilton.com/gpm/ws/Stay#SearchByConfirmationNumber"
      />
      <input><soap:body use="encoded"
      namespace="http://crm.hilton.com/gpm/ws/Stay"
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
      <output><soap:body use="encoded"
      namespace="http://crm.hilton.com/gpm/ws/Stay"
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
      </operation>
      </binding>

      ~~~~~~~~~~~End WSDL~~~~~~~~~~~~~~~~

      ~~~~~~~~~~~Begin Perl Response ~~~~
      foreach my $stay ( @{$stays->{pend}}, @{$stays->{act}} )
      {
      @summary = (
      SOAP::Data->name("StayID")->type("int")->value($stay->i_stay_id()),

      SOAP::Data->name("GuestID")->type("int")->value($stay->i_gst_id()),

      SOAP::Data->name("ConfirmationNumber")->type("string")->value($stay->s_conf_num()),

      SOAP::Data->name("CancellationNumber")->type("string")->value($stay->s_cxl_num()),

      SOAP::Data->name("LastName")->type("string")->value($stay->s_last_name()),

      SOAP::Data->name("FirstName")->type("string")->value($stay->s_first_name()),

      SOAP::Data->name("BrandCode")->type("string")->value($stay->s_brand_cd()),

      SOAP::Data->name("PropertyCode")->type("string")->value($stay->s_prop_cd()),

      SOAP::Data->name("ArrivalDate")->type("date")->value($stay->d_arrival_date()),

      SOAP::Data->name("DepartDate")->type("date")->value($stay->d_depart_date())
      );

      push( @$list,
      SOAP::Data->name("Summary")->value(\SOAP::Data->value(@summary)) );
      }

      #return SOAP::Data->name( "StayList" )->value(
      \SOAP::Data->value(@$list) );
      return SOAP::Data->value( @$list );

      ~~~~~~~~~~~ End Perl Response ~~~~~~

      ~~~~~~~~~~~ Begin SOAP ~~~~~~~~~~~~~
      <?xml version="1.0" encoding="utf-16"?>
      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:tns="http://crm.hilton.com/gpm/ws/Stay"
      xmlns:types="http://crm.hilton.com/gpm/ws/Stay/encodedTypes"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <soap:Body
      soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <tns:SearchByConfirmationNumber>
      <ConfirmationNumber
      xsi:type="xsd:string">123456789</ConfirmationNumber>
      </tns:SearchByConfirmationNumber>
      </soap:Body>
      </soap:Envelope>


      ResponseCode: 200 (OK)
      Date:Wed, 30 Mar 2005 19:56:30 GMT
      Server:Apache/1.3.31 (Unix) mod_perl/1.29
      SOAPServer:SOAP::Lite/Perl/0.600.0
      Content-Length:1064
      Connection:close
      Content-Type:text/xml; charset=utf-8

      <?xml version="1.0" encoding="utf-16"?>
      <SOAP-ENV:Envelope
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <SOAP-ENV:Body>
      <namesp2:SearchByConfirmationNumberResponse
      xmlns:namesp2="http://crm.hilton.com/gpm/ws/Stay">
      <Summary>
      <StayID xsi:type="xsd:int">54321</StayID>
      <GuestID xsi:type="xsd:int">0</GuestID>
      <ConfirmationNumber
      xsi:type="xsd:string">123456789</ConfirmationNumber>
      <CancellationNumber xsi:type="xsd:string" />
      <LastName xsi:type="xsd:string">DOE</LastName>
      <FirstName xsi:type="xsd:string">JOHN</FirstName>
      <BrandCode xsi:type="xsd:string">AB</BrandCode>
      <PropertyCode xsi:type="xsd:string">ABCDE</PropertyCode>
      <ArrivalDate xsi:type="xsd:date">01/01/2004</ArrivalDate>
      <DepartDate xsi:type="xsd:date">01/02/2004</DepartDate>
      </Summary>
      </namesp2:SearchByConfirmationNumberResponse>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>
      ~~~~~~~~~~~ End SOAP ~~~~~~~~~~~~~~~
    Your message has been successfully submitted and would be delivered to recipients shortly.