IBM Sterling Transformation Extender

Sterling Transformation Extender

Come for answers, stay for best practices. All we're missing is you.


#Sterling
#Supplychain
 View Only

URLEncoding for XML file as data in HTTP adapter

  • 1.  URLEncoding for XML file as data in HTTP adapter

    Posted 04/06/10 10:41 PM

    Originally posted by: vickey


    Hi,

    Below is the mapping rule i have to call a HTTP URL using the HTTP adapter.

    PUT("HTTP",
    "-URL http://abcd.com/cgi-bin/acfiwp/iwp/service/prod.do -METHOD POST -TV -TYPE application/x-www-form-urlencoded","method=updatePrice&data="TEXT(product_price)"&BV_UseBVCookie=no")

    XML message is "<?xml version="1.0"?><ProductPrices><ProductPrice id="001904" list_price="92.00" list_type="CD"/></ProductPrices>"

    The group "product_price" is an XML. When the rule is executed, the response is http 200 OK.

    But the response I received is "XML Not Valid". I have analyzed using a proxy to see why the response says "XML is not valid"

    The reason for the failue is because of the below reason
    "URL encoding is normally performed to convert data passed via html forms, because such data may contain special character, such as "/", ".", "#", and so on, which could either: a) have special meanings; or b) is not a valid character for an URL; or c) could be altered during transfer."

    "http://www.permadi.com/tutorial/urlEncoding/"

    So, I have used a external URL encoder I have encoded the XML. The encoded file is as below
    "%3c%3fxml+version%3d%221.0%22%3f%3e%3cProductPrices%3e%3cProductPrice+id%3d%22001904%22+list_price%3d%2292.00%22+list_type%3d%22CD%22%2f%3e%3c%2fProductPrices%3e"

    My expectation on TYPE property in http adapter "-TYPE application/x-www-form-urlencoded" is to encode the data which has special characters etc as explained above.

    But that is not happening.

    Can some please direct me on how to achieve the URL encoding using the HTTP adapter.

    Thanks for the help.

    Regards,
    Ramakrishna.
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange