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

Map is failing

Expand Messages
  • Stephen Nelson
    Hello all... Just a few hours ago, I wrote a script for a demo that sent a hash to an Apache SOAP server. Worked like a charm for a bit. Then I was working in
    Message 1 of 2 , Feb 7, 2001
    • 0 Attachment
      Hello all...

      Just a few hours ago, I wrote a script for a demo that sent a hash to an
      Apache SOAP server. Worked like a charm for a bit. Then I was working in an
      (I thought) unrelated area of the script, and something changed.

      Previously, I was using the automatic conversion to the Map datatype from a
      HASH, and it worked very well. Now, for some reason, SOAP::Lite doesn't
      recognize my anonymous hashes, and is converting them to the generic
      SOAPStruct.

      My code is below.

      Could someone tell me what is going on? I'm losing my mind.

      <CODE>
      use strict;

      use SOAP::Lite;
      use Data::Dumper;

      my $mediaref = bless {
      metadata => { 'foo' => 'bar' },
      URL => 'http://www.metanet.com/metadocs/images/amLogo.gif',
      } => 'mediaref';

      my $process_request = bless {
      agent => 'test agent',
      ID => "Test $$",
      host => $ENV{'HOSTNAME'},
      mediaRefs => [ $mediaref ]
      } => 'processrequest';

      my $soap = SOAP::Lite
      -> proxy('http://caledonite.metanet.com:8070/soap/servlet/rpcrouter')
      -> maptype({processrequest => 'urn:jaiprocessor',
      mediaref => 'urn:jaiprocessor',
      })
      -> uri('urn:jaiprocessor');

      my $a = $soap->identify($process_request)->result;

      print STDOUT Dumper($a);
      </CODE>
    • Paul Kulchenko
      Hi, Stephen! ... the ... Just because there is nothing wrong with your hashes. SOAP::Lite will encode hash as Map ONLY if you specify it explicitely (with
      Message 2 of 2 , Feb 7, 2001
      • 0 Attachment
        Hi, Stephen!

        > HASH, and it worked very well. Now, for some reason, SOAP::Lite
        > doesn't recognize my anonymous hashes, and is converting them to
        the
        > generic SOAPStruct.

        Just because there is nothing wrong with your hashes. SOAP::Lite will
        encode hash as Map ONLY if you specify it explicitely (with
        SOAP::Data->type(map => $hash)) OR if hash has keys that couldn't be
        serialized properly (doesn't match regexp:
        /^(?![xX][mM][lL])[a-zA-Z_][\w.\-]*$/). In other cases it'll be usual
        hash serialization. In your case all keys are quite serializible, so
        either specify using 'map' type explicitely or trust SOAP::Lite and
        it'll use 'map' type when you'll have "wrong" keys. Hope it explains
        it.

        Best wishes, Paul.

        --- Stephen Nelson <stephen@...> wrote:
        > Hello all...
        >
        > Just a few hours ago, I wrote a script for a demo that sent a hash
        > to an
        > Apache SOAP server. Worked like a charm for a bit. Then I was
        > working in an
        > (I thought) unrelated area of the script, and something changed.
        >
        > Previously, I was using the automatic conversion to the Map
        > datatype from a
        > HASH, and it worked very well. Now, for some reason, SOAP::Lite
        > doesn't
        > recognize my anonymous hashes, and is converting them to the
        > generic
        > SOAPStruct.
        >
        > My code is below.
        >
        > Could someone tell me what is going on? I'm losing my mind.
        >
        > <CODE>
        > use strict;
        >
        > use SOAP::Lite;
        > use Data::Dumper;
        >
        > my $mediaref = bless {
        > metadata => { 'foo' => 'bar' },
        > URL => 'http://www.metanet.com/metadocs/images/amLogo.gif',
        > } => 'mediaref';
        >
        > my $process_request = bless {
        > agent => 'test agent',
        > ID => "Test $$",
        > host => $ENV{'HOSTNAME'},
        > mediaRefs => [ $mediaref ]
        > } => 'processrequest';
        >
        > my $soap = SOAP::Lite
        > ->
        > proxy('http://caledonite.metanet.com:8070/soap/servlet/rpcrouter')
        > -> maptype({processrequest => 'urn:jaiprocessor',
        > mediaref => 'urn:jaiprocessor',
        > })
        > -> uri('urn:jaiprocessor');
        >
        > my $a = $soap->identify($process_request)->result;
        >
        > print STDOUT Dumper($a);
        > </CODE>
        >
        >
        >
        > ------------------------ Yahoo! Groups Sponsor
        >
        > To unsubscribe from this group, send an email to:
        > soaplite-unsubscribe@yahoogroups.com
        >
        >
        >


        __________________________________________________
        Do You Yahoo!?
        Yahoo! Auctions - Buy the things you want at great prices.
        http://auctions.yahoo.com/
      Your message has been successfully submitted and would be delivered to recipients shortly.