Search the web
Sign In
New User? Sign Up
soaplite · SOAP::Lite for Perl (soaplite.com)
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
$envelope->dataof not working   Message List  
Reply | Forward Message #6152 of 6387 |
Re: [soaplite] $envelope->dataof not working

Replying to myself, I figured this out in the time it took the message
to come back to my inbox. The mistake was including the "soap:..."
strings in the path of the dataof function. Replace with the following
and everything's cool:

my $user = $envelope->dataof('/Envelope/Body/purgeTest/user');

-C

On May 3, 2008, at 9:29 PM, Chris Woodfield wrote:

> Hello,
>
> I have a script that sends the following XML to a web service:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/
> ">
> <soap:Body>
> <purgeTest xmlns="http://tino.semihuman.com/PurgeTest">
> <user xsi:type="xsd:string">foo</user>
> </purgeTest>
> </soap:Body>
> </soap:Envelope>
>
> And the following code to try to pull out the <user> tag and return
> it:
>
> ----
> #!/usr/bin/perl -w
>
> use strict;
>
> use vars qw(@ISA);
> @ISA = qw(Exporter SOAP::Server::Parameters);
>
> package PurgeTest;
>
> use vars qw(@ISA);
> @ISA = qw(Exporter SOAP::Server::Parameters);
> use SOAP::Lite;
> use Data::Dumper;
>
> sub purgeTest {
> my $self = shift;
> my $envelope = pop;
>
> my $user = $envelope->dataof('/soap:Envelope/soap:Body/purgeTest/
> user');
>
> return SOAP::Data->name('user' => $user->value);
>
> }
>
> 1;
> ---
>
> The code doesn't appear to be working, however; the $user variable
> never gets a value and the return function fails with the below in the
> faultstring:
>
> Could not communicate with web service: Can't call method "value" on
> an undefined value at /usr/lib/cgi-bin/PurgeTest.pm line 21. (that's
> the "return SOAP::Data... line). If I try to print $user as a test it
> is undef.
>
> I get the impression I'm missing something simple here. Any ideas?
>
> Thanks,
>
> -Chris
>
>
>




Sun May 4, 2008 4:38 pm

cwoodfieldatl
Offline Offline
Send Email Send Email

Forward
Message #6152 of 6387 |
Expand Messages Author Sort by Date

Hello, I have a script that sends the following XML to a web service: <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope...
Chris Woodfield
cwoodfieldatl
Offline Send Email
May 4, 2008
4:31 pm

Replying to myself, I figured this out in the time it took the message to come back to my inbox. The mistake was including the "soap:..." strings in the path...
Chris Woodfield
cwoodfieldatl
Offline Send Email
May 4, 2008
4:39 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help