Hi all,
I'm having trouble sending XML data through a html POST request.
The errors are:
LogMgrWrtr [O.N.H.L.A.ABLSocketLibrary ERROR] EXTRACT ENTITY ERROR
LogMgrWrtr Error(s) raised:
LogMgrWrtr X-NODEREF or X-DOCUMENT LOAD got an error: FATAL ERROR: file 'MEMPTR', line '1', column '1', message 'invalid document structure'. (9082) (9082)
LogMgrWrtr [O.N.H.L.A.ABLSocketLibrary ERROR] EXTRACT ENTITY: Response entity contains raw message body
LogMgrWrtr [O.N.H.L.A.ABLSocketLibrary ERROR] EXTRACT ENTITY: Response Content-Type changed from application/xml to application/octet-stream
An Progress.Lang.SysError has occurred:
Invalid cast from OpenEdge.Core.Memptr to OpenEdge.Core.WidgetHandle. (12869)
This is the code I am using to make the request:
DEFINE VARIABLE lcXmlResponseData AS LONGCHAR NO-UNDO.
DEFINE VARIABLE hXmlRequestData AS HANDLE NO-UNDO.
DEFINE VARIABLE hXmlResponseData AS HANDLE NO-UNDO.
DEFINE VARIABLE oXmlRequestData AS WidgetHandle NO-UNDO.
DEFINE VARIABLE oXmlResponseData AS WidgetHandle NO-UNDO.
DEFINE VARIABLE oHttpRequest AS IHttpRequest NO-UNDO.
DEFINE VARIABLE oHttpResponse AS IHttpResponse NO-UNDO.
CREATE X-DOCUMENT hXmlRequestData.
hXmlRequestData:LOAD("LONGCHAR", <xml_data_in_longchar>, FALSE).
oXmlRequestData = NEW WidgetHandle(hXmlRequestData).
oHttpRequest = RequestBuilder:Post(SessionManager:ExchangeServerURI, oXmlRequestData):ContentType("application/xml"):AcceptXml():Request.
oHttpResponse = ClientBuilder:Build():Client:Execute(oHttpRequest).
oXmlResponseData = CAST(oHttpResponse:Entity, WidgetHandle).
hXmlResponseData = oXmlResponseData:Value.
hXmlResponseData:SAVE("LONGCHAR", lcXmlResponseData).
The XML data is:
<?xml version="1.0"?>
<BulkLoad>
<CustomerId>...</CustomerId>
<DataType>...</DataType>
<StartRangeTime>...</StartRangeTime>
<EndRangeTime>...</EndRangeTime>
<ImpersonationInfo>...</ImpersonationInfo>
</BulkLoad>
If I change the X-DOCUMENT:LOAD validation parameter to TRUE, I get the following error:
An Progress.Lang.SysError has occurred:
X-NODEREF or X-DOCUMENT LOAD got an error: 'no declaration found for element 'BulkLoad''. (9082)
There is this KB article about the error, but there is no external XSD for which the validation should fail:
https://knowledgebase.progress.com/articles/Article/XML-validation-against-external-XSD-fails-starting-with-OpenEdge-11-6
Best regards,
Andrew
I have found what the issue was!
It seems that the server returned a string in case of errors so the response didn't have a valid XML format.
In the second error, the issue is that validation inherently expects an xml schema to be provided.
Found out what the issue was:
The server's response in case of error was in a non-xml format, which caused the cast to WdigetHandle to fail.
In the second error's case, the problem is that validation only works if an XSD is provided.
I have found what the issue was!
It seems that the server returned a string in case of errors so the response didn't have a valid XML format.
In the second error, the issue is that validation inherently expects an xml schema to be provided.
Found out what the issue was:
The server's response in case of error was in a non-xml format, which caused the cast to WdigetHandle to fail.
In the second error's case, the problem is that validation only works if an XSD is provided.