in reply to Re: help stripping header from a Web Service Response
in thread help stripping header from a Web Service Response

I am updating previously written code. The original code simply took some raw xml and sent it using HTTP::Request Here's the code snipet.
$userAgent = LWP::UserAgent->new(agent => 'perl post'); $file_contents = do { local $/; <INFILE> }; $message = $file_contents; $response = send_xml(); $xml_resp = $response->as_string; sub send_xml { my $request = HTTP::Request->new(POST => 'http://"servername".asmx +'); $request->header(SOAPAction => "https://"url"); $request->content($message); $request->content_type('text/xml; charset=utf-8'); my $response = $userAgent->request($request); $response; }
obviously "servername" and "url" are just place holders to the real servers. Like I said, I am getting back into Perlville after a long break. thanks for the pointer to HTTP::Message which lead me to HTTP::Header. $xml_response contains the header I want to get rid of. I'll work on stripping it out when I get the response back.

Replies are listed 'Best First'.
Re^3: help stripping header from a Web Service Response
by Corion (Patriarch) on Jul 07, 2011 at 07:13 UTC

    Why do you use $response->as_string instead of using $response->content or $response->decoded_content ? $response already is a HTTP::Response (which is a HTTP::Message), so you already have everything you need. You just should start using it.