HTTP_POST_XML error with no/empty response

Discussions related to HTTPAPI (An HTTP Client Package for RPG programming.) http://www.scottklement.com/httpapi/
Post Reply
mfef
Posts: 1
Joined: Mon Jan 10, 2022 12:54 pm

HTTP_POST_XML error with no/empty response

Post by mfef »

Hi everybody,

on successful invocation of an asynchronous http-interface, error 66 "XML parse failed at line 1, col 0: no element found" is displayed with RC = -1.
The server returns HTTP 200, there is no response, that's correct. The call is properly processed.

call:

Code: Select all

      /FREE
         msg = '<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>' +
               '<ns0:MT_ZISHPOS_PACKAGE xmlns:ns0="http://ef.de/ishop">' +
               '<packageNr>' + %CHAR(packageNr) + '</packageNr>' +
               '</ns0:MT_ZISHPOS_PACKAGE>';
      /END-FREE

     C                   CALLP     http_debug(*ON: '/tmp/INT955.txt')

      /FREE
         resultRC = HTTP_POST_XML(
                      soapUrl
                      :%ADDR(msg) + 2
                      :%LEN(msg)
                      :*NULL
                      :*NULL
                      :*NULL
                      :wkTIMEOUT
                      :wkUSERAGENT
                      :'application/xml'
                      :*omit);
      /END-FREE
debug-log

Code: Select all

HTTPAPI Ver 1.45 released 2021-09-20
NTLM Ver 1.4.0 released 2014-12-22
OS/400 Ver V7R4M0
....
senddoc(): entered
<?xml version="1.0" encoding="iso-8859-1" standalone="no"?><ns0:MT_ZISHPOS_PACKAGE xmlns:ns0="http://ef.de/ishop"><packageNr>42092</packageNr></ns0:MT_ZISHPOS_PACKAGE>
recvresp(): entered
HTTP/1.1 200 OK
server: SAP NetWeaver Application Server 7.53 / AS Java 7.50
date: Mon, 10 Jan 2022 12:30:00 GMT
content-length: 0
set-cookie: saplb_*=(J2EE802193320)802193350; Version=1; Path=POD; Secure; HttpOnly


SetError() #13: HTTP/1.1 200 OK
recvresp(): end with 200
recvdoc parms: identity 0
header_load_cookies() entered
cookie_parse() entered
cookie =  saplb_*=(J2EE802193320)802193350; Version=1; Path=POD; Secure; HttpOnly
cookie attr saplb_*=(J2EE802193320)802193350
cookie attr Version=1
cookie attr Path=POD
cookie attr Secure=
cookie attr HttpOnly=
cookie rejected, path/dom doesn't match request.
recvdoc(): entered
SetError() #0:
recvdoc(): Receiving 0 bytes.
recvdoc(): Nothing to receive, exiting...
http_close(): entered
HTTPAPI Ver 1.45 released 2021-09-20
NTLM Ver 1.4.0 released 2014-12-22
OS/400 Ver V7R4M0

SetError() #66: XML parse failed at line 1, col 0: no element found
Can anyone tell me why it is trying to parse the empty response?
Scott Klement
Site Admin
Posts: 872
Joined: Sun Jul 04, 2021 5:12 am

Re: HTTP_POST_XML error with no/empty response

Post by Scott Klement »

That's what HTTP_POST_XML does... it parses the response with an XML parser.

Use HTTP_POST (or a newer option like http_req) if you don't want it to try to parse the response.
Post Reply