I'm doing an http upload to a web methods server and it's failing on the &
character.  Can anyone give me a solution as to why?

use HTTP::Request::Common;
use LWP::UserAgent;

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

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

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

    # send the string to the web methods server
    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";
    }

Reply via email to