Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^5: Need help with sending xml formatted payload using HTTP::Request

by Your Mother (Archbishop)
on Jan 26, 2015 at 21:33 UTC ( [id://1114560]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Need help with sending xml formatted payload using HTTP::Request
in thread Need help with sending xml formatted payload using HTTP::Request

I think perhaps there was a confluence of almost right in the advice, try this mix (default auth headers like I showed before are more convenient because you only do it once)–

use strict; # Never- use warnings; # -skip these. use LWP::UserAgent; my $urlRequest = "http://bamboohost/rest/api/latest/result/projectname +-planname-latest/label"; my $xml = <<''; <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <label name="testlabel"/> my $ua = LWP::UserAgent->new; my $post = HTTP::Request->new( POST => $urlRequest ); $post->authorization_basic("username", "password"); $post->content($xml); $post->content_type("application/xml"); print $post->as_string; my $result = $ua->request( $post );
  • Comment on Re^5: Need help with sending xml formatted payload using HTTP::Request
  • Download Code

Replies are listed 'Best First'.
Re^6: Need help with sending xml formatted payload using HTTP::Request
by drohr (Acolyte) on Jan 27, 2015 at 15:02 UTC
    this worked !! changing 'text' to 'application' on this line fixed it.
    $post->content_type("application/xml");
    thanks for all the help, everyone!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1114560]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2024-04-19 12:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found