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

RE: recvresp(): end with err



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: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Todd
Carmosino
Sent: 17 May 2013 17:09
To: 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="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="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


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