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

SOAP::Lite 0.65beta6 & deserializing multiRefs

Expand Messages
  • Andy
    Hello, I m hoping someone can help. I have a SOAP server that s been running happily on 0.55 and which we re now looking at upgrading so that it can support
    Message 1 of 2 , Jul 20 3:38 AM
    • 0 Attachment
      Hello,

      I'm hoping someone can help. I have a SOAP server that's been running
      happily on 0.55 and which we're now looking at upgrading so that it
      can support soap 1.2.

      I've tried running the same code with a SOAP message that worked fine
      on the old version and have hit a problem with arrays and multirefs.

      Essentially, the XML describes an array of a complex type; the complex
      type contains arrays of complex types. The XML sample I am using was
      generated by a .Net client ( I think ) so uses multirefs to handle the
      complex types and the arrays.

      Here is an extract from the XML:

      <?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="urn:VendaProducts"
      xmlns:types="urn:VendaProducts/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:CreateProduct>
      <skuElements href="#id1"/>
      </tns:CreateProduct>
      <soapenc:Array id="id1" soapenc:arrayType="tns:skuElement[1]">
      <Item href="#id2"/>
      </soapenc:Array>
      <tns:skuElement id="id2" xsi:type="tns:skuElement">
      <sku xsi:type="xsd:string">test1</sku>
      <priceElements href="#id3"/>
      <mediaElements href="#id5"/>
      </tns:skuElement>
      <soapenc:Array id="id3" soapenc:arrayType="tns:priceElement[1]">
      <Item href="#id4"/>
      </soapenc:Array>
      <soapenc:Array id="id5" soapenc:arrayType="tns:mediaElement[1]">
      <Item href="#id6"/>
      </soapenc:Array>
      <tns:priceElement id="id4" xsi:type="tns:priceElement">
      <sell xsi:type="xsd:double">0004999</sell>
      <cost xsi:type="xsd:double">000133080</cost>
      </tns:priceElement>
      <tns:mediaElement id="id6" xsi:type="tns:mediaElement">
      <name xsi:type="xsd:string">picture.jpg</name>
      <key xsi:type="xsd:string">thumb</key>
      </tns:mediaElement>
      </soap:Body>
      </soap:Envelope>

      This should deserialize to an array with a single skuElement. This
      skuElement should contain an array with a single priceElement and an
      array with a single mediaElement.

      What I actually see on the server side (using Data::Dumper) is:

      $VAR1 = [
      bless( {
      'sku' => 'test1',
      'priceElements' => [
      bless( {
      'cost' => '000133080',
      'sell' => '0004999'
      }, 'priceElement' )
      ],
      'mediaElements' => [
      bless( {
      'name' => 'picture.jpg',
      'key' => 'thumb'
      }, 'mediaElement' )
      ],
      }, 'skuElement' ),
      $VAR1->[0]{'priceElements'},
      $VAR1->[0]{'mediaElements'}
      ];


      The code getting this is:

      sub CreateProduct
      {
      my $self = shift;
      my $envelope = pop(@_);

      my $root = $envelope->dataof("/Envelope/Body/CreateProduct/skuElements");
      my $products = $root->value;
      print Dumper($products);
      }

      As I say, this worked fine using version 0.55 of SOAP::Lite and gave
      the data structure as expected.

      I also tried hand-editing the XML so that the priceElements and
      mediaElements arrays (and their elements) are embedded directly in the
      skuElement object. This worked fine and gave a data-structure as expected.

      Any ideas?

      Andy
    • Andy
      ... Hi, Did anyone have any ideas if I m doing anything wrong here? Thanks Andy
      Message 2 of 2 , Aug 8, 2005
      • 0 Attachment
        --- In soaplite@yahoogroups.com, "Andy" <andy@v...> wrote:
        > Hello,
        >
        > I'm hoping someone can help. I have a SOAP server that's been running
        > happily on 0.55 and which we're now looking at upgrading so that it
        > can support soap 1.2.
        >
        > I've tried running the same code with a SOAP message that worked fine
        > on the old version and have hit a problem with arrays and multirefs.

        Hi,

        Did anyone have any ideas if I'm doing anything wrong here?

        Thanks

        Andy
      Your message has been successfully submitted and would be delivered to recipients shortly.