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

4802SOAP::Lite 0.65beta6 & deserializing multiRefs

Expand Messages
  • Andy
    Jul 20, 2005
    • 0 Attachment

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

      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' ),

      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?

    • Show all 2 messages in this topic