Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Reading the SOAP Request

by markdibley (Sexton)
on Jul 30, 2013 at 17:34 UTC ( #1047081=perlquestion: print w/replies, xml ) Need Help??
markdibley has asked for the wisdom of the Perl Monks concerning the following question:


I have a SOAP Lite server that does the usual thing - a CGI program that uses SOAP::Transport::HTTP::CGI ->dispatch_to(module) ->handle to pass the request on to the correct method.

However, this relies on the the XML being formed in such a way that the variables are always in the correct order with nothing missing. I would like to extract the variables from the XML myself so that I can be sure I know what each value is representing.

I have looked around and I can't find anything that seems to be concerned with this. Can anyone point me in the right direction. I have read various SOAP::Lite pages with no luck.

Thanks. Mark

Replies are listed 'Best First'.
Re: Reading the SOAP Request (SOAP::Server::Parameters)
by Anonymous Monk on Jul 30, 2013 at 22:35 UTC

      I think you can turn on debugging by:

      use SOAP::Lite 'trace', 'debug';

      When you execute it you, should be able to see the SOAP message for your debugging

        Well, that doesn't have much of anything to do with retrieving the request object

      Thanks for the pointer to

      So, essentially all I have to do is add the following to the top of my module and it adds a SOAP::SOM object to the variables passed to any method called as a SOAP service.

      use vars qw(@ISA); @ISA = qw(Exporter SOAP::Server::Parameters);

      The additional variable allows access to the envelope which has a whole load of useful stuff in there including access to the request. And access to the request can be done like in the following example

      sub mymethod{ my $envelope = pop(@_); my $sample_id = $envelope->dataof("//sample_id")->value if(defined + $envelope->dataof("//sample_id")); my $match_id = $envelope->dataof("//match_id")->value if(defined $ +envelope->dataof("//match_id")); }

      This is great as that means I can do my own verifying of the request data.

      Thanks again for the pointer.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1047081]
Front-paged by tye
[Tanktalus]: talexb I saw that one, I was going to apply anyway, but never got around to it.

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2018-01-22 02:49 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (230 votes). Check out past polls.