November 20, 2010

Deploying custom XPath to SOA Suite 11g

This post describes how to deploy a custom XPath function you may have written in Java to Oracle SOA Suite 11g.

1. Edit the following file:
$MW_HOME/Oracle_SOA1/soa/modules/oracle.soa.ext_11.1.1/classes/META-INF/ext-soa-xpath-functions-config.xml
2. Add both the following. Here, you are adding the namespace prefix and function declaration.
<soa-xpath-functions xmlns="http://xmlns.oracle.com/soa/config/xpath"
                     xmlns:aia="http://www.oracle.com/XSL/Transform/java/oracle.apps.aia.core.xpath.AIAFunctions"
                     xmlns:utl="http://www.oracle.com/XSL/Transform/java/com.collaxa.cube.xml.xpath.dom.functions.getDateTimeWithMilliseconds">

  <function name="utl:getDateTimeWithMilliseconds">
    <className>com.collaxa.cube.xml.xpath.dom.functions.getDateTimeWithMilliseconds</className>
    <return type="string"/>
    <params>
      <param name="formatString" type="string"/>
    </params>
  </function>
3. Copy your following JAR (e.g., customDateFunction.jar) to:
$MW_HOME/user_projects/domains/soa_domain/lib
4. In your code (e.g., transformation or assigns), the function may be called as followed:
utl:getDateTimeWithMilliseconds('')
You will have to use the same namespace prefix defined above:
xmlns:utl="http://www.oracle.com/XSL/Transform/java/com.collaxa.cube.xml.xpath.dom.functions.getDateTimeWithMilliseconds"
The way we have defined and configured it above makes the function available to all SOA components, such as BPEL and Mediator. Refer to the Oracle documentation to find out how you can make the function specific to a particular component.

1 comment: