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...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Click here for the latest updates on Groups Message search

Messages

  Messages Help
Advanced
$envelope->dataof not working   Topic List   < Prev Topic  |  Next Topic >
Reply < Prev Message  | 
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 1:29 am

cwoodfieldatl
Offline Offline
Send Email Send Email

< Prev Message  | 
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 © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help