[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: http_url_post with http_url_encoder_getptr
Hello Antonio,
The problem is not with http_url_encoder_getptr(). the getptr() routine
returns strings much longer than 256 characters.
HOWEVER, I see that you're using http_url_encoder_addvar_s(). This
routine is limited to 256 characters of data per variable. The "_s" at
the end means that it's the "simplified" version of another
subprocedure.... The reason I made a simplified version is to make it
easy to use, at the expense of flexibility.
Basically, http_url_encoder_addvar_s() is a little easier to use, but it's
limited to 256 characters. By contrast, http_url_encoder_addvar() handles
unlimited size variables, but is a little more complicated to use.
Here's the code you sent:
> C eval tipo = 'MRO'
> C eval Enc = http_url_encoder_new
> c callp http_url_encoder_addvar_s( Enc
> c : 'xmlString'
> c : Xdoc )
> c callp http_url_encoder_addvar_s( Enc
> c : 'type'
> c : Tipo )
The problem with this code is that the "Xdoc" variable can be as large as
32k, but the addvar_s() procedure only lets you use 256.
The solution is to use http_url_encoder_addvar() instead. Try using the
following code for the Xdoc variable:
c callp http_url_encoder_addvar( Enc
c : 'xmlString'
c : %addr(Xdoc)
c : %len(%trimr(Xdoc)))
You can still use addvar_s() for the "tipo" variable, since that variable
is less than 256 bytes, it won't matter.
Also note that using http_url_encoder_addvar() lets you specify any
pointer you like, in this case I passed the address of the Xdoc variable
so that it'll read directly from that variable -- but if you wanted, you
could pass a pointer to dynamically allocated memory, or to a user space,
and you'd be able to encode data that's much larger than RPG's 64k
maximum.
Hope that helps...
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------