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

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



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 :-


D Pointer         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
      *_____________________________________________________________________________________________
     P mySaveProc      B
     D                 Pi            10i 0
     D fd                            10i 0 value
     D data                            *   value
     D length                        10i 0 value
     C*
      /Free
             return length;
      /End-Free
     P                 E  



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