Custom XPath in OSB 11g

There is already a documentation available for this cool new feature in OSB 11g to create custom XPath functions that can be used from the OEPE IDE or even from the Service bus console.

For the ones who have a touch time to understand the Oracle documentation, here is a brief tutorial.

Please refer to the Oracle Document here for the detailed steps:

I would start of by creating my own xml for my own custom function. I would name it custom-osb-xpath.xml with a corresponding .properties file associated with it. Here are the contents:


<?xml version=”1.0″ encoding=”UTF-8″?>
<xpf:xpathFunctions xmlns:xpf=””&gt;
<xpf:category id=”%CUSTOM_FUNCTIONS%”>
<xpf:method>java.lang.String concatString(java.lang.String, java.lang.String)</xpf:method>

%CUSTOM_FUNCTIONS%=Custom Service Bus Functions
%FUNC_CONC_COMMENT%=Returns a concatenated string based on the input strings. E.g. fn-bea:concatStrings($string1 as xs:string, $string2 as xs:string )

Place these files in OSB_ORACLE_HOME/config/xpath-functions directory of the OSB installation.

Now we would create a sample java class to concatenate two strings

package com.caterpillar.alsb.custom.xpath;

import java.lang.String;

public class StringConcat {

public static java.lang.String concatString(String stringa, String stringb)
String concatedStr= new String(stringa);
return concatedStr.concat(stringb);


Thats all we need. We are good to go now. Restart the OSB server or the Eclipse IDE. On booting them up we would start to see these custom functions added.

Here is a sample Xquery i created to use this custom XPath funtion
declare namespace xf = “;;

declare function xf:ConcatStrings($string1 as xs:string,
$string2 as xs:string)
as xs:string {

declare variable $string1 as xs:string external;
declare variable $string2 as xs:string external;



Simple but so useful!

2 thoughts on “Custom XPath in OSB 11g

  1. Pingback: Custom XPath Functions in OSB 11g to Lookup Shared DVMs « Oracle Technologies Premier

  2. Pingback: Lookup Shared DVM in OSB | Oracle Technologies Premier | jmmate JavaBlog

If you have any comments, suggestions or feedback about the post, please feel free to type it here and I will do my best to address them asap

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s