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>