Tuesday, August 31, 2010

Dealing with Opaque messages in 11g BPEL - Part2

Once the opaque message was decoded into a string , we faced another challenge of converting that string into a valid XML and use that XML in BPEL transformations. Here the problem is that the incoming XML often doesn't have a namespace!

So we did the following to make it usable in XSLT transformations



1.       Generated an XSD with the incoming XML and  added a custom targetnamespace to the that xsd
2.       Attached that namespace to the decoded string.
3.       Created a BPEL variable with the XSD generated in step1.
4.       Used oraext:parseXML function to parse the decoded string and assigned it to the BPEL variable created in step3.
5.       Used that BPEL Variable in a transformation.


Please write to me if you require the sample code.

Have a nice day.


Friday, August 27, 2010

Dealing with Opaque messages in 11g BPEL - Part1

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("&", "&amp;");
                        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...

Thursday, August 26, 2010

My first weBlog..

Hi All,

Well .. I recently started up on 11g Oracle SOA Suite  , Its been a difficult journey to digest the new concepts of 11g ,   especially for the ones who worked on 10g SOA Suite . So I dedicate this blog to my understanding of this new product and the issues I faced with Oracle SOA Suite 11g , the hottest product in the enterprise market now.

I wish my self all the very best... ;)

Surya..