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

SOAP woes..

Expand Messages
  • Michael J. Freeman
    I am having some problems getting my SOAP client to get data back from the SOAP server. I am using autodispatch and trying a call on a method that will return
    Message 1 of 5 , Feb 28, 2001
      I am having some problems getting my SOAP client to get data back from the
      SOAP server. I am using autodispatch and trying a call on a method that
      will return a hash to me, and the hash that is coming back seems to be
      useless, it looks like this: SOAPStruct=HASH(0x866387c) and doesn't have
      the right information in it.

      All the module on the SOAP server that I am dispatching to is doing is
      returning a reference to a hash,

      sub retrieve_results {
      my($self)=@_;

      return \%hash;
      }

      and on the client side I am trying to do:

      my $new_results = $poe->SOAP::retrieve_results;

      my %results = %$new_results;

      foreach my $key (keys %results) {
      print "KEY: $key MOO: $results{$key}\n";
      }

      That prints out : KEY: SOAPStruct=HASH(0x866387c) MOO:

      I get the data back from the hash fine if I am not using SOAP.


      I'm lost here, any advice?


      thanks,
      MikeF
    • Paul Kulchenko
      Hi, Michael! Difficult to say, because there is no full information, but I don t see something wrong in your code. You may try little bit more simple example
      Message 2 of 5 , Feb 28, 2001
        Hi, Michael!

        Difficult to say, because there is no full information, but I don't
        see something wrong in your code. You may try little bit more simple
        example with echo service:

        use SOAP::Lite +autodispatch =>
        uri => 'http://www.soaplite.com/My/Parameters',
        proxy => 'http://localhost/cgi-bin/soap.cgi',
        ;

        use My::Parameters;

        $hash = My::Parameters->SOAP::echo({a => 10, b => 11});

        print $hash->{b};

        It uses the same logic as your example as far as I understand, sends
        hash and gets it back. Prints 11. Hope it helps and send me more
        information if you still have a problem, I'll try to reproduce it in
        my environment.

        Best wishes, Paul.

        --- "Michael J. Freeman" <mfreeman@...> wrote:
        >
        > I am having some problems getting my SOAP client to get data back
        > from the
        > SOAP server. I am using autodispatch and trying a call on a method
        > that
        > will return a hash to me, and the hash that is coming back seems to
        > be
        > useless, it looks like this: SOAPStruct=HASH(0x866387c) and doesn't
        > have
        > the right information in it.
        >
        > All the module on the SOAP server that I am dispatching to is doing
        > is
        > returning a reference to a hash,
        >
        > sub retrieve_results {
        > my($self)=@_;
        >
        > return \%hash;
        > }
        >
        > and on the client side I am trying to do:
        >
        > my $new_results = $poe->SOAP::retrieve_results;
        >
        > my %results = %$new_results;
        >
        > foreach my $key (keys %results) {
        > print "KEY: $key MOO: $results{$key}\n";
        > }
        >
        > That prints out : KEY: SOAPStruct=HASH(0x866387c) MOO:
        >
        > I get the data back from the hash fine if I am not using SOAP.
        >
        >
        > I'm lost here, any advice?
        >
        >
        > thanks,
        > MikeF
        >
        >
        > ------------------------ Yahoo! Groups Sponsor
        >
        > To unsubscribe from this group, send an email to:
        > soaplite-unsubscribe@yahoogroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to
        > http://docs.yahoo.com/info/terms/
        >
        >


        __________________________________________________
        Do You Yahoo!?
        Get email at your own domain with Yahoo! Mail.
        http://personal.mail.yahoo.com/
      • Michael J. Freeman
        Let me see if I can explain this better, I ll paste more code: use SOAP::Lite + autodispatch = uri = http://localhost/EG/POE , proxy =
        Message 3 of 5 , Feb 28, 2001
          Let me see if I can explain this better, I'll paste more code:

          use SOAP::Lite + autodispatch =>
          uri => 'http://localhost/EG/POE',
          proxy => 'http://localhost/cgi-bin/soap.cgi',
          #proxy => 'http://localhost/soap', # modperl (broken ATM)
          on_fault=> sub { my($soap,$res)= @_;
          die ref $res ? $res->faultdetail : $soap->transport->status,
          "\n";
          }
          ;

          my $poe = new EG::POE;
          $poe->SOAP::start_poe_session(@site_urls);

          my $new_results = $poe->SOAP::retrieve_results;

          my %results = %$new_results;

          foreach my $key (keys %results) {
          print "key => $results{$key}\n";
          }

          and on the SOAP server inside EG::POE is this:

          sub retrieve_results {
          my($class)=@_;

          return \%hash;
          }

          There is already data in %hash, it is a global. So the SOAP client
          should print out all the key => value pairs, when I call it from a
          non-soap client, a test perl script, and call those same functions, I get
          the hash back and am able to traverse it fine. Its when I try to pass the
          hash reference back through soap, and then dereference it, I am having the
          problem. I read that SOAP::Lite has a hard time with hash references.
          Also, the values of the keys in the hash I am trying to return contain
          more references to objects, will I get these back in tack on my SOAP::Lite
          client CGI?


          On Wed, 28 Feb 2001, Paul Kulchenko wrote:

          > Hi, Michael!
          >
          > Difficult to say, because there is no full information, but I don't
          > see something wrong in your code. You may try little bit more simple
          > example with echo service:
          >
          > use SOAP::Lite +autodispatch =>
          > uri => 'http://www.soaplite.com/My/Parameters',
          > proxy => 'http://localhost/cgi-bin/soap.cgi',
          > ;
          >
          > use My::Parameters;
          >
          > $hash = My::Parameters->SOAP::echo({a => 10, b => 11});
          >
          > print $hash->{b};
          >
          > It uses the same logic as your example as far as I understand, sends
          > hash and gets it back. Prints 11. Hope it helps and send me more
          > information if you still have a problem, I'll try to reproduce it in
          > my environment.
          >
          > Best wishes, Paul.
          >
          > --- "Michael J. Freeman" <mfreeman@...> wrote:
          > >
          > > I am having some problems getting my SOAP client to get data back
          > > from the
          > > SOAP server. I am using autodispatch and trying a call on a method
          > > that
          > > will return a hash to me, and the hash that is coming back seems to
          > > be
          > > useless, it looks like this: SOAPStruct=HASH(0x866387c) and doesn't
          > > have
          > > the right information in it.
          > >
          > > All the module on the SOAP server that I am dispatching to is doing
          > > is
          > > returning a reference to a hash,
          > >
          > > sub retrieve_results {
          > > my($self)=@_;
          > >
          > > return \%hash;
          > > }
          > >
          > > and on the client side I am trying to do:
          > >
          > > my $new_results = $poe->SOAP::retrieve_results;
          > >
          > > my %results = %$new_results;
          > >
          > > foreach my $key (keys %results) {
          > > print "KEY: $key MOO: $results{$key}\n";
          > > }
          > >
          > > That prints out : KEY: SOAPStruct=HASH(0x866387c) MOO:
          > >
          > > I get the data back from the hash fine if I am not using SOAP.
          > >
          > >
          > > I'm lost here, any advice?
          > >
          > >
          > > thanks,
          > > MikeF
          > >
          > >
          > > ------------------------ Yahoo! Groups Sponsor
          > >
          > > To unsubscribe from this group, send an email to:
          > > soaplite-unsubscribe@yahoogroups.com
          > >
          > >
          > >
          > > Your use of Yahoo! Groups is subject to
          > > http://docs.yahoo.com/info/terms/
          > >
          > >
          >
          >
          > __________________________________________________
          > Do You Yahoo!?
          > Get email at your own domain with Yahoo! Mail.
          > http://personal.mail.yahoo.com/
          >
          >
          > To unsubscribe from this group, send an email to:
          > soaplite-unsubscribe@yahoogroups.com
          >
          >
          >
          > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
          >
          >
        • Paul Kulchenko
          Hi, Michael! Right, but the key to the answer is here ... in commented line. If you d use mod_perl you should get proper response, but since you re using CGI
          Message 4 of 5 , Feb 28, 2001
            Hi, Michael!

            Right, but the key to the answer is here
            > proxy => 'http://localhost/cgi-bin/soap.cgi',
            > #proxy => 'http://localhost/soap', # modperl (broken ATM)
            in commented line. If you'd use mod_perl you should get proper
            response, but since you're using CGI implementation EVERY call
            invokes new instance on server side and if for

            > my $poe = new EG::POE;
            > $poe->SOAP::start_poe_session(@site_urls);

            it doesn't make any difference, since this information is inside $poe
            object itself, here:

            > my $new_results = $poe->SOAP::retrieve_results;

            it does, because you're trying to access global information which is
            just not there. It's gone. So, either change your logic on server
            side (for example move your data inside object itself) or switch to
            other server implementation that supports persistent data, like
            mod_perl, daemon or Apache::Registry.

            > hash reference back through soap, and then dereference it, I am
            > having the
            > problem. I read that SOAP::Lite has a hard time with hash
            > references.
            As for data structures, SOAP::Lite doesn't have any restrictions or
            limitations, except that it's not able to serialize some data
            structures, like tied objects, filehandles or globs, but everything
            else, any combinations of lists, hashes and scalars, blessed
            references, even circular or multireferences should be properly
            serialized. Local or my data doesn't matter as soon as serializer can
            get access to it. For other cases on_nonserialized() handler is
            available to you, so you can catch such objects and do whatever you
            want. Let me know if you still have problems with it.

            Best wishes, Paul.

            --- "Michael J. Freeman" <mfreeman@...> wrote:
            > Let me see if I can explain this better, I'll paste more code:
            >
            > use SOAP::Lite + autodispatch =>
            > uri => 'http://localhost/EG/POE',
            > proxy => 'http://localhost/cgi-bin/soap.cgi',
            > #proxy => 'http://localhost/soap', # modperl (broken ATM)
            > on_fault=> sub { my($soap,$res)= @_;
            > die ref $res ? $res->faultdetail :
            > $soap->transport->status,
            > "\n";
            > }
            > ;
            >
            > my $poe = new EG::POE;
            > $poe->SOAP::start_poe_session(@site_urls);
            >
            > my $new_results = $poe->SOAP::retrieve_results;
            >
            > my %results = %$new_results;
            >
            > foreach my $key (keys %results) {
            > print "key => $results{$key}\n";
            > }
            >
            > and on the SOAP server inside EG::POE is this:
            >
            > sub retrieve_results {
            > my($class)=@_;
            >
            > return \%hash;
            > }
            >
            > There is already data in %hash, it is a global. So the SOAP client
            > should print out all the key => value pairs, when I call it from a
            > non-soap client, a test perl script, and call those same functions,
            > I get
            > the hash back and am able to traverse it fine. Its when I try to
            > pass the
            > hash reference back through soap, and then dereference it, I am
            > having the
            > problem. I read that SOAP::Lite has a hard time with hash
            > references.
            > Also, the values of the keys in the hash I am trying to return
            > contain
            > more references to objects, will I get these back in tack on my
            > SOAP::Lite
            > client CGI?
            >
            >
            > On Wed, 28 Feb 2001, Paul Kulchenko wrote:
            >
            > > Hi, Michael!
            > >
            > > Difficult to say, because there is no full information, but I
            > don't
            > > see something wrong in your code. You may try little bit more
            > simple
            > > example with echo service:
            > >
            > > use SOAP::Lite +autodispatch =>
            > > uri => 'http://www.soaplite.com/My/Parameters',
            > > proxy => 'http://localhost/cgi-bin/soap.cgi',
            > > ;
            > >
            > > use My::Parameters;
            > >
            > > $hash = My::Parameters->SOAP::echo({a => 10, b => 11});
            > >
            > > print $hash->{b};
            > >
            > > It uses the same logic as your example as far as I understand,
            > sends
            > > hash and gets it back. Prints 11. Hope it helps and send me more
            > > information if you still have a problem, I'll try to reproduce it
            > in
            > > my environment.
            > >
            > > Best wishes, Paul.
            > >
            > > --- "Michael J. Freeman" <mfreeman@...> wrote:
            > > >
            > > > I am having some problems getting my SOAP client to get data
            > back
            > > > from the
            > > > SOAP server. I am using autodispatch and trying a call on a
            > method
            > > > that
            > > > will return a hash to me, and the hash that is coming back
            > seems to
            > > > be
            > > > useless, it looks like this: SOAPStruct=HASH(0x866387c) and
            > doesn't
            > > > have
            > > > the right information in it.
            > > >
            > > > All the module on the SOAP server that I am dispatching to is
            > doing
            > > > is
            > > > returning a reference to a hash,
            > > >
            > > > sub retrieve_results {
            > > > my($self)=@_;
            > > >
            > > > return \%hash;
            > > > }
            > > >
            > > > and on the client side I am trying to do:
            > > >
            > > > my $new_results = $poe->SOAP::retrieve_results;
            > > >
            > > > my %results = %$new_results;
            > > >
            > > > foreach my $key (keys %results) {
            > > > print "KEY: $key MOO: $results{$key}\n";
            > > > }
            > > >
            > > > That prints out : KEY: SOAPStruct=HASH(0x866387c) MOO:
            > > >
            > > > I get the data back from the hash fine if I am not using SOAP.
            > > >
            > > >
            > > > I'm lost here, any advice?
            > > >
            > > >
            > > > thanks,
            > > > MikeF
            > > >
            > > >
            > > > ------------------------ Yahoo! Groups Sponsor
            > > >
            > > > To unsubscribe from this group, send an email to:
            > > > soaplite-unsubscribe@yahoogroups.com
            > > >
            > > >
            > > >
            > > > Your use of Yahoo! Groups is subject to
            > > > http://docs.yahoo.com/info/terms/
            > > >
            > > >
            > >
            > >
            > > __________________________________________________
            > > Do You Yahoo!?
            > > Get email at your own domain with Yahoo! Mail.
            > > http://personal.mail.yahoo.com/
            > >
            > >
            > > To unsubscribe from this group, send an email to:
            > > soaplite-unsubscribe@yahoogroups.com
            > >
            > >
            > >
            > > Your use of Yahoo! Groups is subject to
            > http://docs.yahoo.com/info/terms/
            > >
            > >
            >
            >
            > ------------------------ Yahoo! Groups Sponsor
            >
            > To unsubscribe from this group, send an email to:
            > soaplite-unsubscribe@yahoogroups.com
            >
            >
            >
            > Your use of Yahoo! Groups is subject to
            > http://docs.yahoo.com/info/terms/
            >
            >


            __________________________________________________
            Do You Yahoo!?
            Yahoo! Auctions - Buy the things you want at great prices.
            http://auctions.yahoo.com/
          • Duncan Cameron
            Michael Can you see whether the following is substantially different to your code? This code produces the expected results: C: My
            Message 5 of 5 , Feb 28, 2001
              Michael

              Can you see whether the following is substantially different to your code? This code produces the expected results:

              C:\My Documents\Perl\SOAP\Lite>perl -w poe.t
              a => 1
              b => 2
              c => 3
              a => 1
              b => 2
              c => 3

              I'm using W98, SOAP-Lite 0.47, Perl 5.005_03.

              Regards

              Duncan Cameron

              poe.t
              =====

              use SOAP::Lite + autodispatch =>
              uri => 'http://localhost/EG/POE',
              proxy => 'http://localhost/cgi-bin/soap.cgi',
              on_fault=> sub { my($soap,$res)= @_;
              die ref $res ? $res->faultdetail : $soap->transport->status, "\n";
              }
              ;

              my $poe = new EG::POE;
              @site_urls = ('http://www.ibm.com');

              $poe->SOAP::start_poe_session(@site_urls);

              my $new_results = $poe->SOAP::retrieve_results;

              my %results = %$new_results;

              foreach my $key (keys %results) {
              print "$key => $results{$key}\n";
              }
              %results = $poe->SOAP::retrieve_results2;

              foreach my $key (keys %results) {
              print "$key => $results{$key}\n";
              }

              POE.pm
              ======
              package EG::POE;

              %hash = (a => 1, b=> 2, c =>3);

              sub retrieve_results {
              my($class)=@_;

              return \%hash;
              }
              sub start_poe_session() {
              print join ' ', @_;
              }

              sub new() {
              my ($class) = @_;
              bless {}, $class;
              }

              sub retrieve_results2 {
              my($class)=@_;

              return %hash;
              }
              1;
            Your message has been successfully submitted and would be delivered to recipients shortly.