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

http_url_post_raw encoding Issue



   Hi Scott,

   I am using http_url_post_raw. It works like a charm.

   The input to the server is in XML. During our testing we came across a
   scenario where the XML data had and "&" char for an element
   (<DESC>GENERAL & ACCESSORIES</DESC>).

   And we got the error response from the target Server as

   <ERROR DESCRIPTION>Unable to parse input XML entity reference names
   can  not start with character &apos; &apos; (position: START_TAG seen
   ...&lt;VALUE&gt;GENERAL &amp; ... @1:2497)</ERROR DESCRIPTION>

   I thought by using WEBFORM_setPtr & WEBFORM_postData the data gets
   converted to URL encoded data. But it did not convert my "&" char to
   &amp;. Is there any reason behind this or am I doing something wrong
   here. Below is my code for Ur reference:

               form = WEBFORM_open();
               WEBFORM_setPtr(form: 'instring': %addr(@XML_Input) :
                              %len(%trimR(@XML_Input)) );
               WEBFORM_postData(form: postData: postDataSize );
               // Post data and get document
               rc = http_url_post_raw(%trim(@ServerName)
                         : postData
                         : postDataSize
                         : 1
                         : %paddr('RECEIVEDATA')
                         : @HTTPPostTimeout
                         : *OMIT
                         : %trim(@URLEncodApp) );
               WEBFORM_close(form);
               if rc <> 1;
                 DS_HTTP_StatusData.HTTPErrDesc = 'HTTP Post Failed. ' +
                                                   http_error();
                 DS_HTTP_StatusData.ReturnCd    = HTTPPostFailed;
               Else;
                 callp Translate(retlen: retdata: 'QTCPEBC');
                 DS_HTTP_StatusData.XML_Response = %trim(retdata);
               endif;

   Please let me know.

   Thanks for your help.

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