Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
UPDATE: The original post was modified between the time I started writing and the time I posted this response. I'm sure my response looks odd now, so all bets are off on my response making any kind of sense.

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:

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;
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.)

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

-- Yeah, I'm a Delt.

In reply to Re: HTTP Post of XML data by dorko
in thread HTTP Post of XML data by hallikpapa

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (15)
    As of 2015-07-02 10:35 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (33 votes), past polls