Don't ask to ask, just ask | |
PerlMonks |
Finding XML POST data in HTTP::Server::Simple::CGIby Wiggins (Hermit) |
on Mar 16, 2016 at 16:26 UTC ( [id://1157961]=perlquestion: print w/replies, xml ) | Need Help?? |
Wiggins has asked for the wisdom of the Perl Monks concerning the following question:
Well folks, I had hoped to be able to do this in just a couple of day
by modifying a prior sample.
No such luck. I want to make a Restfull server that uses mostly canned (I tweak with current data and message number with regex substitutions) answers to 2 procedure names. It would be a "TAXII Discovery Service". TAXII is XML, so HTTP POST 'queries' are irrelevant, but the HTTP heading, and the XML body are critical.
So far I have been working off of the large example in this
module. I insert into the 'resp_hello()' subroutine reading STDIN(empty), or $cgi->param('POSTDATA') (empty string), or `set>/tmp/environment.txt` (no XML variables). The input I send to the interface is this: My mods to the example are : I get in return: (Note that this output shows the $who variable was also an enpty string!) Based upon the CGI.pm page (http://perldoc.perl.org/CGI.html): If POSTed data is not of type application/x-www-form-urlencoded or multipart/form-data, then the POSTed data will not be processed, but instead be returned as-is in a parameter named POSTDATA. To retrieve it, use code like this: my $data = $query->param('POSTDATA');Of course, all documentation of creating a 'query' is the result of a CGI->new() sort of thing. But the page for the server says the input arg is a CGI object (already made). I can't find the Body line ('<Discovery_Request...>') reading STDIN, nor the param() approach above, nor in any environment variables. I chose this module, because it appeared simple, had a good example, and didn't involve huge amounts of study to just install it. I also thought it would perform as the limited docs repesented. It is always better to have seen your target for yourself, rather than depend upon someone else's description.
Back to
Seekers of Perl Wisdom
|
|