HTTPAPI and http_parse_xml_stmf error
Posted: Tue Nov 25, 2025 11:28 am
Hi Scott,
First of all thanks for making the life easier for us. It is truly beyond words, the work you have put in for the IBM i world.
I am having some programs erroring out for some reason when using http_parse_xml_stmf to parse xml documents on the IFS(stmf with ccsid 1208). The error is happening in the callback procedure. Below is the error occurring when moving `value` to the target field.
Response procedure:
Below is how it is being called:
Also the dump for the `value` variable :
I have also created another pgm to try and debug but it works well there. The issue is intermittent and does not occur on every file process. If there was any issue with the xml, then the program wouldn't work the second time for the same file. Only the `value` variable has junk data.
I also tried changing ccsid on the http_parse_xml_stmf and HTTP_XML_CALC has reduced the errors substantially but not all.
What could be the probable cause? memory corruption? activation groups? I am out of ideas at this moment.
First of all thanks for making the life easier for us. It is truly beyond words, the work you have put in for the IBM i world.
I am having some programs erroring out for some reason when using http_parse_xml_stmf to parse xml documents on the IFS(stmf with ccsid 1208). The error is happening in the callback procedure. Below is the error occurring when moving `value` to the target field.
Code: Select all
Message . . . . : Length of varying length variable is out of range.
Cause . . . . . : The length of a varying length character or DBCS variable
is less than 0 or greater than its declared maximum length in RPG procedure
RESPONSE in program xxxxx.
Response procedure:
Code: Select all
P Response B
d Response PI
d userdata * value
d depth 10I 0 value
d name 1024A varying const
d path 24576A varying const
d value 32767A varying const
d attrs * dim(32767)
d const options(*varsize)
if (path = '/soap-env:Envelope/soap-env:Body/nm:WELSING/INPUT/POSDRER') ;
Select;
When (name = 'PO');
PurchaseOrder = %trim(value);
ENDSL;
endif;
Below is how it is being called:
Code: Select all
If (http_parse_xml_stmf( %trim(xmldocpath)
: HTTP_XML_CALC
: *null
: %paddr(Response)
: *null ) < 0 );
EndIf;
Code: Select all
VALUE CHAR(32767) VARYING(2)
' ÿ· o4hpØ Ø H¸ ;º '
81 ' è ENDELEMENT '
161 ' Ø H¸ ;º *N '
241 ' '
321 ' '
401 ' '
481 ' '
561 ' '
641 ' '
721 ' '
801 ' '
881 ' '
961 ' '
I have also created another pgm to try and debug but it works well there. The issue is intermittent and does not occur on every file process. If there was any issue with the xml, then the program wouldn't work the second time for the same file. Only the `value` variable has junk data.
I also tried changing ccsid on the http_parse_xml_stmf and HTTP_XML_CALC has reduced the errors substantially but not all.
What could be the probable cause? memory corruption? activation groups? I am out of ideas at this moment.