Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Parse Results of SOAP response

by lefty29er (Novice)
on Dec 14, 2011 at 21:20 UTC ( #943618=perlquestion: print w/ replies, xml ) Need Help??
lefty29er has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I'm trying to place the results of a SOAP::Lite SQL query into a variable and can't seem to find the right way to accomplish this. Here is the code I'm using to query the DB:
#!/usr/bin/perl use warnings; use SOAP::Lite + trace => 'all'; use Data::Dumper; use XML::Simple; $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; my $DEBUG = 1; my $cucmip = ''; my $axl_port = '8443'; my $axltoolkit = "AXLAPI.wsdl"; my $user = 'PerlAXL'; my $password = 'password'; my $error_text; Begin { sub SOAP::Transport::HTTP::Client::get_basic_credentials { return ($user => $password) }; } my $cm = new SOAP::Lite encodingStyle=>'', uri => "$axltoolkit", proxy => "https://$cucmip:$axl_port/axl/" ; my $axl_sql = "select pkid from numplan where dnorpattern = \"5000\""; my $data = SOAP::Data->name("sql" => $axl_sql); my $res = $cm->executeSQLQuery($data); unless ($res->fault) { $Data::Dumper::Indent = 3; print Dumper($res->paramsall()); } else { print join ', ', $res->faultcode, $res->faultstring; }
From that query the reply is:
$VAR1 = { 'row' => { 'pkid' => 'db1835bc-9567-24e9-be1f-aaffc38c2490' } };
I'm after the pkid in the response but can't seem to get it by itself. I've been trying to use XML::Simple for this but can't get it to work. Any help in returning the pkid to a variable would be much appreciated. Thanks

Comment on Parse Results of SOAP response
Select or Download Code
Replies are listed 'Best First'.
Re: Parse Results of SOAP response
by Anonymous Monk on Dec 14, 2011 at 23:16 UTC
      Wow, it works like a charm. Thanks very much. Hoping to move past noob stage here sometime soon.....
        "We are all students in the Dojo".

        I have found that I never get out of the 'Noob' stage, I'm just a noob at something different. (Currently it's Moose and pack/unpack)

        I Go Back to Sleep, Now.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://943618]
Approved by marto
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2015-08-04 03:48 GMT
Find Nodes?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...

    Results (59 votes), past polls