[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using %paddr(GetInnerDoc) in http_url_post_xml and thereafter http_parse_xml_stmf
hello Jan,
You have coded the following directive to HTTPAPI:
http_xmlReturnPtr(*ON);
This tells HTTPAPI that you do NOT want to receive a simple VARYING
field for your "value" parameter. Instead, you want to receive a data
structure in the following format:
D Element_Val_t ds qualified
D based(Template)
D buf *
D len 10i 0
This advantage to this method is that you can handle XML elements that
contain more than 65535 characters in their data. The disadvantage is
that the preceding data structure isn't as simple to work with as an RPG
VARYING string.
Anyway... you seemed to understand this perfectly when you wrote the
GetInnerDoc() routine. You seemed to understand quite clearly that you
had to use this data structure, and use it appropriately.
However, when you coded your Incoming() procedure, you seemed to have
forgotten this... you coded a simple VARYING string, and this is why
you are getting "garbage" in the parameter. You've coded the parameter
as a VARYING string instead of the data structure noted above.
Two possible fixes:
ALTERNATIVE #1:
Before your second XML parse, you could do this:
http_xmlReturnPtr(*OFF);
rc = http_parse_xml_stmf( filename
: HTTP_XML_CALC
: *null
: %paddr(Incoming)
Because you turned off the "return pointer" feature, HTTPAPI will go
back to giving you a simple VARYING field, so if you choose that
alternative, you can keep your incoming() procedure as-is.
ALTERNATIVE #2:
You can change your incoming() procedure to have the following prototype:
D Incoming PR
D userdata * value
D depth 10I 0 value
D name 1024A varying const
D path 24576A varying const
--> D value likeds(Element_Val_t) <--
D attrs * dim(32767)
D const options(*varsize)
Then you'd have to change your logic accordingly.
I hope you understand that these two fixes are /alternatives/ to each
other. Please don't try to do both of them at the same time (or you'll
end up with similar garbage in the parameter)
Good luck
janottar@xxxxxxxxxx wrote:
> Hi Scott.
> Thanks for your interest in my problems.
> Here is my test program that gives garbage in "value":
[SNIP]
> D Element_Val_t ds qualified
> D based(Template)
> D buf *
> D len 10i 0
>
> D GetInnerDoc PR
> D filename 50a varying
> D depth 10I 0 value
> D name 1024A varying const
> D path 24576A varying const
> D value likeds(Element_Val_t)
> D Attrs * dim(32767)
> D const options(*varsize)
>
> D Incoming PR
> D userdata * value
> D depth 10I 0 value
> D name 1024A varying const
> D path 24576A varying const
> D value 65535A varying const
> D attrs * dim(32767)
> D const options(*varsize)
[SNIP]
> http_xmlReturnPtr(*ON);
[SNIP]
> rc = http_parse_xml_stmf( filename
> : HTTP_XML_CALC
> : *null
> : %paddr(Incoming)
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------