[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: http_url_post_xml



OK, I changed my program to use the encoder.  Here is an excerpt of the 
code:

D  ADDRESS        S             50
D  ZIPCODE        S             15

Address   = '14 & AMPERSAND % CAREOF';
ZipCode   = '17721';

Enc = http_url_encoder_new();
http_url_encoder_addvar_s(enc:'ADDRESS' : Address);
http_url_encoder_addvar_s(enc:'ZIP_CODE': ZipCode);
EncodedInfo = http_url_encoder_getstr(enc);
http_url_encoder_free(enc);

--------------------------------------------------------------------
This is what variable EncodedInfo equaled afterwards:

'ADDRESS=14+%26+AMPERSAND+%25+CAREOF+++++++++++++++++++++++++'
'++&ZIP_CODE=17721++++++++++             '

I sent this using "http_url_post_xml", but it still didn't work.  If I 
replace all the plus signs with blanks, it does work.  Any ideas?

Thanks,

John




----- Original Message ----- 
From: "Michael Ryan" <michaelrtr@xxxxxxxxx>
To: "HTTPAPI and FTPAPI Projects" <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, October 16, 2008 1:13 PM
Subject: Re: http_url_post_xml


> Here's what I use...gratefully stolen from Scott! :) It's in one of
> the sample programs I think.
>
>          // data is a string that contains the XML document. It's a big 
> field.
>
>     D enc             s                   like(HTTP_URL_ENCODER)
>     D encoded_data    S               *
>     D encoded_len     S             10I 0
>
>          // URL encode the data.
>          enc = http_url_encoder_new();
>          http_url_encoder_addvar_s(enc: 'qf': 'xml');
>          http_url_encoder_addvar( enc
>                                 :'xmluser'
>                                 : %addr(data)
>                                 : %len(%trimr(data)) );
>
>          // Get a pointer to the URL encoded data.
>          http_url_encoder_getptr( enc
>                                 : encoded_data
>                                 : encoded_len);
>
>          // Post the data to the server.
>          nextpos = 1;           // Reset nextpos position.
>          rc = http_url_post_raw(
>                'https://theserver.com/integrate.aspx'
>                : encoded_data
>                : encoded_len
>                : 1
>                : %Paddr('INCOMING')
>                : HTTP_TIMEOUT
>                : HTTP_USERAGENT
>                : 'application/x-www-form-urlencoded');
>
> On Thu, Oct 16, 2008 at 12:42 PM, Scott Klement <sk@xxxxxxxxxxxxxxxx> 
> wrote:
>> Are you encoding your data via the "Webform" or "URL Encoder" routines?
>>
>> If you are already doing that, and it still causes the post to fail, can
>> you show me what that part of your code looks like, and how to reproduce
>> the failure?
>>
>> John Clark(Hotmail) wrote:
>>>    I am using http_url_post_xml to send name/value pairs(separated by an
>>>    ampersand) to a service provider.  There have been instances when an 
>>> %
>>>    or & have been part of the data being sent.  This seems to make the
>>>    post fail.
>> -----------------------------------------------------------------------
>> 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
> -----------------------------------------------------------------------
> 

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------