SOAP

Hi

I "inherited" a program which contains this line:
$a = $soap->call( $retrieveXmlList => [at] 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
KevinO [ Mi, 09 April 2008 15:29 ] [ ID #1939111 ]

Re: SOAP

KevinO wrote:
> Hi
>
> I "inherited" a program which contains this line:
> $a = $soap->call( $retrieveXmlList => [at] 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
Mpapec [ Mi, 09 April 2008 15:40 ] [ ID #1939112 ]

Re: SOAP

On Apr 9, 9:40 am, Matija Papec <n... [at] yahoo.com> wrote:
> KevinO wrote:
> > Hi
>
> > I "inherited" a program which contains this line:
> > $a = $soap->call( $retrieveXmlList => [at] 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

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
KevinO [ Mi, 09 April 2008 17:03 ] [ ID #1939117 ]

Re: SOAP

On Apr 9, 11:03=A0am, KevinO <kevin... [at] yahoo.com> wrote:
> On Apr 9, 9:40 am, Matija Papec <n... [at] yahoo.com> wrote:
>
>
>
> > KevinO wrote:
> > > Hi
>
> > > I "inherited" a program which contains this line:
> > > $a =3D $soap->call( $retrieveXmlList =3D> [at] 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
>
> 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?
it_says_BALLS_on_your [ Mi, 09 April 2008 17:07 ] [ ID #1939118 ]

Re: SOAP

On Apr 9, 11:07 am, nolo contendere <simon.c... [at] fmr.com> wrote:
> On Apr 9, 11:03 am, KevinO <kevin... [at] yahoo.com> wrote:
>
>
>
> > On Apr 9, 9:40 am, Matija Papec <n... [at] yahoo.com> wrote:
>
> > > KevinO wrote:
> > > > Hi
>
> > > > I "inherited" a program which contains this line:
> > > > $a = $soap->call( $retrieveXmlList => [at] 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
>
> > 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?

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
KevinO [ Mi, 09 April 2008 17:18 ] [ ID #1939119 ]

Re: SOAP

KevinO wrote:
> On Apr 9, 11:07 am, nolo contendere <simon.c... [at] fmr.com> wrote:
>> On Apr 9, 11:03 am, KevinO <kevin... [at] yahoo.com> wrote:
>>
>>
>>
>>> On Apr 9, 9:40 am, Matija Papec <n... [at] yahoo.com> wrote:
>>>> KevinO wrote:
>>>>> Hi
>>>>> I "inherited" a program which contains this line:
>>>>> $a = $soap->call( $retrieveXmlList => [at] 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
>>> 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?
>
> 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 => [at] params);

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

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

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

--
RGB
RedGrittyBrick [ Mi, 09 April 2008 17:27 ] [ ID #1939121 ]

Re: SOAP

On Apr 9, 11:27 am, RedGrittyBrick <RedGrittyBr... [at] SpamWeary.foo>
wrote:
> KevinO wrote:
> > On Apr 9, 11:07 am, nolo contendere <simon.c... [at] fmr.com> wrote:
> >> On Apr 9, 11:03 am, KevinO <kevin... [at] yahoo.com> wrote:
>
> >>> On Apr 9, 9:40 am, Matija Papec <n... [at] yahoo.com> wrote:
> >>>> KevinO wrote:
> >>>>> Hi
> >>>>> I "inherited" a program which contains this line:
> >>>>> $a = $soap->call( $retrieveXmlList => [at] 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
> >>> 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?
>
> > 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 => [at] params);
>
> my [at] results = $response->result; # 1st returned value
> print "\n1.\n", Dumper( [at] results);
>
> [at] results = $response->paramsout; # 2nd ... returned values
> print "\n2.\n", Dumper( [at] results)
>
> [at] results = $reponse->paramsall; # 1st, 2nd ... returned values
> print "\n3.\n", Dumper( [at] results);
>
> --
> RGB

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
KevinO [ Mi, 09 April 2008 18:30 ] [ ID #1939124 ]

Re: SOAP

KevinO wrote:
> On Apr 9, 11:27 am, RedGrittyBrick <RedGrittyBr... [at] SpamWeary.foo>
> wrote:
>> KevinO wrote:
>>> On Apr 9, 11:07 am, nolo contendere <simon.c... [at] fmr.com> wrote:
>>>> On Apr 9, 11:03 am, KevinO <kevin... [at] yahoo.com> wrote:
>>>>> On Apr 9, 9:40 am, Matija Papec <n... [at] yahoo.com> wrote:
>>>>>> KevinO wrote:
>>>>>>> Hi
>>>>>>> I "inherited" a program which contains this line:
>>>>>>> $a = $soap->call( $retrieveXmlList => [at] 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
>>>>> 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?
>>> 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 => [at] params);
>>
>> my [at] results = $response->result; # 1st returned value
>> print "\n1.\n", Dumper( [at] results);
>>
>> [at] results = $response->paramsout; # 2nd ... returned values
>> print "\n2.\n", Dumper( [at] results)
>>
>> [at] results = $reponse->paramsall; # 1st, 2nd ... returned values
>> print "\n3.\n", Dumper( [at] results);
>>
>
> 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.


--
RGB
RedGrittyBrick [ Mi, 09 April 2008 18:50 ] [ ID #1939126 ]

Re: SOAP

KevinO <kevino_2 [at] yahoo.com> wrote:
> >
> > Your problem may be not with Dumper but with the way you are using
> > SOAP::Lite - try this:
> >
> > my $response = $soap->call($retrieveXmlList => [at] params);
> >
> > my [at] results = $response->result; # 1st returned value
> > print "\n1.\n", Dumper( [at] results);
> >
> > [at] results = $response->paramsout; # 2nd ... returned values
> > print "\n2.\n", Dumper( [at] results)
> >
> > [at] results = $reponse->paramsall; # 1st, 2nd ... returned values
> > print "\n3.\n", Dumper( [at] results);
> >
> > --
> > RGB
>
> 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.
xhoster [ Mi, 09 April 2008 18:57 ] [ ID #1939127 ]
Perl » comp.lang.perl.misc » SOAP

Vorheriges Thema: Perl Regex substitution: replace nth occurrance
Nächstes Thema: FAQ 9.4 How do I remove HTML from a string?