Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Reading the SOAP Request

by markdibley (Acolyte)
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:

Hi

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

Comment on Reading the SOAP Request
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

      https://metacpan.org/module/SOAP::Server#SOAP::Server::Parameters

      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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1047081]
Front-paged by tye
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2014-12-26 12:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (171 votes), past polls