I had a requirement to do decode a Base64 string in OSB. I did a search and every blogs explained to do it using Java class, but i don't wanted to use Java callout.
In hunt of a easier approach i was able to figure out that using XSLT java call to do the base64 decode. Then you don't have to do the proxy java callout, and also you can save yourself from trouble of uploading some custom jar file .
Lets see how to do it-
Base 64 decode can be done using the xslt function "decode".
The class "weblogic.apache.xerces.impl.dv.util.Base64" is available inside "com.bea.core.apache_1.3.0.1.jar"
Following namespace had to be used to make a successful call -
"http://www.oracle.com/XSL/Transform/java/weblogic.apache.xerces.impl.dv.util.Base64"
The above is under the weblogic package and was working till 12.2.1.2 but the same stopped working in 12.2.1.3 version.
For 12.2.1.3 found below which works perfectly fine. Also found that below namespace can be used in 12.1.3 and any of the above versions.
http://www.oracle.com/XSL/Transform/java/oracle.soa.common.util.Base64Decoder
Sample Code FYR-
====================
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc64="http://www.oracle.com/XSL/Transform/java/oracle.soa.common.util.Base64Decoder"
exclude-result-prefixes=" dc64 ">
<xsl:template match="/">
<Out>
<xsl:value-of select="dc64:decode('Your base64 string\variable\XPATH here')"/>
</fOut>
</xsl:template>
</xsl:stylesheet>
Happy coding, Happy learning :)
In hunt of a easier approach i was able to figure out that using XSLT java call to do the base64 decode. Then you don't have to do the proxy java callout, and also you can save yourself from trouble of uploading some custom jar file .
Lets see how to do it-
Base 64 decode can be done using the xslt function "decode".
The class "weblogic.apache.xerces.impl.dv.util.Base64" is available inside "com.bea.core.apache_1.3.0.1.jar"
Following namespace had to be used to make a successful call -
"http://www.oracle.com/XSL/Transform/java/weblogic.apache.xerces.impl.dv.util.Base64"
The above is under the weblogic package and was working till 12.2.1.2 but the same stopped working in 12.2.1.3 version.
For 12.2.1.3 found below which works perfectly fine. Also found that below namespace can be used in 12.1.3 and any of the above versions.
http://www.oracle.com/XSL/Transform/java/oracle.soa.common.util.Base64Decoder
Sample Code FYR-
====================
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc64="http://www.oracle.com/XSL/Transform/java/oracle.soa.common.util.Base64Decoder"
exclude-result-prefixes=" dc64 ">
<xsl:template match="/">
<Out>
<xsl:value-of select="dc64:decode('Your base64 string\variable\XPATH here')"/>
</fOut>
</xsl:template>
</xsl:stylesheet>
Happy coding, Happy learning :)