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

Serialization problem with ordered_hash

Expand Messages
  • Larry
    I m using SOAP::Lite 0.55 and Perl 5.6.1 on Red Hat Linux. I m making XML-RPC calls and I m expecting that the serialized data in the XML-RPC request should
    Message 1 of 1 , Nov 14, 2003
    • 0 Attachment
      I'm using SOAP::Lite 0.55 and Perl 5.6.1 on Red Hat Linux. I'm
      making XML-RPC calls and I'm expecting that the serialized data in
      the XML-RPC request should look basically the same when I send an
      ordered hash as it looks when I send a regular hash (other than the
      element order), but that is not what I'm seeing.

      Is that how it is supposed to work? If not, am I setting up the
      ordered_hash type in the wrong way?

      Here is my test script:
      ================================================
      #!/usr/local/bin/perl -w
      use strict;
      use XMLRPC::Lite;
      try_me( { a => 1, b => 2 } );
      try_me( SOAP::Data->type(ordered_hash => [ a => 1, b => 2 ]) );
      exit;

      sub try_me
      {
      my $data = shift;
      use Data::Dumper;
      print "="x60, "\n", Dumper($data), "\n";
      eval { XMLRPC::Lite->proxy('http://foo')
      ->on_debug(sub{warn @_})
      ->call('foo',$data); };
      }
      ================================================

      Both the hash data and the ordered_hash data look fine
      when I Data::Dump them in the try_me subroutine:

      hash (looks OK):

      $VAR1 = {
      'a' => 1,
      'b' => 2
      };

      ordered_hash (looks OK):

      $VAR1 = bless( {
      '_value' => [
      [
      'a',
      1,
      'b',
      2
      ]
      ],
      '_type' => 'ordered_hash',
      '_signature' => [],
      '_attr' => {}
      }, 'SOAP::Data' );

      ================================================

      But the request XML looks funny for the ordered_hash, plus it has
      lost the "name" parts of the pairs and only kept the values:

      hash (looks OK):

      <?xml version="1.0" encoding="UTF-8"?>
      <methodCall><methodName>foo</methodName><params><param>
      <value>
      <struct>
      <member><name>a</name><value><int>1</int></value></member>
      <member><name>b</name><value><int>2</int></value></member>
      </struct>
      </value>
      </param></params></methodCall>

      ordered_hash (looks BAD):

      <?xml version="1.0" encoding="UTF-8"?>
      <methodCall><methodName>foo</methodName><params><param>
      <c-gensym11>
      <value><int>1</int></value>
      <value><int>2</int></value>
      </c-gensym11>
      </param></params></methodCall>

      ================================================

      Any ideas?

      Thanks!
      Larry Leszczynski
    Your message has been successfully submitted and would be delivered to recipients shortly.