[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: 400 Bad Request
Yes, yes,
That worked...
Do we have an example of something like a "get_raw", so I don't have to read back from the IFS?
-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Mike Krebs
Sent: Monday, March 11, 2013 10:59 AM
To: HTTPAPI and FTPAPI Projects
Subject: RE: 400 Bad Request
Hi Gerald,
Welcome to the wonderful world of HTTPAPI.
The form of the string that works is a GET. You are using a POST. Depending on what you are getting back will depend on what to do next. If the result is just a name and you would like to stick it in a variable, use something like discussed in this post:
http://www.iprodeveloper.com/forums/aft/148116
The content type is most likely not 'application/x-www-form-urlencoded' but probably 'text/html'. Using get_raw, you don't have to pass it a particular content-type (as shown in the example code in the post above).
If you want to use the webform support with a get, do it this way (from EXAMPLE9):
form = webform_open();
webform_setVar(form: 'url': inputURL);
webform_setVar(form: 'ret': %trimr(%subst(outputFormat:2)));
uri = 'http://html2pdf.biz/api?' + webform_getData(form);
webform_close(form);
-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Gerald Magnuson
Sent: Monday, March 11, 2013 9:54 AM
To: HTTPAPI and FTPAPI Projects (ftpapi@xxxxxxxxxxxxxxxxxxxxxx)
Subject: 400 Bad Request
I tried to copy from a working program, but I must have messed up somewhere..
HERE IS THE STRING THAT WORKS, when I try it in a browser:
http://knapportal-test.knapheide.com/modules/getboss/getusersboss.php?input_name=gmagnuson
here is my code:
http_debug(*ON:'/tmp/http_error_RTNBOSS.txt');
Form = WEBFORM_open;
If P1_UsrID <> *blanks ;
WEBFORM_SetVar(Form: 'input_name': %trim(P1_UsrID) ); EndIF ;
WEBFORM_postData( Form : myPointer
: dataSize );
rc=http_url_post_raw(
'http://knapportal-test.knapheide.com/modules' +
'/getboss/getusersboss.php':
myPointer: dataSize :
1: %paddr('INCOMING')
:HTTP_TIMEOUT
:HTTP_USERAGENT
: 'application/x-www-form-urlencoded' );
if rc <> 1;
*** rc comes back as 400...
Here is data from the error log:
HTTPAPI Ver 1.23 released 2008-04-24
OS/400 Ver V7R1M0
New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819. ProtLoc=0
http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver retrans: 4
DNS resolver retry : 4
DNS resolver options: x'00000136'
DNS default domain: knapheide.com
DNS server found: 192.168.100.236
DNS server found: 192.168.100.233
http_persist_post(): entered
http_long_ParseURL(): entered
do_post(): entered
POST /modules/getboss/getusersboss.php HTTP/1.1
Host: knapportal-test.knapheide.com
User-Agent: http-api/1.24
Content-Type: application/x-www-form-urlencoded
Expect: 100-continue
Content-Length: 20
recvresp(): entered
HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=us-ascii
Server: Microsoft-HTTPAPI/2.0
Date: Mon, 11 Mar 2013 14:37:36 GMT
Connection: close
Content-Length: 311
SetError() #13: HTTP/1.1 400 Bad Request recvdoc parms: identity 311
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</h2> <hr><p>HTTP Error 400. The request is badly formed.</p> </BODY></HTML>
SetError() #13: HTTP/1.1 400 Bad Request
http_close(): entered
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------