Sorry if I'm being thick... but I'm trying to parse an XML (SOAP) response using XML-INTO a data structure. I thought XML-INTO would be easier (duh).
I can't figure out what I'm doing wrong... and all the examples I have (and have found online) use either XML-SAX or EXPAT when dealing with SOAP responses.
The document looks like this:
<soap:Envelope xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetRefundResponse xmlns="www.envmgr.com/LabelService">
<RefundResponse>
<ErrorMessage>string</ErrorMessage>
<RequesterID>string</RequesterID>
<RequestID>string</RequestID>
<Refund PicNumber="string" TransactionId="long" PieceNumber="int">
<RefundStatus>Approved or DeniedInvalid</RefundStatus>
<RefundStatusMessage>string</RefundStatusMessage>
</Refund>
<Refund PicNumber="string" TransactionId="long" PieceNumber="int">
<RefundStatus>Approved or DeniedInvalid</RefundStatus>
<RefundStatusMessage>string</RefundStatusMessage>
</Refund>
<FormId>string</FormId>
<BatchId>string</BatchId>
</RefundResponse>
</GetRefundResponse>
</soap:Body>
</soap:Envelope>
I've tried numerous iterations of the following.. I'm getting:
"The XML document does not match the RPG variable; reason code 1. The specified path to the XML element was not found in the XML document."
dcl-ds Response qualified;
ErrorMessage varchar(256);
RequesterId varchar(10);
RequestId varchar(25);
// Refund likeds(refund_t) dim(99);
end-ds;
dcl-ds refund_t template;
@PicNumber varchar(50);
@TransactionId varchar(10);
RefundStatus varchar(15);
end-ds;
dcl-s xmlfile varchar(64);
dcl-s options varchar(256);
xmlfile = '/response.xml';
options = 'doc=file +
path=/soap:Envelope/soap:Body/GetRefundResponse/RefundResponse +
case=any +
allowextra=yes +
allowmissing=yes';
xml-into Response %xml(xmlfile: options);
** AND THIS **
options = 'doc=file +
path=/Envelope/Body/GetRefundResponse/RefundResponse +
case=any +
allowextra=yes +
allowmissing=yes ns=remove';
xml-into Response %xml(xmlfile: options);
As an Amazon Associate we earn from qualifying purchases.