Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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 = '10.1.10.1'; 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
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.

        OGB

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2014-12-28 17:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (182 votes), past polls