mummra1 has asked for the wisdom of the Perl Monks concerning the following question:

hi Monks, I'm running into some issues with SOAP::WSDL. I used wsdl2perl to create all the interfaces/typemaps with no problem. My issue is using the get_METHOD accessors to retrieve values from returned objects. I can see, using debug from SOAP::Lite, that I am receiving correctly formatted SOAP messages when calling a method from my interface. However, when I try to run getters on the returned object, I get error messages, such as: Can't locate object method "get_value1" via package "SOAP::WSDL::SOAP::Typelib::Fault11". My .pm files are annotated as follows:
{ # package::myPackage value1 => $some_value, # int value2 => $some_value, # int value3 => { # package::differentPackage nestedvalue1 => $some_value, # int nestedvalue2 => $some_value, # int }, }
I've found little documentation on how to actually extract these values. I'm relatively new to perl, but ok with OOP concepts. Thanks in advance!

Replies are listed 'Best First'.
Re: using getters with SOAP::WSDL inside out objects (fault)
by tye (Sage) on May 29, 2013 at 15:21 UTC

    "Fault11" sounds like something went wrong. Flailing around a bit I did notice that SOAP::WSDL::SOAP::Typelib::Fault11 is documented. So see what get_faultstring() tells you.

    - tye        

      Thanks Tye, yes the output of get_faultstring gives me:

      Error deserializing message: Can't call method "get_class" on an undef +ined value at /opt/local/lib/perl5/site_perl/5.12.4/SOAP/WSDL/Expat/M +essageParser.pm line 318.

      I wonder if the module is having trouble with de-serialization.

        Looking at MessagerParser.pm, get_class() is called on the "class_resolver".

        The documentation mentions this snippet:

        my $parser = SOAP::WSDL::Expat::MessageParser->new({ class_resolver => 'My::Resolver' });

        It looks like a SOAP::WSDL::Expat::MessageParser is getting constructed with no class resolver specified. But the referenced docs about how to make a class resolver don't seem to actually put the pieces together about how you tell SOAP::WSDL which resolver to use. I suppose the "generator" is supposed to just take of that for you.

        So perhaps you need to double check how you ran the generator or look at what it generated to figure out the missing piece?

        (In case you haven't noticed, I have no experience with using SOAP.)

        - tye