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

Re: [soaplite] how to serialize a hash into a Map

Expand Messages
  • Duncan Cameron
    ... return SOAP::Data- type(map = {a = 1, b = 2, c = 3}); Regards Duncan
    Message 1 of 3 , Jul 15, 2004
      At 2004-07-14, 23:40:08 Marc Logghe <marc.logghe@...> wrote:

      >Hi all,
      >My webservice package returns a hash. I could not figure out how I could say to the server to serialize it to a Map an not to a hash.
      >Suppose my package returns {a => 1, b => 2, c => 3}.
      >I would like it to be wrapped up in the envelope like:
      ><ref ...>
      > <item>
      > <key ...>a</key>
      > <value ...>1</value>
      > </item>
      > <item>
      > <key ...>b</key>
      > <value ...>2</value>
      > </item>
      > <item>
      > <key ...>c</key>
      > <value ...>3</value>
      > </item>
      ></ref>
      >
      >It is problay very obvious, but I keep on overlooking it ;-)
      >I tried with returning Soap::Serializer->as_map({a=> 1, ...}, 'ref', undef, {})
      >but the result did not really look like it :-( (guess the server tried to serialize the retrun value into an array, which looked terribly noisy in the envelope...
      >Any help/pointers appreciated.

      return SOAP::Data->type(map => {a => 1, b => 2, c => 3});


      Regards
      Duncan
    • Marc Logghe
      ... Aaaahhh, I was oh so close, but no cigar ... I did: return SOAP::Data- type(Map = {a = 1, b = 2, c = 3}); Thanks a lot !! Marc
      Message 2 of 3 , Jul 15, 2004
        > >It is problay very obvious, but I keep on overlooking it ;-)
        > >I tried with returning Soap::Serializer->as_map({a=> 1,
        > ...}, 'ref', undef, {})
        > >but the result did not really look like it :-( (guess the
        > server tried to serialize the retrun value into an array,
        > which looked terribly noisy in the envelope...
        > >Any help/pointers appreciated.
        >
        > return SOAP::Data->type(map => {a => 1, b => 2, c => 3});

        Aaaahhh, I was oh so close, but no cigar ...
        I did:
        return SOAP::Data->type(Map => {a => 1, b => 2, c => 3});

        Thanks a lot !!
        Marc
      Your message has been successfully submitted and would be delivered to recipients shortly.