× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Jon & Barbara thank you both!

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Greg Wilburn
Sent: Tuesday, July 28, 2020 4:08 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: XML-INTO with a SOAP document

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.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.