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

4650Re: [soaplite] Re: Question using .NET wsdl file in perl client

Expand Messages
  • Duncan Cameron
    May 5, 2005
    • 0 Attachment
      At 2005-05-05, 15:13:47 you wrote:

      >> See this prior thread about using WSDL and getting the SOM object
      >>
      >> http://groups.yahoo.com/group/soaplite/message/4445
      >>
      >> Duncan
      >
      >Hi Duncan,
      >
      >Thanks for your note. I've tested the example from that thread and it
      >works fine for validating a result or fault, but I'm still unable to
      >iterate a complex object (the .NET dataset). Here's what I have now:
      >
      >#!/usr/bin/perl -w
      >use SOAP::Lite +trace=>'debug';
      >my $obj = SOAP::Lite
      > ->
      >service('http://www.francisshanahan.com/TheHolyBible.asmx?wsdl');
      >my $books = $obj->ListBooks();
      >my $som = $obj->call;
      >unless ($som->fault) {
      > print "result: ", $som->result, ' $books: ', $books, "\n";
      > for ($books->valueof('//bible_content')) {
      > print $_->BookTitle, "\n";
      > }
      >}
      >
      >This is the output:
      >
      >result: HASH(0x85a3174) $books: HASH(0x85a3174)
      >Can't call method "valueof" on unblessed reference at ./WSDLExample.pl
      >line 9.
      >
      >The output verifies the $som->result and the original returned value
      >($books) are the same HASH ref, but trying to use $books gets the
      >unblessed error. Blessing it as a SOAP::SOM object removes the error,
      >but doesn't do anything in the for loop. Is there another step I'm
      >missing?
      >
      >Matthew
      >
      You need to access everything through the som object. In your case it
      looks like the return value from Listbooks() does not give you
      everything that you want.
      Does this work for you?

      unless ($som->fault) {
      print "result: ", $som->result, ' $books: ', $books, "\n";
      for ($som->valueof('//bible_content')) {
      print $_->BookTitle, "\n";
      }
      }

      Duncan









      ___________________________________________________________
      Yahoo! Messenger - want a free and easy way to contact your friends online? http://uk.messenger.yahoo.com
    • Show all 6 messages in this topic