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

1017Re: Problem serializing Map to Java Server

Expand Messages
  • eat_lemon@yahoo.ca
    Nov 20, 2001
    • 0 Attachment
      Hi Paul,

      Sorry if you are seeing triples of this message, but when I click
      reply, I forgot to change the "To" field to this group.

      > Right now you can create type 'HashMap' for example and write custom
      > serializer that will serialize it as 'map' on wire. Let me know if
      > you'd like to go this way and need help in writing as_HashMap
      > method.

      Thanks a lot for your help. I would like to try writing as_HashMap.
      However, I haven't tried to write any as_methods before. Can you
      please tell me what I need to do?

      I know I'll need to add the following:

      sub SOAP::Serializer::as_HashMap {
      my $self = shift;
      my($value, $name, $type, $attr) = @_;
      ...
      }

      I don't know what to put in "..." though. Is there anything else
      I'll need to add?

      Your help is greatly appreciated!

      Regards,

      Simon

      --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
      > Hi, Simon!
      >
      > > Java Server side, it expects a string for the key. How can I
      > > serialize the key as a string when an interger string is given?
      > Unfortunately there is no easy way to do that. That's because key in
      > hash will always be stringified in Perl, so you can't use SOAP::Data
      > to specify type, name or any other metainfo. I will probably extend
      > map type to accept key => value pairs from arrays, so in addition
      to:
      >
      > SOAP::Data->type(map => {key => 'value'})
      >
      > you'll be able to write
      >
      > SOAP::Data->type(map => ['key' => 'value'])
      >
      > and specify any metainfo for 'key'.
      >
      > Right now you can create type 'HashMap' for example and write custom
      > serializer that will serialize it as 'map' on wire. Let me know if
      > you'd like to go this way and need help in writing as_HashMap
      method.
      >
      > Best wishes, Paul.
      >
      > --- eat_lemon@y... wrote:
      > > Consider the following code:
      > >
      > > %maps = ("123", "3");
      > > $map = SOAP::Data->type("map")
      > > ->value(\%maps);
      > >
      > > Now, this will serialize the key "123" as an integer, however, on
      > > the
      > > Java Server side, it expects a string for the key. How can I
      > > serialize the key as a string when an interger string is given?
      > >
      > > Any help is greatly appreciated!
      > >
      > > Thanks,
      > >
      > > Simon
      > >
      > >
      > >
      > > ------------------------ Yahoo! Groups Sponsor
      > >
      > > To unsubscribe from this group, send an email to:
      > > soaplite-unsubscribe@y...
      > >
      > >
      > >
      > > Your use of Yahoo! Groups is subject to
      > > http://docs.yahoo.com/info/terms/
      > >
      > >
      >
      >
      > __________________________________________________
      > Do You Yahoo!?
      > Find the one for you at Yahoo! Personals
      > http://personals.yahoo.com
    • Show all 3 messages in this topic