Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: SOAP::Deserializer problem

by radiantmatrix (Parson)
on Jul 27, 2007 at 14:49 UTC ( [id://629119]=note: print w/replies, xml ) Need Help??


in reply to SOAP::Deserializer problem

The 'use of uninitialized value' in your output are warnings: the "command" tagset in your source XML is empty, so the Deserializer properly sets the values to undef. When you try to print an undef value, and you have warnings enabled, you get that message.

Try this pattern for your print statements:

print "got 'command' subitem $i '", (defined $subitem->name() ? $subitem->name() : '<<undefined>>') , "'\n";

The second line of that basically says "if the value is defined, then pass it to print, otherwise pass back the string '<<undefined>>'". The result is that your output would say something like:

got 'command' subitem 1 '<<undefined>>'
<radiant.matrix>
Ramblings and references
The Code that can be seen is not the true Code
I haven't found a problem yet that can't be solved by a well-placed trebuchet

Replies are listed 'Best First'.
Re^2: SOAP::Deserializer problem
by axelrose (Scribe) on Jul 28, 2007 at 04:53 UTC
    Ok. This get's me a step forward. The output is now
    got 'command' item 'message' got 'command' subitem 1 '<<undefined>>' got 'command' subsubitem 1:1 '<<undefined>>' got 'command' subitem 2 '<<undefined>>'
    Nonetheless I still don't have the name of the XML nodes. What I eventually need is the value of such nodes. How could I access them?? Axel.

      I'm not entirely familiar with SOAP::Deserializer; I've generally used XML::Simple family of parsers, and I've not had such problems with them. Sorry I can't be of more help than that.

      <radiant.matrix>
      Ramblings and references
      The Code that can be seen is not the true Code
      I haven't found a problem yet that can't be solved by a well-placed trebuchet

        Thanks for your idea.

        I use SOAP::Deserializer only because it is a natural part of processing SOAP responses.

        Trying again with another deserializer like this:
        my $soap = SOAP::Lite ->uri($uri)->proxy( $proxyUrl, timeout => 5 ) ->deserializer(XMLRPC::Lite->new());

        I end up with the error message from XMLRPC::Lite "A service address has not been specified either by using SOAP::Lite->proxy() or a service description)" although there is a proxy. I can watch the request and the response on the wire.

        So my last chance seems to be overloading deserialize() with a custom deserializer
        my $soap = SOAP::Lite ->uri($uri)->proxy( $proxyUrl, timeout => 5 ) ->deserializer(Deserialize->new()); package Deserialize; use warnings; use strict; use SOAP::Lite; use vars qw(@ISA); @ISA = ('SOAP::Deserializer'); sub deserialize { return $_[1] } 1;
        Cheers, Axel.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (1)
As of 2024-04-24 17:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found