Importing SOA 11g standard XPath Functions into OSB 11g

Ok, so heres the problem. OSB 11g and SOA 11g XPath functions are not in Sync.  So, XSLTs that were developed in SOA 10g cannot be used directly in OSB 11g. One of the strong cases for this is the migration of all ESB based artifacts to OSB artifacts.

One of the easiest  ways of doing  this is to take all the xpath functions that are defined in the soa-xpath-exts.jar and soa-xpath-functions-config.xml and dump em into OSB XPath config as a Custom XPath. Here are the steps:

1. Get the fabric-runtime.jar and the soa-xpath-exts.jar from %SOA_HOME%\soa\modules\oracle.soa.fabric_11.1.1

2. Get the soa-xpath-functions-config.xml from %JDEVELOPER_HOME%\jdeveloper\integration\seed\soa\configuration. This file contains a list of all the XPath functions. We wont do anything to this….just for reference.

3. Now, get the osb-built-in.xml and osb-built-in.properties files from%OSB_HOME%\config\xpath-functions. Create copies of these files. We will modify these copies to include the migrated XPath Functions.

4. Now the task is to map the XPath functions defined in soa-xpath-functions-config.xml to the copy of the osb-built-in.xml that you just built. Almost for all the XPaths the only thing that needs to be changed is <xpf:name>,<xpf:comment>,<xpf:namespaceURI>,<xpf:className> and the <xpf:method>. Rest of the elements can be safely kept as is. The mentioned five elements can be directly mapped from the soa-xpath-functions-config.xml. But note that OSB XPath functions doesnt support inner classes and there are a hell lot of inner classes in the soa-xpath-functions-config.xml. So inorder to get over this, you have to somehow get the source code of the custom xpath functions, check which method of a particular class gets called and use that in the <xpf:className> and the <xpf:method>.

5. Make sure you know the permitted java types when you specify the <xpf:method> as in the document:  http://download.oracle.com/docs/cd/E14571_01/doc.1111/e15866/custom_xpath.htm#CBADFJEG. Some of the methods cannot be used !!!

6. Also make sure that for each XPath defined in the copy of the osb-built-in.xml you have to specify the comments in the proeprties file as well.

7. After you are done, dump all the jars and the OSB custom XPath files into %OSB_HOME%\config\xpath-functions.

This is a lot of pain.. and it would definitely take a good 8 hours!!!

Anywayz, if you dont want to do all this re-engineering, you alternatively use the Nirvana package below 🙂 This package contains support for the XPaths listed here

Unzip the folder and copy everything to %OSB_HOME%\config\xpath-functions . Restart Weblogic and Workshop. Follow the Installation Instructions in the reference for more details.

XPath Nirvana is here!!!

These XPath functions have the same name as the standard SOA 10g functions, although the namespaces are different.

The usage of these functions are different for XSLT and XQuery.

  1. XQuery: The XPath functions listed in the table should be used alongwith the necessary namespaces. This means that you can directly drag from the Expressions window.
  2. XSLT: For use in XSLT expressions, the Java Method name of the custom XPath function should be used alongwith the necessary namespaces.

Examples:

Note the difference in usage for the format-date XPath in XQuery and XSLT:

XQuery:

<Result><formatDate>dat:format-date(‘2028-08-31T05:30:54+05:30′,’yyyy.MM.dd G HH:mm:ss z’)</formatDate></Result>

XSLT:

<xsl:stylesheet version=“1.0” xmlns:xsl=http://www.w3.org/1999/XSL/Transform&#8221; xmlns:dat=http://www.soa-utilities.com/osb/custom/xpath/utilties.xpath.extensions.DateFunctions&#8221;><xsl:template match=“/”>

<Result><formatDate><xsl:value-of select=dat:formatDate(‘2028-08-31T05:30:54+05:30′,’yyyy.MM.dd G HH:mm:ss z’)” /></formatDate></Result>

</xsl:template></xsl:stylesheet>

The full list of namespaces for each XPath can be found in here.

Enjoy!!

1. Custom XPath Functions Library

2. Installation Manual for Custom XPath Functions Library

3. Full List of Supported XPath Functions

Advertisements
Comments
2 Responses to “Importing SOA 11g standard XPath Functions into OSB 11g”
  1. Augustin Mateica says:

    Hi Sandeep,
    Great post you did.
    Do you know if i could import DVM:LookupValue xpath into OSB 11g?
    I took a look in bpm-service.jar and i couldn’t found Class responsible for that …

    Please reply my on augu_mathe@yahoo.com

    Thank you,
    Augustin

  2. ebru says:

    Hi Sandeep,
    i have copied all the files listed in the installation document under \Oracle_OSB1\config\xpath-functions and inserted the line xmlns:dat=”http://www.soa-utilities.com/osb/custom/xpath/utilties.xpath.extensions.DateFunctions” in the Jdev generated xslt file. but i have realised that when i try to access http://www.soa-utilities.com/osb/custom/xpath/utilties.xpath.extensions.DateFunctions from the browser i cannot connect the site. Neither my xslt works on OSB, i am getting OSB Replace action failed updating variable “body”: java.lang.NoSuchMethodException: For extension function, could not find method weblogic.apache.xpath.axes.WalkingIteratorSorted.format-date([ExpressionContext,] #STRING). error.
    Can you please recommend me anything that i can make my xformation work.
    thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: