SOAP

K

KevinO

Hi

I "inherited" a program which contains this line:
$a = $soap->call( $retrieveXmlList => @params )->result ;

I added:
print "$a\n" ;

Which produced:
HASH(0x50c5d4)

How do I proceed from here to see and parse the XML tree/data?

Thanks
KO
 
M

Matija Papec

KevinO said:
Hi

I "inherited" a program which contains this line:
$a = $soap->call( $retrieveXmlList => @params )->result ;

I added:
print "$a\n" ;

Which produced:
HASH(0x50c5d4)

How do I proceed from here to see and parse the XML tree/data?

Most probably you don't need to parse anything, as $a already contain
final result from soap call.

use Data::Dumper;
print Dumper $a
 
K

KevinO

Most probably you don't need to parse anything, as $a already contain
final result from soap call.

use Data::Dumper;
print Dumper $a

Matija

Thanks for the quick response.
However, it seems that the Dumper returns only the last item in the
list.
It is very likely my ignorance in the subject.
So, if I may push it a bit...
1. How do I get everything from Dumper?
2. How would I use an XML parser here?

Many Thanks
KO
 
N

nolo contendere

Matija

Thanks for the quick response.
However, it seems that the Dumper returns only the last item in the
list.

Why do you jump to this conclusion rather than guess that the thing
that Dumper is trying to dump only has the last item?
 
K

KevinO

Why do you jump to this conclusion rather than guess that the thing
that Dumper is trying to dump only has the last item?

I don't know Perl well enough and Dumper in particular. That leaves
me with only one option - make assumptions and respectfully ask for
help.

KO
 
R

RedGrittyBrick

KevinO said:
I don't know Perl well enough and Dumper in particular. That leaves
me with only one option - make assumptions and respectfully ask for
help.

Your problem may be not with Dumper but with the way you are using
SOAP::Lite - try this:

my $response = $soap->call($retrieveXmlList => @params);

my @results = $response->result; # 1st returned value
print "\n1.\n", Dumper(@results);

@results = $response->paramsout; # 2nd ... returned values
print "\n2.\n", Dumper(@results)

@results = $reponse->paramsall; # 1st, 2nd ... returned values
print "\n3.\n", Dumper(@results);
 
K

KevinO

Your problem may be not with Dumper but with the way you are using
SOAP::Lite - try this:

my $response = $soap->call($retrieveXmlList => @params);

my @results = $response->result; # 1st returned value
print "\n1.\n", Dumper(@results);

@results = $response->paramsout; # 2nd ... returned values
print "\n2.\n", Dumper(@results)

@results = $reponse->paramsall; # 1st, 2nd ... returned values
print "\n3.\n", Dumper(@results);

RGB

First - THANKS.

(1.) returns the last item in the list.
(2.) returns nothing, no error message.
(3.) returns nothing + this error message: "Can't call method
"paramsall" on an undefined value at retrieveXmlList.pl line 38."

KO
 
R

RedGrittyBrick

KevinO said:
First - THANKS.

(1.) returns the last item in the list.
(2.) returns nothing, no error message.
(3.) returns nothing + this error message: "Can't call method
"paramsall" on an undefined value at retrieveXmlList.pl line 38."

Hmm, I think there is something wrong with your server, not with your
client.

Change the client so that where you define your "$soap" you make a
change like

from
use SOAP::Lite +autodispatch =>
uri => 'http://www.jmac.org/ISBN',
proxy => 'http://www.jmac.org/projects/bookdb/isbn/lookup.pl';
to
use SOAP::Lite +autodispatch =>
uri => 'http://www.jmac.org/ISBN',
outputxml => 1,
proxy => 'http://www.jmac.org/projects/bookdb/isbn/lookup.pl';

In other words, use the outputxml option.

Post the XML results here (sanitized if need be) - it will show exactly
what your server is sending.
 
X

xhoster

KevinO said:
RGB

First - THANKS.

(1.) returns the last item in the list.

How do you know it is the last item, rather than the *only* item,
in the list? The first step to debugging is the verify that there
is a bug. Maybe the error is in your expectations. Can you come up with
any example code which proves that there is more than one item to be found?

Xho

--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
474,209
Messages
2,571,088
Members
47,686
Latest member
scamivo

Latest Threads

Top