Today I got a query on XPath BPEL functions . For exception handling even though the function getFaultAsString() and getFaultName( ) is there Jdev is showing error when he is trying to use it. It is a valid doubt. Jdeveloper is not fully supporting all the XPath BPEL functions available to BPEL processes.
Most of these XPath BPEL functions have the namespace registered under “http://schemas.oracle.com/xpath/extension “ and prefix as “ora” .
So to make it work open your .bpel file in source mode and add the namespace with the prefix you want to use
For eg:
<process name="HelloWorld" targetNamespace="http://www.georgie.com/HelloWorld" xmlns:ora=”http://schemas.oracle.com/xpath/extension “
…….. />
In your operation insert the expression in the following syntax ora:getFaultAsString().
To know what all functions are available in your environment look into xpath-functions.xml under ORACLE_HOME/domains/default/config directory.
It is not mandatory all XPath BPEL functions will have the same namespace. I will explain where namespace can be obtained for a particular function below.
The getFaultAsString () function entry will look like the following. It will have the class name which will be providing the functionality. The property namespace-uri will give you the value of namespace and namespace-prefix will give you the prefix to be used while calling it in your bpel process(add entry in .bpel file)
Snippet from xpath-functions.xml
<function id="getFaultAsString">
<classname>com.collaxa.cube.xml.xpath.functions.system.GetFaultAsStringFunction</classname>
<comment><![CDATA[
The signature of this function is <i>ora:getFaultAsString()</i>.
]]></comment>
<property id="namespace-uri">
<value>http://schemas.oracle.com/xpath/extension</value>
<comment><![CDATA[Namespace URI for this function]]></comment>
</property>
<property id="namespace-prefix">
<value>ora</value>
<comment><![CDATA[Namespace prefix for this function]]></comment>
</property>
</function>
Similarly if you have installed AIA you can use the function in the expression using the following syntax aia:getErrorMessage('errorCode', 'localeString', 'delimiter')
Snippet from xpath-functions.xml after AIA installation
<function id="getErrorMessage" arity="3">
<comment><![CDATA[This function will lookup the error message resource bundle and
return a localized string for the input errorCode.
<p/>
The signature of the function is <i>
aia:getErrorMessage('errorCode', 'localeString', 'delimiter')</i>.
The arguments are: <ol type="1"> <li>errorCode - the error code.
<li>localeString - delimiter locale string <li>delimiter - </ol>]]></comment>
<classname>oracle.apps.aia.core.xpath.AIAFunctions$GetErrorMessage</classname>
<property id="namespace-uri"> <value>http://www.oracle.com/XSL/Transform/java/oracle.apps.aia.core.xpath.AIAFunctions</value>
<comment><![CDATA[Namespace URI for this function]]></comment>
</property>
<property id="namespace-prefix">
<value>aia</value>
<comment><![CDATA[Namespace prefix for this function]]></comment>
</property>
</function>
Cool right. When you need a custom functionality for example the AIA Excpetion handling functions implement the functionality in java.
Your Custom class should implement the com.oracle.bpel.xml.xpath.IXPathFunction interface and implement the method named call(context, args). The signature of this method is as follows:
Object call(IXPathContext context, List args)throws XPathFunctionException;
Compile these files and then place these classes in bpel classpath and add entries to xpath-functions.xml. That is what you call a plugin.
No comments:
Post a Comment