in reply to Re^4: Consuming A Web Service
in thread Consuming A Web Service
pkupnorth, you changed 3 things:
If you do them one at a time, you will find that it was moving the Accept from the ->new(...) to a separate $req->header() line that got rid of the "Bad header argument at code.pl line 8." error, not the removal of the single quotes.
use strict; use warnings; use LWP::UserAgent; use HTTP::Request::Common qw(GET); my $ua = LWP::UserAgent->new; my $endpoint = 'Http://www.sierraaluminum.com:8081/api/MarvinWindows/ +getASN'; my $req = HTTP::Request->new('GET'); $req->header('Accept' => 'application/xml'); $req->url($endpoint); my $resp = $ua->request($req); my $message = $resp->content; print "printing message: $message\n\n";
update: fixed the order of the quoted version in the bullet list
update 2: added "not the removal of the single quotes"; removed an unnecessary sentence that was unnecessarily argumentative in tone.
|
|---|