Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
5 replies Latest Post - ‏2013-09-11T13:05:09Z by dmmicale
RS_DP
RS_DP
31 Posts
ACCEPTED ANSWER

Pinned topic Data-type for dp:url-open

‏2013-09-10T13:11:59Z |

Hi Team,

 Need your inputs on below. I want to post a data to an Java Servlet. The format of the data is Name:Value(Base 64 encoded data). As mentioned the value is base 64 type of data.

 I am using url open as below :

 

<xsl:variable name="post_data" select="concat($Name,':',$Value)"/>

  <dp:url-open target="{$Url}" response="responsecode" data-type="base64" timeout="86400" http-method="post">
        <xsl:copy-of select="$post_data"/>
      </dp:url-open>

 I want to know if data-type as Base64 is correct or not as my entire post data is made up of two parts - NormalString+Base64 string.



Thanks.

Updated on 2013-09-11T14:00:32Z at 2013-09-11T14:00:32Z by RS_DP
  • dmmicale
    dmmicale
    25 Posts
    ACCEPTED ANSWER

    Re: Data-type for dp:url-open

    ‏2013-09-10T19:15:42Z  in response to RS_DP

    Setting the data-type to base64 tells DataPower that your input inside the url-open is base64 encoded and needs to be base64 decoded before transmitting over the wire.  Since you are mixing base64 with non-base64 this likely would not work.  You would need to dp:encode the normal string + base64.

    • RS_DP
      RS_DP
      31 Posts
      ACCEPTED ANSWER

      Re: Data-type for dp:url-open

      ‏2013-09-11T00:39:36Z  in response to dmmicale

      Thank You!

       What would be the impact if I set the data-type="xml" and send the Normal String + base64 encoded data. Basically, the URL where I want to POST this data does not expect it to be decoded over the wire as it has its own logic to decode it.

      • dmmicale
        dmmicale
        25 Posts
        ACCEPTED ANSWER

        Re: Data-type for dp:url-open

        ‏2013-09-11T00:48:52Z  in response to RS_DP

        data-type is specifically for DataPower because it needs to know how to interpret the data you are inputting (XML data-type would require a valid xml message).  DataPower will decode the base-64 you pass in and take that data to transfer over the wire.

        Just create a new variable or append to the existing that dp encodes

        <xsl:variable name="encoded_data" select="dp:encode($post_data,'base-64')"/>

        • RS_DP
          RS_DP
          31 Posts
          ACCEPTED ANSWER

          Re: Data-type for dp:url-open

          ‏2013-09-11T08:17:30Z  in response to dmmicale

          Thanks a lot. I checked the infocenter and found there are only 3 types supported for data-type="xml | base64 | filename". In case I do not have an valid xml or a file to be POSTED, the only way is to encode my data to base64 and then use the datatype as base64?