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



You have two problems here.

1) You have namespaces in the XML and XML-INTO has to be told how to handle them. In this case simply removing them appears to be the easy solution so I added the option ns=remove.

2) If you don't want the content of the elements prior to Result you still need to use path to push down to where you want to start. I still wrestle with path sometimes so I tend to overdo it - but in your case the path path=envelope/body/UnitDetailsListResMessage/Result works for me. If you want to use ns=merge instead of ignore you'll need to adjust the path values to incorporate the extended names.

This is the simple version of your code that I used:

**free
dcl-s XMLstring varchar(500)
Inz('<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/";>-
<s:Body>-
<UnitDetailsListResMessage xmlns="http://tmwsystems.com/AMS";>-
<Result xmlns:i="http://www.w3.org/2001/XMLSchema-instance";>-
<Error>-
<Code>0</Code>-
<InnerErrorMessage/>-
<Message/>-
<Severity>None</Severity>-
</Error>-
<ItemCount>1</ItemCount>-
</Result></Body></Envelope>');

dcl-ds Result Qualified;
dcl-ds Error;
Code char(1);
InnerErrorMessage varchar(50);
Message varchar(50);
Severity varchar(10);
End-Ds;
ItemCount Int(5);
End-Ds;


XML-INTO Result %XML( XMLString :
'case=any allowextra=yes allowmissing=yes ns=remove -
path=envelope/body/UnitDetailsListResMessage/Result');

*InLr = *On;

Note that I did not attempt to recreate or check your entire DS.


P.S. I strongly suggest you use nested DS as I did rather than LikeDS - it makes it easy to see that the DS matches the XML document.



On Dec 31, 2019, at 1:36 PM, Jeff Bianchi <Jeff.Bianchi@xxxxxxxx> wrote:

Sorry for the long post! FYI, I've also posted this to SK's HTTP email list, but I thought I'd try here too.

Hello!

Here's the method's output parm XML that my program should be receiving:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/";>
<s:Body>
<UnitDetailsListResMessage xmlns="http://tmwsystems.com/AMS";>
<Result xmlns:i="http://www.w3.org/2001/XMLSchema-instance";>
<Error>
<Code>0</Code>
<InnerErrorMessage/>
<Message/>
<Severity>None</Severity>
</Error>
<ItemCount>1</ItemCount>
<UnitList>
<UnitDetails>
<ActivCode i:nil="true"/>
<ActiveCode>Y</ActiveCode>
<Activity>LINE HAUL</Activity>
<AssetNum/>
<Capacity/>
<Color/>
<CompanyId>TMT</CompanyId>
<CompanyName i:nil="true"/>
<CompanyUnit>Y</CompanyUnit>
<CostCTCode>001</CostCTCode>
<CostCenter>001</CostCenter>
<CreatedBy>IMPORT</CreatedBy>
<CreatedDate>2019-10-08T08:58:00-07:00</CreatedDate>
<CustId>0</CustId>
<CustomerName/>
<CustomerPhone/>
<CustomerStopService/>
<DedUnitNumber/>
<DepPeriod>0</DepPeriod>
<Department>WASHINGTON</Department>
<DeprBase>0001-01-01T00:00:00</DeprBase>
<DeptCode>WASHINGTON</DeptCode>
<Descrip>LINE TRACTOR</Descrip>
<Description>LINE TRACTOR</Description>
<Division>DYNAMICS</Division>
<DivisionCD>DYNAMICS</DivisionCD>
<Domicile>001</Domicile>
<DwTimeStamp>0x00000000001EC8BB</DwTimeStamp>
<EmpDrvId>-2147483648</EmpDrvId>
<Engine/>
<FleetId>282</FleetId>
<FluidType i:nil="true"/>
<FluidTypePrimary>false</FluidTypePrimary>
<FluidTypeUOM i:nil="true"/>
<GroupsId>N</GroupsId>
<InService>2017-12-18T00:00:00-08:00</InService>
<IsSlidingPM>false</IsSlidingPM>
<IsTire>N</IsTire>
<LastDone>2019-11-27T00:00:00-08:00</LastDone>
<LastInterval>0</LastInterval>
<License>YAIS624</License>
<LoanerStatus/>
<LoanerUnit>N</LoanerUnit>
<MFGPartId/>
<Make>FRGHT</Make>
<MeterDef1>0</MeterDef1>
<MeterDef2>0</MeterDef2>
<MeterDef3>0</MeterDef3>
<MeterDefID>0</MeterDefID>
<MeterDefPrimary>false</MeterDefPrimary>
<Model>PE116DC</Model>
<ModelYear>2018</ModelYear>
<ModifiedBy>1293</ModifiedBy>
<ModifiedDate>2019-12-13T15:10:00-08:00</ModifiedDate>
<MonDepr>0</MonDepr>
<NameCustomer/>
<ObjId>12437</ObjId>
<ObjImageId>-2147483648</ObjImageId>
<ObjType>900</ObjType>
<OutofService>0</OutofService>
<ParentMeter>N</ParentMeter>
<ParkFacility/>
<ParkFacilityName/>
<ParksLot/>
<PartId>-2147483648</PartId>
<PhyLocation>IN-SHOP</PhyLocation>
<PhyShopLocation>005</PhyShopLocation>
<Pressure/>
<PriceTBLID>-2147483648</PriceTBLID>
<PurchFrom/>
<PurchPrice>0</PurchPrice>
<PurchUOM>US$</PurchUOM>
<RepairLimit>-1.7976931348623157E+308</RepairLimit>
<RowNum>1</RowNum>
<SalvageValue>-1.7976931348623157E+308</SalvageValue>
<SerialNo>3AKBHSDV6JSJZ4632</SerialNo>
<State>OR</State>
<Status>ACTIVE</Status>
<Terminated>0001-01-01T00:00:00</Terminated>
<TireConfigCode/>
<Title/>
<TmtCodeID>-2147483648</TmtCodeID>
<TotalDepr>0</TotalDepr>
<Type i:nil="true"/>
<UnitID>632</UnitID>
<UnitManager/>
<UnitNumber>2900C</UnitNumber>
<UnitPrefix/>
<UnitType>TRACTOR</UnitType>
<UnitUserFld1/>
<UnitUserFld2/>
<UnitUserFld3/>
<UnitUserFld4/>
<UnitUserFld5/>
<UnitUserFld6/>
<UnitUserFld7>P</UnitUserFld7>
<UnitUserFld8/>
<UnitWeight>-1.7976931348623157E+308</UnitWeight>
<ValidateUnitMtr i:nil="true"/>
<Vendor>800343</Vendor>
<VendorName>PINNACLE FLEET SOLUTIONS</VendorName>
<WARRLife1>0</WARRLife1>
<WARRLife2>0</WARRLife2>
<WARRLife3>0</WARRLife3>
<WarInService>2017-12-15T00:00:00-08:00</WarInService>
<WheelBase/>
<Year>2018</Year>
<YearDepr>0</YearDepr>
</UnitDetails>
</UnitList>
</Result>
</UnitDetailsListResMessage>
</s:Body>
</s:Envelope>

Here's the way I have the data structures set up in my RPGLE:

// Unit result variables
dcl-ds Result qualified inz;
Error likeDS(Error_T);
ItemCount int(10);
UnitList likeDS(UnitList_T);
end-ds;

dcl-ds Error_T Template;
Code int(10);
InnerErrorMessage varchar(500);
Message varchar(500);
Severity varchar(500);
end-ds;

dcl-ds UnitList_T Template qualified;
UnitDetails likeDS(UnitDetails_T);
end-ds;

dcl-ds UnitDetails_T Template;
ActivCode varchar(100);
ActiveCode char(1);
Activity varchar(100);
AssetNum varchar(100);
Capacity varchar(100);
Color varchar(100);
CompanyId varchar(100);
CompanyName varchar(100);
CompanyUnit varchar(100);
CostCTCode int(10);
CostCenter int(10);
CreatedBy varchar(100);
CreatedDate timestamp;
CustId int(10);
CustomerName varchar(100);
CustomerPhone varchar(100);
CustomerStopService varchar(100);
DedUnitNumber varchar(100);
DepPeriod int(10);
Department varchar(100);
DeprBase timestamp;
DeptCode varchar(100);
Descrip varchar(100);
Description varchar(100);
Division varchar(100);
DivisionCD varchar(100);
Domicile int(10);
DwTimeStamp timestamp;
EmpDrvId int(10);
Engine varchar(100);
FleetId int(10);
FluidType ind;
FluidTypePrimary varchar(100);
FluidTypeUOM ind;
GroupsId varchar(100);
InService timestamp;
IsSlidingPM ind;
IsTire varchar(100);
LastDone timestamp;
LastInterval int(10);
License varchar(100);
LoanerStatus varchar(100);
LoanerUnit varchar(100);
MFGPartId varchar(100);
Make varchar(100);
MeterDef1 int(10);
MeterDef2 int(10);
MeterDef3 int(10);
MeterDefID int(10);
MeterDefPrimary varchar(100);
Model varchar(100);
ModelYear varchar(100);
ModifiedBy varchar(100);
ModifiedDate timestamp;
MonDepr int(10);
NameCustomer varchar(100);
ObjId int(10);
ObjImageId int(10);
ObjType int(10);
OutofService int(10);
ParentMeter varchar(100);
ParkFacility varchar(100);
ParkFacilityName varchar(100);
ParksLot varchar(100);
PartId int(10);
PhyLocation varchar(100);
PhyShopLocation varchar(100);
Pressure varchar(100);
PriceTBLID int(10);
PurchFrom varchar(100);
PurchPrice int(10);
PurchUOM varchar(100);
RepairLimit int(10);
RowNum int(10);
SalvageValue int(10);
SerialNo varchar(100);
State varchar(100);
Status varchar(100);
Terminated timestamp;
TireConfigCode varchar(100);
Title varchar(100);
TmtCodeID int(10);
TotalDepr int(10);
Type varchar(100);
UnitID int(10);
UnitManager varchar(100);
UnitNumber varchar(100);
UnitPrefix varchar(100);
UnitType varchar(100);
UnitUserFld1 varchar(100);
UnitUserFld2 varchar(100);
UnitUserFld3 varchar(100);
UnitUserFld4 varchar(100);
UnitUserFld5 varchar(100);
UnitUserFld6 varchar(100);
UnitUserFld7 varchar(100);
UnitUserFld8 varchar(100);
UnitWeight int(10);
ValidateUnitMtr varchar(100);
Vendor int(10);
VendorName varchar(100);
WARRLife1 int(10);
WARRLife2 int(10);
WARRLife3 int(10);
WarInService timestamp;
WheelBase varchar(100);
Year int(10);
YearDepr int(10);
end-ds;

After setting my SOAP action parm I call:
http_setOption('SoapAction':soapAction);

And then run this code:

soapResponse =
http_string('POST': soapEndPointURL: soapRequest:
'text/xml');

soapResonse is getting populated with valid data - up to a point. In other words, the http_String call seems to be giving me the data that I'm expecting. However, keep reading.

options = 'case=any allowextra=yes allowmissing=yes ' +
'path=UnitDetailsListResMessage';

XML-INTO Result %XML(soapResponse: options);

So I am having two problems and #1 might be causing #2, but I don't know enough about this to know:

1. My soapResponse field (dcl-s soapResponse varchar(100000);) is only being populated to a size/length of 1024. When I put the program into debug, and display the field with F11, it only shows me 1024 chars. Any idea why? We're on V7R3 (but our PTFs are not up to date).

2. The XML-INTO op code returns error message RNQ0353 - XML document does not match RPG variable. Based on the program code above, this might simply be the result of the bad length being returned to soapResponse, but it could also be something I've screwed up in defining my DSs.

Any comments would be greatly appreciated.

Thanks - and Happy New Year!



Jeff Bianchi

Jeff.Bianchi@xxxxxxxx<mailto:Jeff.Bianchi@xxxxxxxx>| P 253.804.1034
Oak Harbor Freight Lines, Inc.
"Bringing Peace of Mind Since 1916."

--
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@xxxxxxxxxxxx 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 ...

Follow-Ups:
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.