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!