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

Re: [Ftpapi] http_persist_req(PUT:pointer:...) return error of HTTP/1.1 411 Length Required



Hello,

There is a bug in HTTPAPI that will be fixed in the next release. The bug is explained here:
http://www.scottklement.com/archives/ftpapi/201702/msg00004.html

So to fix this problem you must:

1) Change the code as described in the link above (or wait for the next release.)

2) Change your call to http_persist_req() to pass a non-null pointer for the peUplData parameter. (A null indicates that your request does not have any request document to send -- which is incorrect for a PUT request.)

Once both of these changes have been made, it should work as expected.

-SK


On 3/2/2017 5:31 AM, Bala Kandasamy wrote:
Hi Scott,

The following is what i'm encountering by using the http_persist_req with 'PUT' to consume a rest service. This is how my RPGLE program looks like :-


DPointer S *

        http_setCCSIDs(1208:0);
        http_debug(*ON:'/tmp/InvoiceOfCustomerOrderLineReleased.txt');
        requestUri ='http://srvwebuat:8030/OrderProcessingWfV1/+
api/CustomerOrderLine/1-2-3/ClosedOrDeleted';

         pointer =http_persist_open(requestUri);
if(pointer =*null);
     Display_Text(http_error);
endif;

rc =http_persist_req('PUT':pointer:requestUri
:0:*null:
*null:0:0:%paddr(mySaveProc):300:
'application/json');

http_persist_close(Pointer);

*============================================================================================= * MapXmlData - This subprocedure reads the result returned by the service call *_____________________________________________________________________________________________
PmySaveProc B
DPi   10i0
Dfd      10i0value
Ddata *value
Dlength      10i0value
C*
/Free
returnlength;
/End-Free
PE



Getting back rc = 411 and the debug log shows the following :-

HTTPAPI _Ver_ 1.33 released 2016-12-06
NTLM _Ver_ 1.4.0 released 2014-12-22
OS/400 _Ver_ V7R2M0

http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver _retrans_: 2
DNS resolver retry  : 2
DNS resolver options: x'00000136'
DNS default domain: EE1.INTRANET.ELEKTRISOLA.COM
DNS server found: 10.1.200.80
DNS server found: 10.1.200.81
Nagle's algorithm (TCP_NODELAY) disabled.
http_persist_req(PUT) entered.
http_long_ParseURL(): entered
http_long_ParseURL(): entered
do_oper(PUT): entered
There are 0 cookies in the cache
PUT /OrderProcessingWfV1/_api_/CustomerOrderLine/1-2-3/ClosedOrDeleted HTTP/1.1
Host: _srvwebuat_:8030
User-Agent: application/_json_


_recvresp_(): entered
HTTP/1.1 411 Length Required
Content-Type: text/_html_; _charset_=us-_ascii_
Server: Microsoft-HTTPAPI/2.0
Date: _Thu_, 02 Mar 2017 10:38:46 GMT
Connection: close
Content-Length: 344


SetError() #13: HTTP/1.1 411 Length Required
_recvresp_(): end with 411
_recvdoc_ _parms_: identity 344
header_load_cookies() entered
_recvdoc_(): entered
SetError() #0:
_recvdoc_(): Receiving 344 bytes.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd";>
<HTML><HEAD><TITLE>Length Required</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/_html_; _charset_=us-_ascii_"></HEAD>
<BODY><h2>Length Required</h2>
<hr><p>HTTP Error 411. The request must be _chunked_ or have a content length.</p>
</BODY></HTML>

SetError() #13: HTTP/1.1 411 Length Required
http_close(): entered


Please tell me what am i missing here. Thanks in advance.

Ruben Kandasamy


_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi

_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi