Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hello there.

I'm running into a wall (or more likely, a proxy) while trying to connect to a wsdl service via web call. I suspect the company proxy is not handling the request properly but I'm not sure how to help it along.

I'd like to avoid using company specific info, so the below URLs will not work. But know that when I request the specified URL from a browser, I get back a proper XML response. From the script, I get a 400 bad request error.

use strict; use LWP::UserAgent; my $g = LWP::UserAgent->new(show_progress => 1); $g->proxy(['http','ftp','https'], 'http://proxy.company.com:8080'); my $gr = HTTP::Request->new(POST => 'https://remote.othercomp.com/Sess +ionManagement/PublicSessionManagementService.svc?wsdl'); $gr->header('Content-Length' => '0'); my $gs = $g->request($gr); print $gs->status_line, "\n"; print $gs->content, "------- end content -------\n";
Results:
** POST https://wsnet.sendwordnow.com/SessionManagement/2010/05/Public +SessionManagementService.svc?wsdl ==> 400 Bad Request (1s) 400 Bad Request ------- end content -------
I've tried doing a normal GET request to Google.com and gotten back a good response and the appropriate content.

any help is much appreciated.


dsb
This @ISA my( $cool ) %SIG

In reply to LWP 400 Bad Request on POST by dsb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2024-04-25 14:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found