[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: http_url_get problem



That works for me.  Sorry for the horrid code; I just altered an old test program I had for a quick test.

H DFTACTGRP(*NO) ACTGRP(*NEW) BNDDIR('LIBHTTP/HTTPAPI')

D/copy libhttp/qrpglesrc,httpapi_h

D URI             s           1024A   VARYING
D rc              s             10I 0
D msg             s             52A

/free
   URI = 'http://www.gls-italy.com/scripts/cgiip.exe/get_xml_track.p?locpa+
         rtenza=T1&NumSped=520113341&CodCli=2583';
 /end-free
c                   eval      rc = http_url_get(
c                             %trim(URI):
c                             '/tmp/gls_tracking_get.xml')

c                   if        rc <> 1
c                   eval      msg = http_error
c                   dsply                   msg
c                   endif

c                   eval      *inlr = *on
--
Sean Porterfield


-----Original Message-----
From: Roberto Tempesti
Sent: Wednesday, November 28, 2012 04:48
To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Subject: http_url_get problem

Hi all,

I'm trying to consume a web service to get tracking info from an express carrier.
That company gave me a "guide" where I found the method that I'm going to use as per the above string:

http://www.gls-italy.com/scripts/cgiip.exe/get_xml_track.p?locpartenza=<siglasede>&NumSped=<numerospedizione>&CodCli=<codicecliente>

I thought that the method I have to work with is "GET" so I used http_url_get procedure in this way:

rc = http_url_get( %trim(url) : 'gls_tracking_get.xml' );

where "url" variable contains the above value:

http://www.gls-italy.com/scripts/cgiip.exe/get_xml_track.p?locpartenza=T1&NumSped=520113341&CodCli=2583

Well, if I put this string in IE Browser I get back XML data so I think that the request is right.
When I run the same string with http_url_get I get an error "400" "Request URL is invalid".

This is what I found inside the debug file:

HTTPAPI Ver 1.24 released 2012-01-23
OS/400 Ver V5R4M0

New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819. ProtLoc=0

http_url_get(): entered
http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver retrans: 2
DNS resolver retry  : 2
DNS resolver options: x'00000136'
DNS default domain: xxxxxxxxx.yy
DNS server found: 192.168.x.x
http_persist_get(): entered
http_persist_req(GET) entered.
http_long_ParseURL(): entered
do_oper(GET): entered
There are 0 cookies in the cache
GET
/scripts/cgiip.exe/get_xml_track.p?locpartenza=T1&NumSped=520113341&CodCli=2583

Host: www.gls-italy.com
User-Agent: http-api/1.24


recvresp(): entered
HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=us-ascii
Server: Microsoft-HTTPAPI/2.0
Date: Wed, 28 Nov 2012 09:32:06 GMT
Connection: close
Content-Length: 324


SetError() £13: HTTP/1.1 400 Bad Request
recvresp(): end with 400
recvdoc parms: identity 324
header_load_cookies() entered
recvdoc(): entered
SetError() £0:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd";>
<HTML><HEAD><TITLE>Bad Request</TITLE> <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD> <BODY><h2>Bad Request - Invalid URL</h2> <hr><p>HTTP Error 400. The request URL is invalid.</p> </BODY></HTML>

SetError() £13: HTTP/1.1 400 Bad Request
http_close(): entered

Can anyone help me? If you need more info pls ask.

Thank you so much.

This email is confidential, intended only for the named recipient(s) above and may contain information that is privileged.  If you have received this message in error or are not the named recipient(s), please notify the sender immediately and delete this email message from your computer as any and all unauthorized distribution or use of this message is strictly prohibited.  Thank you.
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------