in reply to HTTP Post of XML data
Warning: Although I've submitted XML via a POST, I've never used XML::Writer in combination with LWP::UserAgent like you're trying to do.
From the docs for XML::Writer, the OUTPUT parameter of an XML::Writer object must be either an "object blessed into IO::Handle or one of its subclasses (such as IO::File), or a reference to a string." I'm pretty sure that $browser->post('http://localhost:8180/automanager/request') is neither of those.
Plus, from the SYNOPSIS section of the XML::Writer docs, I'm pretty sure all you've done is created an object. It takes a bit more to actually create XML. This untested snippet is modified from the synopsis of the XML::Writer docs:
If you then POST $output to your URL, I think that will do what you want. You'll need to specify $object as the Content of the POST (See the REQUEST METHODS section of the LWP::UserAgent docs. I remember having to use HTTP::Request::Common to build the request, but I don't remember why I needed to do that at the moment.)my $output; my $writer = new XML::Writer(OUTPUT => \$output); $writer->startTag("greeting", "class" => "simple"); $writer->characters("Hello, world!"); $writer->endTag("greeting"); $writer->end(); print $output;
All this is from a quick read of the docs and from memory so it could all be way off base, but I think it at least points you in the right directions.
Cheers,
Brent
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: HTTP Post of XML data
by hallikpapa (Scribe) on Nov 14, 2007 at 03:46 UTC | |
by rvosa (Curate) on Nov 14, 2007 at 05:42 UTC | |
by erroneousBollock (Curate) on Nov 14, 2007 at 05:57 UTC | |
by hallikpapa (Scribe) on Nov 14, 2007 at 06:25 UTC | |
by erroneousBollock (Curate) on Nov 14, 2007 at 06:33 UTC | |
|