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

Re: recvresp(): end with err



   hi Todd,
   The message 'recvresp(): end with err' means that it received a network
   error while receiving data from the server.  My guess is that the DHL
   server is disconnecting immediately after sending the data, and since
   it takes some time (albeit, a very small amount of time) to transfer
   over the network, HTTPAPI gets the error before it finishes reading the
   data.
   According to the HTTP/1.1 spec, the HTTP server is not supposed to
   disconnect unless "connection: close" keyword is used.  Otherwise, it's
   supposed to keep the connection open so the client can send another
   request right away.  But yours doesn't appear to be doing this.
   You may be able to solve the problem by inserting a 'connection: close'
   header using http_xproc() to set an additional header keywords.  Or, at
   least, that's worth a try.

   On 5/17/2013 11:08 AM, Todd Carmosino wrote:

   Scott / All -
   Posted the same question the other day, hopefully is post makes more
   sense...
   Why would I receive a "good" response - "recvresp(): entered" with an
   XML response from the sever (even though it's an error) then
   immediately recevie a "bad" response - "recvresp(): end with err" ?
   The request stays inside the company firewall - AS400 to a DHL sever in
   the same computer room.
   Could there be an issue on the server and/or internal router?
   The program is pretty straight forward and a snippet is below, followed
   by the debug file.
   I've spent a better part of a week on this, and any help would really
   be appreciated.
   Todd Carmosino
   >>> Code Snippet <<<
    * Parameter list from calling program...
   D MG120RG         PR                  ExtPgm('MG120RG')
   D   Debug                       10A
   D   dhlesIP                     32A
   D   WMSEnv                      10A
   D   Result                      80A
   D   dhlesIN                  32766A
   D   dhlesOUT                 32766A
   D MG120RG         PI
   D   Debug                       10A
   D   dhlesIP                     32A
   D   WMSEnv                      10A
   D   Result                      80A
   D   dhlesIN                  32766A
   D   dhlesOUT                 32766A
   D url             s           1024A
   D csv             s          32766A   varying
   D retdata         s          32766A
   D retlen          s             10I 0
   D nextpos         s             10I 0 inz(1)
   D debugFile       s            100A
   D rc              s             10I 0
   /free
   url = %trim(dhlesIP);
   csv = 'xml=' + %trim(dhlesIN);
   rc = http_url_post_raw(
                        url
                      : %addr(csv) + 2
                      : %len(csv)
                      : 1
                      : %paddr('INCOMING')
                      : HTTP_TIMEOUT
                      : HTTP_USERAGENT
                      : 'application/x-www-form-urlencoded' );
   if rc <> 1;
      result = 'MG120RG: http_url_post_raw failed' + debugFile;
   else;
      result = 'HTTP POST Success!';
   endif;
   *inlr = *on;

   // Convert the "raw" response data to EBCDIC
   if  retlen > 3;
       http_xlate(retlen: retdata: TO_EBCDIC);
       dhlesOUT = %trimr(retdata);
       result = ' ';
   else;
       result = 'POST Successful - no response data returned';
   endif;
     // Procedure to convert "raw" response data to EBCIDC
   P incoming        B
   D incoming        PI            10I 0
   D   descriptor                  10I 0 value
   D   data                      8192A   options(*varsize)
   D   datalen                     10I 0 value
   c                   eval      retlen = (nextpos + datalen) - 1
   c                   if        retlen > %size(retdata)
   c                   eval      datalen=datalen-(retlen-%size(retdata))
   c                   endif
   c                   if        datalen < 1
   c                   return    0
   c                   endif
   c                   eval      %subst(retdata: nextpos) =
   c                                %subst(data:1:datalen)
   c                   eval      nextpos = nextpos + datalen
   c                   return    datalen
   P                 E

   >>> Debug File <<<
   HTTPAPI Ver 1.24 released 2012-01-23
   OS/400 Ver V6R1M0
   New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819. ProtLoc=0
   WMS Environment: WMSPRD
   DHL EasyShip: http://5.0.110.62:2077:2077
   http_persist_open(): entered
   http_long_ParseURL(): entered
   DNS resolver retrans: 10
   DNS resolver retry  : 5
   DNS resolver options: x'00000136'
   DNS default domain: BTOL.COM
   DNS server found: 5.0.112.158
   DNS server found: 5.0.112.156
   http_persist_post(): entered
   http_persist_req(POST) entered.
   http_long_ParseURL(): entered
   do_oper(POST): entered
   There are 0 cookies in the cache
   POST / HTTP/1.1
   Host: 5.0.110.62:2077
   User-Agent: http-api/1.24
   Content-Type: application/x-www-form-urlencoded
   Content-Length: 593
   senddoc(): entered
   xml=<?xml version="1.0" encoding="utf-8"?><req:GetNewWaybillRequest
   xmlns:req=[1][1]"http://www.dhl.com";><Request><ServiceHeader><MessageRefer
   ence>22</MessageReference></ServiceHeader></Request><MessageVersion>2</
   MessageVersion><Shipment><Billing><ShippingPaymentType>S</ShippingPayme
   ntType></Billing><Consignee><City>SCHAGERBURG</City><PostalCode>1751</P
   ostalCode><CountryCode>NL</CountryCode></Consignee><ShipmentDetails><Da
   te>2013-05-17</Date><ProductCodeSwiftShip>102</ProductCodeSwiftShip></S
   hipmentDetails><Shipper><ShipperID>BNTWMS</ShipperID></Shipper></Shipme
   nt></req:GetNewWaybillRequest>
   recvresp(): entered
   <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
   <ns1:SevereErrorResponse xmlns:ns1=[2][2]"http://www.dhl.com";>
       <Response>
           <ServiceHeader>
               <MessageTime>2013-05-17T11:42:57.315-04:00</MessageTime>
               <MessageReference>22</MessageReference>
           </ServiceHeader>
       </Response>
       <MessageVersion>2</MessageVersion>
       <Status>
           <Code>1</Code>
           <Message>XML document structures must start and end within the
   same entity.</Message>
       </Status>
   </ns1:SevereErrorResponse>
   recvresp(): end with err
   http_close(): entered

References

   1. [3]http://www.dhl.com/
   2. [4]http://www.dhl.com/


-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
[5]http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------

References

   1. http://www.dhl.com/
   2. http://www.dhl.com/
   3. http://www.dhl.com/
   4. http://www.dhl.com/
   5. 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
-----------------------------------------------------------------------