using SOAP::SOM to parse a LWP::UserAgent response

using SOAP::SOM to parse a LWP::UserAgent response

am 06.11.2006 23:26:47 von jcook713

Hi,

I have a LWP::UserAgent request that I want the response to become a
SOAP::SOM object. Is this possible?

I've tried the following but got a weird SOAP/Lite error:

$response = $ua->request($request);
$som = SOAP::SOM->new($response->content());
print $som->valueof('//Result/Data');

Any suggestions?

TIA

Justin

Re: using SOAP::SOM to parse a LWP::UserAgent response

am 07.11.2006 15:13:13 von jcook713

Garry T. Williams wrote:
> On Monday 06 November 2006 17:26, J Cook wrote:
>
>> Hi,
>>
>> I have a LWP::UserAgent request that I want the response to become a
>> SOAP::SOM object. Is this possible?
>>
>> I've tried the following but got a weird SOAP/Lite error:
>>
>> $response = $ua->request($request);
>> $som = SOAP::SOM->new($response->content());
>> print $som->valueof('//Result/Data');
>>
>
> Of course this might be easier, if you included the text of the error
> you refer to. :-)
>
Yes, it might help;) - I got the following:
Can't use string (" while "strict refs" in use at /usr/local/share/perl/5.8.7/SOAP/Lite.pm
line 459.


>> Any suggestions?
>>
>
> Any reason you're not just using SOAP::Lite to access the service
> directly? It uses LWP under its covers.
>
Because its not a simple SOAP call and its easier for me to roll it
myself since that's how the person who wrote the service recommends
doing it. But it would be nice to get the response back where its easily
parsable.

Re: using SOAP::SOM to parse a LWP::UserAgent response

am 07.11.2006 16:22:29 von gtwilliams

On 11/7/06, J Cook wrote:
>
> Garry T. Williams wrote:
> > On Monday 06 November 2006 17:26, J Cook wrote:
> >> I have a LWP::UserAgent request that I want the response to become a
> >> SOAP::SOM object. Is this possible?
> >>
> >> I've tried the following but got a weird SOAP/Lite error:
> >>
> >> $response = $ua->request($request);
> >> $som = SOAP::SOM->new($response->content());
> >> print $som->valueof('//Result/Data');
> Yes, it might help;) - I got the following:
> Can't use string (" > while "strict refs" in use at /usr/local/share/perl/5.8.7/SOAP/Lite.pm
> line 459.

Well, my version of SOAP::Lite (0.67) is different than yours, so that
line number isn't helping me, but...

This from the SOAP::SOM manual page:

Objects from the SOAP::SOM class aren't generally instantiated directly
by an application. Rather, they are handed back by the deserialization
of a message. In other words, developers will almost never do this:

$som = SOAP::SOM->new;

SOAP::SOM objects are returned by a SOAP::Lite call in a client con-
text. For example:

my $client = SOAP::Lite
->readable(1)
->uri($NS)
->proxy($HOST)
$som = $client->someMethod();

This seems to indicate that you are approaching the problem wrong. But...

If you really must, the same manual page seems to indicate that you
need to call match() before calling valueof().

I've never done what you are attempting because I've never had the
need. So I have probably not helped much. I still think you need to
just call the service directly with SOAP::Lite. You might be
pleasantly surprised.

> > Any reason you're not just using SOAP::Lite to access the service
> > directly? It uses LWP under its covers.
> >
> Because its not a simple SOAP call

Huh?

> and its easier for me to roll it
> myself since that's how the person who wrote the service recommends
> doing it. But it would be nice to get the response back where its easily
> parsable.

--
Garry Williams +1 678 656-4579