fritz1968j
Programmer
Hello,
I am having trouble extracting data from my SOAP::Lite program. I can connect to the WSDL just fine. It even returns data. My problem is trying to put said data into a variable.
Here is my code:-------------------------------------------------------------------
#! /usr/bin/perl
use SOAP::Lite +trace => 'debug';
use Data:umper;
# .NET web services expect / as a separator
# for uri and method.
my $lite = SOAP::Lite->new()->on_action(sub { join '/', @_ } )
->proxy(' ->readable(1);
$response = $lite->call(
SOAP:ata->name('fetchAndLock')
->attr({ 'xmlns', ' }),
SOAP:ata->name("first")->value(3),
SOAP:ata->name("max")->value(1),
SOAP:ata->name("provider")->value('homeFolderWin'),
SOAP:ata->name("action")->value('bestMatch'),
SOAP:ata->name("state")->value('PLACED')
);
my $tmp_data = $response->valueof('[1]');
print Dumper($param);
my $lts=$tmp_data->dataof('//fetchAndLockResponse/request/lockedTimes');
and here is what is returned on my command prompt (note that I cleaned up the response a bit to make it more readable: -------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:xsi=" xmlns:S
OAP-ENC=" xmlns:SOAP-ENV="as.xmlsoap.org/soap/envelope/" xmlns:xsd=" SOAP
-ENV:encodingStyle=">
<SOAP-ENV:Body
>
<fetchAndLock xmlns=" >
<first xsi:type="xsd:int"
>3</first>
<max xsi:type="xsd:int"
>1</max>
<provider xsi:type="xsd:string"
>homeFolderWin</provider>
<action xsi:type="xsd:string"
>bestMatch</action>
<state xsi:type="xsd:string"
>PLACED</state></fetchAndLock></SOAP-ENV:Body></SOAP-ENV:Envelope>
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
Connection: close
Date: Tue, 14 Aug 2012 12:31:38 GMT
Server: IBM_HTTP_Server
Content-Language: en-US
Content-Type: text/xml; charset=UTF-8
Client-Date: Tue, 14 Aug 2012 12:31:38 GMT
Client-Peer: 169.81.175.20:80
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
<soap:Envelope xmlns:soap="
Can't call method "dataof" on unblessed reference at test.pl line 28.
--------------------------------------------------------------------------------------
why cannot I extract the locked times from using the dataof part? Any help would be greatly appreciated.
Frank
I am having trouble extracting data from my SOAP::Lite program. I can connect to the WSDL just fine. It even returns data. My problem is trying to put said data into a variable.
Here is my code:-------------------------------------------------------------------
#! /usr/bin/perl
use SOAP::Lite +trace => 'debug';
use Data:umper;
# .NET web services expect / as a separator
# for uri and method.
my $lite = SOAP::Lite->new()->on_action(sub { join '/', @_ } )
->proxy(' ->readable(1);
$response = $lite->call(
SOAP:ata->name('fetchAndLock')
->attr({ 'xmlns', ' }),
SOAP:ata->name("first")->value(3),
SOAP:ata->name("max")->value(1),
SOAP:ata->name("provider")->value('homeFolderWin'),
SOAP:ata->name("action")->value('bestMatch'),
SOAP:ata->name("state")->value('PLACED')
);
my $tmp_data = $response->valueof('[1]');
print Dumper($param);
my $lts=$tmp_data->dataof('//fetchAndLockResponse/request/lockedTimes');
and here is what is returned on my command prompt (note that I cleaned up the response a bit to make it more readable: -------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:xsi=" xmlns:S
OAP-ENC=" xmlns:SOAP-ENV="as.xmlsoap.org/soap/envelope/" xmlns:xsd=" SOAP
-ENV:encodingStyle=">
<SOAP-ENV:Body
>
<fetchAndLock xmlns=" >
<first xsi:type="xsd:int"
>3</first>
<max xsi:type="xsd:int"
>1</max>
<provider xsi:type="xsd:string"
>homeFolderWin</provider>
<action xsi:type="xsd:string"
>bestMatch</action>
<state xsi:type="xsd:string"
>PLACED</state></fetchAndLock></SOAP-ENV:Body></SOAP-ENV:Envelope>
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
Connection: close
Date: Tue, 14 Aug 2012 12:31:38 GMT
Server: IBM_HTTP_Server
Content-Language: en-US
Content-Type: text/xml; charset=UTF-8
Client-Date: Tue, 14 Aug 2012 12:31:38 GMT
Client-Peer: 169.81.175.20:80
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
<soap:Envelope xmlns:soap="
<soap:Body>
</soap:Envelope><fetchAndLockResponse xmlns="
</soap:Body><request>
</fetchAndLockResponse><id>210</id>
<client>TESTING</client>
<externalId>homefoldertest1241</externalId>
<externalParentId>TODO</externalParentId>
<provider>homeFolderWin</provider>
<action>bestMatch</action>
<priority>1</priority>
<actionTime>2012-07-13T16:20:34.993Z</actionTime>
<state>PLACED</state>
<result>NONE</result>
<locked>true</locked>
<lockedTimes>43</lockedTimes>
<arguments>
<arguments>
</request><client>TESTING</client>
<externalId>homefoldertest1241</externalId>
<externalParentId>TODO</externalParentId>
<provider>homeFolderWin</provider>
<action>bestMatch</action>
<priority>1</priority>
<actionTime>2012-07-13T16:20:34.993Z</actionTime>
<state>PLACED</state>
<result>NONE</result>
<locked>true</locked>
<lockedTimes>43</lockedTimes>
<arguments>
<name>sid</name>
<valueString>F030624</valueString>
</arguments><valueString>F030624</valueString>
<arguments>
<name>domain</name>
<valueString>NAEAST</valueString>
</arguments><valueString>NAEAST</valueString>
Can't call method "dataof" on unblessed reference at test.pl line 28.
--------------------------------------------------------------------------------------
why cannot I extract the locked times from using the dataof part? Any help would be greatly appreciated.
Frank