xmlservice
xmlservice copied to clipboard
Calls to programs or service program functions with mode="opm" do not handle *OMIT parameters properly
In plugile.rpgle functions ilePGM() and ileSRV() they are walking forward through the argv pointers looking for a null pointer to count how many parameters there are. In the case of *OMIT you can have a spot in the middle where a parameter has a null pointer but then subsequent valid parameters. The code is skipping out and not recognizing those subsequent valid parameters. It needs to walk backwards instead.
I will add more comments later today,
Here's an example test that you can run in ACS Run SQL Scripts using the ZZSRV test service program included in XMLSERVICE:
call qxmlserv.iplug4k('*na', '*here',
'<?xml version="1.0" encoding="ISO-8859-1"?>'
|| '<script>'
|| '<pgm mode="opm" name="ZZSRV" lib="XMLSERVICE" func="ZZOMIT">'
|| '<parm io="omit"><data type="10a" var="myName">Ranger</data></parm>'
|| '<parm><data type="10a" var="yourName">Buddy</data></parm>'
|| '<return><data var="retName" type="50A" varying="on">Mud</data></return>'
|| '</pgm>'
|| '</script>'
, '');
If you run that as given, the current ileSRV() code doesn't pass the second required parameter and the call fails with this error message: (note just an excerpt as it didn't even return all of the xml for some reason)
<version>XML Toolkit 2.0.2-dev</version>
<error>
<errnoxml>1100004</errnoxml>
<xmlerrmsg><![CDATA[XML run loop failed]]></xmlerrmsg>
<xmlhint><![CDATA[p(51) <pgm mode="opm" name="ZZSRV" lib="XMLSERVICE" func="ZZ]]></xmlhint>
</error>
<error>
<errnoxml>1000009</errnoxml>
<xmlerrmsg><![CDATA[ILECALL failed]]></xmlerrmsg>
<xmlhint><![CDATA[ZZOMIT]]></xmlhint>
</error>
<error>
<errnoxml>1100016</errnoxml>
<xmlerrmsg><![CDATA[XML run pgm failed]]></xmlerrmsg>
<xmlhint><![CDATA[<pgm mode="opm" name="ZZSRV" lib="XMLSERVICE" func="ZZOMIT"]]></xmlhint>
</error>
<error>
<errnoxml>1100004</errnoxml>
<xmlerrmsg><![CDATA[XML run loop failed]]></xmlerrmsg>
<xmlhint><![CDATA[p(51) <pgm mode="opm" name="ZZSRV" lib="XMLSERVICE" func="ZZ]]></xmlhint>
</error>