in reply to xml request

First fo all: there's a syntax error in your code. Please enable strict and warnings and please copy'n'paste your tested code, don't rewrite it.

Secondly: What does "the xml request is ignored" mean? What happens instead? What error messages do you get?

Have you read the HTTP::Request::Common manpage carefully? Your $xml_req is in no context there. What shall it be? A submitted field or something to be send in a header?

#did you mean: POST $URL, [ xml => $xml_req ] #?

try building a request of your needs using HTTP::Request's as_string() method. HTH

--
http://fruiture.de

Replies are listed 'Best First'.
Re: Re: xml request
by patiafrica (Initiate) on Aug 04, 2002 at 16:59 UTC
    sorry about any mess, so far I see no syntax error,but I poste the code again. Thanks for your help by the way!! What happens is when I send the request that it seems that the xml string is not being passed on and the response I get is as if I sent the request without the string
    #!/usr/bin/perl use LWP::UserAgent; use HTTP::Request::Common; my $URL = "url.com"; # The xml_request my $xml_req = " <Row> <Address>H</Address> <Name>MUSTER/MAX</Name> <Age>34</Age> </Row>"; my $ua = LWP::UserAgent->new(); my $result = $ua->request(POST $URL,["form_param" => $xml_req]); print "Content-type: text/plain\n\n"; print $result->as_string(); print $result->content();

      Again: enable strict and warnings, especially when you're looking for a bug!

      The code should work now. But let's do some debugging:

      #$URL and $xml_req initialised print "Content-type: text/plain\r\n\r\n"; #rather use CGI.pm anyway print "URL: $URL\nXML: $xml_req\n-----\n"; my $ua = LWP::UserAgent->new(); print "Useragent: $ua\n"; #will print reference representation my $req = POST $URL,['form_param'=>$xml_req]; print "Request:\n",$req->as_string(),"\n-----\n"; my $result = $ua->request($req); # rest is clear...

      The problem is the generated Request (speculation). You can be sure after reading the documentation of HTTP::Request::Common

      --
      http://fruiture.de
        Well lets see, the idea is to send this server an xml request which will trigger this server to deliver a response then to capture the response and then carry on with that.. but you are right, the server does not reckognize the sent xml part.. Oh dear..