I'm somewhat new to the libwww-perl so please be nice during the flaming
process.
Previously I was doing an http post to a webmethods server of an XML
document using the following method:

   # create a User Agent
   my $ua = new LWP::UserAgent;

   # create the request object
   my $req = new HTTP::Request( POST => $sourceUrl );

   $req->content_type('application/x-www-form-urlencoded');
   $req->content('xmldocument=' . $text);

   # get the response object back
   my $res = $ua->request( $req );

   # if there was an error, send to error to STDOUT
   if( $res->is_error )
   {
      # get the error message and strip out the HTML
      my $error = $res->error_as_HTML();
      $error =~ s/<(.*)>\n//g;

      print "Error from Web Methods Server: $error";
   }

I noticed that when the xml document contained any &'s, it seemed like it
would stop sending so I modified the code to look something like this:
----------------------------------------------------------------------------
---------------------------------------
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;

# create a User Agent
my $ua = new LWP::UserAgent;

# create the request object
my $req = POST $sourceUrl, [ xmldocument => $text ];

# send the string to the web methods server
print $ua->request($req)->as_string;


If this does work how do I go about testing the results from the web
methods server.  Previously I created a response object when it was sent
and did the following:

Previously I was using the is_error from the response object.

Reply via email to