The Artima Developer Community
Sponsored Link

Perl Buzz Forum
Deserializing Java Vectors with SOAP::Lite

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Chris Winters

Posts: 931
Nickname: cwinters
Registered: Jul, 2003

Daytime: Java hacker; nighttime: Perl hacker; sleeptime: some of both.
Deserializing Java Vectors with SOAP::Lite Posted: Sep 28, 2004 1:08 PM
Reply to this message Reply

This post originated from an RSS feed registered with Perl Buzz by Chris Winters.
Original Post: Deserializing Java Vectors with SOAP::Lite
Feed Title: cwinters.com
Feed URL: http://www.cwinters.com/raw/cwinters_perl.rdf
Feed Description: Chris Winters on Perl, programming and technology
Latest Perl Buzz Posts
Latest Perl Buzz Posts by Chris Winters
Latest Posts From cwinters.com

Advertisement

I'm seriously using SOAP for the first time and came to a stumbling block. I'm testing a SOAP interface with SOAP::Lite since it's is supposed to be available from different environments/languages. But one of the methods I'm calling has the signature:

    public Vector fetchAllThingies()...

It's really just an array so it should be a piece of cake, right? Nope. SOAP::Lite doesn't seem to support multiple return values, or a single return value representing multiple objects. Everything seems to work, but if you ask for the result you only get the last item.

After floundering for a bit I found a soaplite mailing list post from Paul that basically said, "Yeah, we don't do that, but here's another way." Using that you should be able to get into a Vector of simple hashtables (probably Objects too, haven't tested yet) with this not-necessarily-definitive fix:

my $result = SOAP::Lite->new()
    ->uri( 'urn:SomeThingies' )
    ->proxy( 'http://somehost/SOAP' )
    ->fetchAllThingies();
   
# '//return/item' is an XPath expression...
my @thingies = $result->valueof( '//return/item' );
   
foreach my $thingy ( @thingies ) {
    # $thingy isa hashref with keys/values as you'd expect
}

We'll see what more fun awaits... but a positive benefit of being exposed to SOAP is that I'll understand how this OpenInteract2 handler works and hopefully put it in the next version.

Read: Deserializing Java Vectors with SOAP::Lite

Topic: Deserializing Java Vectors with SOAP::Lite Previous Topic   Next Topic Topic: There Is More Than One Way To Do TIMTOWTDI

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use