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

Hello, I am lost and looking for guidance. From a PERL Web Service server I simply want to get the XML sent to the server from the other system and get it into a text variable. I cannot seem to find a means to do that. I see where SOAP::SOM lets you parse SOAP responses to web services but I want to do this on the server end and jsut grab the whole XML message. Can anyone point me to a means to do this?

I do have stub programs working to both send (client) and receive (server) the message.

Thanks, Chuck

Replies are listed 'Best First'.
Re: Getting XML to text
by derby (Abbot) on Aug 26, 2014 at 22:29 UTC

    Is the server side perl? If so, is the client sending the XML stream correctly (POST/PUT with correct MIME type)? Is the server side using CGI or some other module? Lots of examples only deal with the form processing of CGI. If you're using CGI.pm, you want to look at the sections on POSTDATA and PUTDATA. It may be helpful to post your stub programs if they're fairly small.

    -derby

      Yes the server side is PERL. The server side processes the request properly. All I want it to get the XML being sent to me into a string variable.

        Well ... you give us no code nor info on frameworks, modules, client set headers, http method, etc. I'll just assume you're POSTing XML with a mime type of application/xml and using CGI on the server side. If those assumptions are correct, then you just need to:

        my $data = $query->param('POSTDATA');
        If those assumptions are not correct, you're going to need to provide more information because there are so many different ways for a client to send data and a server to process requests.

        -derby
Re: Getting XML to text
by Anonymous Monk on Aug 26, 2014 at 20:03 UTC

    I'm not sure I understand you correctly. You want to essentially spy on a third party's communication with the server?

    If you aren't wiretapping live, you'd need the server to save relevant info to a log or database or whatnot, and then handle requests for that log file.

      Sorry, had to deal with personnal issues. No, this is not spying. Another party sends my PERL web service a request. I want to take the XML request they setn me, put into a text string and save it off. This should be so simple but I cannot seem to find the right method to do it.

Re: Getting XML to text
by Anonymous Monk on Aug 28, 2014 at 07:30 UTC