[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Consuming a web service -
Scott,
I didn't get the error on http_url_encoder_getstr()
I had the return value defined as 32767 varying same as example18. I
changed it to 65535 and I stopped getting the 'length or varying error'.
But of course I still wasn't getting the complete value so I downloaded
the beta version and used XmlReturnPtr(*on) as you suggested. I'm
writing the result to a stream file and it's working like a charm. This
is exactly what I wanted to do.
Thanks.
-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott
Klement
Sent: Tuesday, September 11, 2007 4:57 PM
To: HTTPAPI and FTPAPI Projects
Subject: Re: Consuming a web service -
Hi Bob,
I'm puzzled. I expect the XML parsing routine to simply discard data
that's more than 16383 characters (in version 1.20) or more than 65535
characters (in the current beta). It should NOT give you a 'length of
varying is out of range' error, and the limit should NOT be 32767.
Just to clarify, the above limits are limits PER ELEMENT, not for the
whole XML document. (which has no practical limit)
I know that there was a 'length of varying' error in the
http_url_encoder_getstr() API.... but that's not related to XML parsing.
Just to make sure we're on the same page... you aren't getting this
error from http_url_encoder_getstr(), right?
In the current beta version, I also provide the ability to return the
data to your end element handler as a POINTER... in that scenario, the
limit is 16mb instead of 64k (or 16k) which is usually sufficient for
even larger XML documents. However, this has seen very little testing,
and I could really use your help testing it out!
The other alternative (if you don't want to muck with beta code) is to
stop using HTTPAPI's XML parser. Instead, save the XML data to the IFS
(using http_url_post) and parse it by calling Expat directly, or by
using an alternative XML parser of your choice.
But, again, I'd love to have your help testing the new beta
capabilities. Download the beta from the following link:
http://www.scottklement.com/httpapi/beta/
To enable returning data to a pointer, change your program to call
http_XmlReturnPtr(*ON) prior to parsing the XML document. This signals
the XML parser to pass you a pointer instead of a VARYING string.
Then, the 'value' parameter that's passed to your end element handler
will no longer be a VARYING string. instead, it'll be a data structure
that consists of a pointer in the first 16 bytes, and a 4-byte binary
integer (10i 0 in RPG) that constains the length of the data at the
pointer. Ths integer is in bytes 17-20 of the data structure.
Unfortunately, since RPG doesn't natively support strings larger than
64k, you have to read the data from the pointer in chunks (or simply
write it to disk all at once, using the IFS write() API, since that API
has no such restriction)
Hope I explained that well enough...
Elko, Bob wrote:
> Scott,
>
> I've used example18 as a model for my own program.
>
> I have it working except that the length of the result being returned
> from the web service is often larger than 32767 bytes. (The result is
a
> stream file) so I'm getting the error "Length of varying length
variable
> is out of range."
>
> What can I do handle such a large result??
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------