[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: http_url_encoder_addvar()
%09 is the ASCII code for a tab character. Any chance that you've
accidentally hit tab when typing in your XML?
-SK
On 6/29/2012 8:25 PM, Donnie Sanders wrote:
All,
This is my first attempt at posting data to a HTTP server and using
http_url_post_xml.
I believe my problem is that I'm getting an unexpected %09X inserted in
my field when using http_url_encoder_addvar().
Here's the related code:
tst2 D enc s like(HTTP_URL_ENCODER)
tst2 D encoded_data S *
tst2 D encoded_len S 10I 0
d xmlData s 65535a varying
tst2 // URL encode the data.
tst2 enc = http_url_encoder_new();
tst2 http_url_encoder_addvar_s(enc : 'service' : 'imessage_send');
tst2 http_url_encoder_addvar_s(enc : 'cid' : %trim(pUserID));
tst2 http_url_encoder_addvar_s(enc : 'pw' : %trim(pPassword));
tst2 http_url_encoder_addvar( enc
tst2 : 'xml'
tst2 : %addr(xmlData)
tst2 : %len(%trim(xmlData)) );
tst2 // Get a pointer to the URL encoded data.
tst2 http_url_encoder_getptr( enc
tst2 : encoded_data
tst2 : encoded_len);
rc = http_url_post_xml ( %trim(pAddress)
: encoded_data
: encoded_len
: *null
: %paddr(EndOfElement)
: *null
: HTTP_TIMEOUT
: HTTP_USERAGENT
: 'application/x-www-form-urlencoded');
tst2 http_url_encoder_free(enc);
In debug, the beginning of xmlData looks like:
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE pnet_imessage_send
PUBLIC"-//PeopleNet//pnet_imessage_send""[1]http://open.peoplenetonline
.com/dtd/pnet_imessage_send.dtd">
The beginning of encoded_data looks like:
service=imessage_send&cid=1111&pw=password&xml=%09X%3C%3Fxml+version%3D
%221.0%22+encoding%3D%22ISO-8859-1%22%3F%3E
Am I correct in expecting it to look like this?
service=imessage_send&cid=1111&pw=password&xml=%3C%3Fxml+version%3D%221
.0%22+encoding%3D%22ISO-8859-1%22%3F%3E
Thanks in advance,
Donnie
References
1. http://open.peoplenetonline.com/dtd/pnet_imessage_send.dtd
-----------------------------------------------------------------------
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
-----------------------------------------------------------------------