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

Re^3: SOAP::Deserializer problem

by rahed (Scribe)
on Jul 29, 2007 at 18:16 UTC ( #629418=note: print w/replies, xml ) Need Help??

in reply to Re^2: SOAP::Deserializer problem
in thread SOAP::Deserializer problem

I didn't realise you don't code the request like this:
$method = SOAP::Data->name('command'=>'value');

So to access attribute values you should use

$attr_value = $som->dataof('//Envelope/Body/command')->attr->{'template'};
$attr_value = $som->dataof('//command')->attr->{'template'};
(I don't remember which one because don't use attributes.)

This should hold for
<command template="foo">100</command>

and $attr_value is foo, command value is 100.

Docs are in SOAP/SOM.pod of perl/site/lib directory.

Replies are listed 'Best First'.
Re^4: SOAP::Deserializer problem
by axelrose (Scribe) on Jul 29, 2007 at 18:47 UTC
    Sorry, my first go was more complicated than necessary. Here is a second simplified go to demonstrate my problem:
    #!/usr/bin/perl use warnings; use strict; use SOAP::Lite; my $xml = <<'eof'; <?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV=" +elope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <command id="1"> <message id="2"> <time time="27.07.2007-10:37:49 +0200"/> </message> </command> </SOAP-ENV:Body> </SOAP-ENV:Envelope> eof my $som = SOAP::Deserializer->deserialize($xml); print "time = ", $som->dataof('//command/message/time')->attr->{time}, + "\n"; print "done.\n";
    Output is
    time = 27.07.2007-10:37:49 +0200 done.
    Can't call method "attr" on an undefined value at + line 23.
    as soon as the id attributes of command and message are identical. I wouldn't care if I could get the raw XML from the SOAP response. Axel.
      You want to avoid the use of id attributes and rename them to some other name or qualify them in the namespace.

      SOAP protocol uses id/href attribute pairs to identify its entities.

      If you specify outputxml('true') for a soap object, a method will return raw xml code.

        Thanks a lot.

        For all practical purposes this is solved now


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://629418]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2020-10-20 23:13 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (212 votes). Check out past polls.