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

RE: 400 Bad Request

When you click the link and view it in your browser, you are using GET.  Your code uses POST.  Perhaps you should code a GET request?
Sean Porterfield

-----Original Message-----
From: Gerald Magnuson
Sent: Monday, March 11, 2013 10:54
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:

here is my code:


Form = WEBFORM_open;

If P1_UsrID <> *blanks ;
  WEBFORM_SetVar(Form: 'input_name': %trim(P1_UsrID) ); EndIF ;

WEBFORM_postData( Form : myPointer
: dataSize );

'http://knapportal-test.knapheide.com/modules' +
myPointer: dataSize :
1: %paddr('INCOMING')
: '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:
DNS server found:
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";>
<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 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: