× 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.



I know that... but that's not the problem. That DS is commented out.

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

You should do one DS with all the fields from the XML. in free format you
can write several levels, no need to use "likeds"

On Tue, Jul 28, 2020 at 4:07 PM Greg Wilburn <
gwilburn@xxxxxxxxxxxxxxxxxxxxxxx> wrote:

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);
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com


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.