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
Accessing Data within XML tag (not between two tags)   Message List  
Reply | Forward Message #2633 of 6391 |
Greetings,

I am using SOAP::Lite as client on linux and connecting to a Windows SOAP
server.

I was having trouble accessing data within a tag like this:

<attribute name="LastName" value="JONES" />

I cannot access the value "JONES" for a LastName".

I am able to access data between two tags like this:

<ticket>reallylongticketnumber</ticket>

using this code:

my $result = $soap->call($method => @params);
print $result->valueof('//VerifySessionResponse/iwsResponse/sessionInfo/
ticket');

I would greatly appreciate any help. My perl code and the server's xml
response are listed below.

Thanks,

Paul Yuergens

BEGIN PERL CODE

#!/usr/bin/perl

use SOAP::Lite ( +trace => all, maptype => {} );

my $soap = SOAP::Lite
-> uri('http://authenticate.university.edu/iws')
-> on_action( sub{ join '/', 'http://authenticate.university.edu/iws', $_[1]
})
-> proxy('http://authenticate.university.edu/iws');

my $header = SOAP::Header->name(wsStudentCreds => {
password => "xxxx",
id => "dept.university.edu"
})->uri('http://authenticate.university.edu/iws/')->prefix('');
my @params = (
$header,
SOAP::Data->name(ticket => $ARGV[1]),
SOAP::Data->name(userIpAddr => $ARGV[0]),
SOAP::Data->name(returnExtendedAttributes => 1)
);

my $method = SOAP::Data->name('TrueCookie')
->attr({xmlns => 'http://authenticate.university.edu/ws/'});

my $result = $soap->call($method => @params);


if ($result->fault)
{
print $result->faultstring;
}
else
{

print $result->valueof('//VerifySessionResponse/iwsResponse/sessionInfo/
ticket');
}

BEGIN XML RESPONSE

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<VerifySessionResponse xmlns="http://university.edu/ws/">
<iwsResponse action="Verify" hasErrors="false" transactionId="0">
<sessionInfo status="Active">
<userAttributes>
<attribute name="UID" value="1111111" />
<attribute name="LastName" value="JONES " />
<attribute name="FirstName" value="DAVEY " />
<attribute name="Email" value="JONES@... "
/>
<attribute name="MailCode" value="155555" />
</userAttributes>
<accounts>
<account loginId=" " type="ACF2" status="Unknown" />
<account loginId="djj" type="BobbyOnline" status="Authenticated" />
<account loginId=" " type="QDB" status="Unknown" />
<account loginId="" type="RACF" status="Unknown" />
<account loginId="1111111" type="UID" status="PasswordResetRequired"
/>
</accounts>
<ticket>reallylongticketnumber</ticket>
<univId> 1111111</univId>
</sessionInfo><errorInfo xsi:nil="true" />
</iwsResponse></VerifySessionResponse>
</soap:Body>
</soap:Envelope>





Tue May 20, 2003 1:00 am

pyuergens
Offline Offline
Send Email Send Email

Forward
Message #2633 of 6391 |
Expand Messages Author Sort by Date

Greetings, I am using SOAP::Lite as client on linux and connecting to a Windows SOAP server. I was having trouble accessing data within a tag like this: ...
pyuergens
Offline Send Email
May 20, 2003
1:15 am
Advanced

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