This article is dedicated to the dealing of opaque payloads in Oracle SOA Suite 11g.
In some of the real world scenarios where the message format is not predictable from a resource adapter we have to go for Opaque Schema definition . In the BPEL 10g implementation we have to use the java class Base64Decoder in a java embedding activity to decode the opaque payloads , in 11g eventhough the implementation is same , the class that we have to import for this purpose differs from that of 10g.
In 10g we have to import the class
com.collaxa.common.util.Base64Decoder to decode a given Opaque message in Base64 format . However in 11g SOA Suite , we have to go for the class
oracle.soa.common.util.Base64Decoder to acheive the desired functionality . Same is the case with the class Base64Encoder.
Here is the snippet of the jave embedding code used in our 11g BPEL project..
<bpelx:exec import="java.util.*"/>
<bpelx:exec import="java.lang.*"/>
<bpelx:exec import="java.math.*"/>
<bpelx:exec import="java.io.*"/>
<bpelx:exec import="oracle.soa.common.util.Base64Decoder"/>
<bpelx:exec name="DecodeBase64InputToString" language="java" version="1.5">
<![CDATA[
try
{
String input = ((oracle.xml.parser.v2.XMLElement)getVariableData("RcvInput_Read_InputVariable","opaque","/ns2:opaqueElement")).getFirstChild().getNodeValue();
Base64Decoder Decoder = new Base64Decoder();
String decodedMessage = Base64Decoder.decode(input).replaceAll("&", "&");
setVariableData("decodedInputVariable",decodedMessage);
}
catch(Exception e)
{
e.printStackTrace();
}
]]>
</bpelx:exec>
where RcvInput_Read_InputVariable is the BPEL variable holding the Opaque message and decodedInputVariable is the BPEL Variable which contains the final decoded string .
In the second part of this post , I will explain you the way the decoded string is used in XML transformations.
Hope this post would be of some help to you.
Have a nice day...