I am trying, for the first time, to call a Web Service using Natural on a mainframe (Natural 4.2.5).
The reponse from the Web Service is successful, but after extracting the response from the SOAP Envelope, I get the error above when trying to use the statement PARSE XML:
NAT8312 Error during XML parser processing, reason 5
Unsupported encoding is used
After getting the response, we decode it into UTF-8, and succesfully extract it from the SOAP envelope. It is 100% readable when writing the response to the screen.
The extracted response from the SOPA Envelope looks like:
is there an encoding= clause in that clause that the forum software keeps zapping (it should be in all lower case too) ?
You indicate that you are running on the mainframe and have decoded the result to UTF-8. If you did, you would not be able to read the output on the mainframe - the mainframe uses EBCDIC code pages (such as CP1040), not UTF-8.
Hello I am using a REQUEST DOCUMENT statement and a PARSE XML statement and getting the same error message. When I hard code a valid
XML document into my #PAGE member, the PARSE XML works fine, so I believe the problem lies with the REQUEST DOCUMENT statement.
I am trying to request a valid XML document from a server. The document should be ASCII, right? I get a 200 return code, so the http: request
is ok. Here are some snippets from my code:
ASSIGN #FROM = ‘https://dpdev1.dp.utexas.edu/test/pli/utl/sample.xml’
REQUEST DOCUMENT FROM #FROM
RETURN
HEADER ‘content-type’ #HEADER
PAGE #PAGE ENCODED FOR TYPE ‘text/html’
CODEPAGE ‘ISO-8859-1’
RESPONSE #RC
GIVING #RTERR
PRINT #HEADER
/ ‘'(79)
PRINT #PAGE
/ '’(79)
…
You can see the returned document if you use the MOVE ENCODED statement to turn the ASCII into EBCDIC. As part of the REQUEST statement, include
NAME 'Content-Type' VALUE #DOC-CHARSET
Examine the #DOC-CHARSET to find what the character set used is
IF #I > 0
EXAMINE #DOC-CHARSET FOR FULL 'charset=' GIVING POSITION #I
IF #I > 0
ADD 8 TO #I
SEPARATE SUBSTRING(#DOC-CHARSET,#I)
LEFT INTO #DOC-CHARSET IGNORE
WITH DELIMITERS ' ;/&?'
ELSE
MOVE 'ISO-8859-1' TO #DOC-CHARSET
END-IF
MOVE ENCODED #XML CODEPAGE #DOC-CHARSET TO #DISPLAY-DOC
You can then view #DISPLAY-DOC on the mainframe terminal.
There should be an XML prolog with an encoding parameter (see other replies here, its hard to post). Try removing the CODEPAGE clause - you may be requesting the document to be translated into something but that doesn’t match the XML prolog encoding clause, so the PARSE fails.
If there is no prolog specifying the encoding, Natural assumes its own codepage applies. In this case, use the Content-Type encoding and the MOVE ENCODED to translate it first.