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

Re: recvresp(): end with err



   Hi Scott -
   Thank you very much for the response! The DHL rep does use the word
   "legacy" often during project meetings.
   Because your examples are so very good, I have not explored some of the
   more esoteric (for me at least) options with HTTPAPI.
   I see EXAMPLE2 has the http_xproc, but what exit point event constant
   should I use.  Also is the exact syntax for the "connection: close"?
   Thank you again...
   Todd Carmosino
   On 5/17/2013 1:00 PM, [1]ftpapi-request@xxxxxxxxxxxxxxxxxxxxxx wrote:

Send Ftpapi mailing list submissions to
        [2]ftpapi@xxxxxxxxxxxxxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
        [3]http://scottklement.com/mailman/listinfo/ftpapi
or, via email, send a message with subject or body 'help' to
        [4]ftpapi-request@xxxxxxxxxxxxxxxxxxxxxx

You can reach the person managing the list at
        [5]ftpapi-owner@xxxxxxxxxxxxxxxxxxxxxx

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Ftpapi digest..."


Today's Topics:

   1. RE: recvresp(): end with err (Ian Patterson)
   2. Re: recvresp(): end with err (Scott Klement)


----------------------------------------------------------------------

Message: 1
Date: Fri, 17 May 2013 17:39:15 +0100
From: "Ian Patterson" [6]<ian@xxxxxxxxxxxxxxxxx>
To: "HTTPAPI and FTPAPI Projects" [7]<ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Subject: RE: recvresp(): end with err
Message-ID: [8]<FIEBLHMAHFEECMEKBPMFMEKEGHAA.ian@xxxxxxxxxxxxxxxxx>
Content-Type: text/plain;       charset="iso-8859-1"

I am not a XML expert by any means, but is the xml in senddoc() formed
correctly ?

If I take the debug file exactly as I see it, the starting tag
<req:GetNewWaybillRequest doesn't have a closing '>'

Also, should it not be after the xmlns line ?


Regards

Ian Patterson


-----Original Message-----
From: [9]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[[10]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Todd
Carmosino
Sent: 17 May 2013 17:09
To: [11]ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Subject: recvresp(): end with err


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=[12]"http://www.dhl.com";><Request><ServiceHeader><MessageReference>22<
/MessageReference></ServiceHeader></Request><MessageVersion>2</MessageVersio
n><Shipment><Billing><ShippingPaymentType>S</ShippingPaymentType></Billing><
Consignee><City>SCHAGERBURG</City><PostalCode>1751</PostalCode><CountryCode>
NL</CountryCode></Consignee><ShipmentDetails><Date>2013-05-17</Date><Product
CodeSwiftShip>102</ProductCodeSwiftShip></ShipmentDetails><Shipper><ShipperI
D>BNTWMS</ShipperID></Shipper></Shipment></req:GetNewWaybillRequest>

recvresp(): entered
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<ns1:SevereErrorResponse xmlns:ns1=[13]"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




------------------------------

Message: 2
Date: Fri, 17 May 2013 11:43:25 -0500
From: Scott Klement [14]<sk@xxxxxxxxxxxxxxxx>
To: HTTPAPI and FTPAPI Projects [15]<ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: recvresp(): end with err
Message-ID: [16]<51965E2D.9050707@xxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"

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][17]"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][18]"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. [19]http://www.dhl.com/
    2. [20]http://www.dhl.com/



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

-------------- next part --------------
   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][22]"http://www.dhl.com";><Request><ServiceHeader><MessageRefe
r
   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][23]"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][24]http://www.dhl.com/
   2. [4][25]http://www.dhl.com/


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

References

   1. [27]http://www.dhl.com/
   2. [28]http://www.dhl.com/
   3. [29]http://www.dhl.com/
   4. [30]http://www.dhl.com/
   5. [31]http://www.scottklement.com/mailman/listinfo/ftpapi

------------------------------

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


End of Ftpapi Digest, Vol 79, Issue 14
**************************************

References

   1. mailto:ftpapi-request@xxxxxxxxxxxxxxxxxxxxxx
   2. mailto:ftpapi@xxxxxxxxxxxxxxxxxxxxxx
   3. http://scottklement.com/mailman/listinfo/ftpapi
   4. mailto:ftpapi-request@xxxxxxxxxxxxxxxxxxxxxx
   5. mailto:ftpapi-owner@xxxxxxxxxxxxxxxxxxxxxx
   6. mailto:ian@xxxxxxxxxxxxxxxxx
   7. mailto:ftpapi@xxxxxxxxxxxxxxxxxxxxxx
   8. mailto:FIEBLHMAHFEECMEKBPMFMEKEGHAA.ian@xxxxxxxxxxxxxxxxx
   9. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
  10. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
  11. mailto:ftpapi@xxxxxxxxxxxxxxxxxxxxxx
  12. http://www.dhl.com/
  13. http://www.dhl.com/
  14. mailto:sk@xxxxxxxxxxxxxxxx
  15. mailto:ftpapi@xxxxxxxxxxxxxxxxxxxxxx
  16. mailto:51965E2D.9050707@xxxxxxxxxxxxxxxx
  17. http://www.dhl.com/
  18. http://www.dhl.com/
  19. http://www.dhl.com/
  20. http://www.dhl.com/
  21. http://www.scottklement.com/mailman/listinfo/ftpapi
  22. http://www.dhl.com/
  23. http://www.dhl.com/
  24. http://www.dhl.com/
  25. http://www.dhl.com/
  26. http://www.scottklement.com/mailman/listinfo/ftpapi
  27. http://www.dhl.com/
  28. http://www.dhl.com/
  29. http://www.dhl.com/
  30. http://www.dhl.com/
  31. http://www.scottklement.com/mailman/listinfo/ftpapi
  32. 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
-----------------------------------------------------------------------