Dynamic Value Mapping in OSB via Custom XPaths
OSB 11g R1 does not have DVM support. Now this is perfectly fine for clients who are using DVMs as part of the SOA Composites. But considering the fact that Oracle Mediator 11g has DVM functionality, and that many clients would have a migration path from Mediator based artifacts to OSB 11g, this can be a problem.
Clients can wait till Oracle releases the official support or resort to some ad hoc measures. Let’s look at such a solution. The solution is based on custom OSB XPaths.
1. An OSB Proxy Service DVMLookup exposes DVMs and is based on the following xml input:
This matches closely with the Oracle SOA 11g DVM lookup XPAth lookupValue(DVM_TABLE_NAME,SOURCE_COLUMN_NAME,SOURCE_COLUMN_VALUE,TARGET_COLUMN_NAME,DEFAULT_VALUE)
2. The customer DVMs can be added to the CommonServices/DVMs
3. This Service gets called via a Java class that is exposed as an OSB Custom XPath. The signature for the method call is
public static String lookupValue(String DVMTableName,String SourceColumnName,String SourceColumnValue,String TargetColumnName,String DefaultValue)
4. The dvm-custom xpath config file looks like this:
1. Download the package DVMLookup.zip. This contains the following:
a. OSB_Artifacts.jar: Contains the OSB Artifacts CommonServices and TestDVMLookup
b. CustomXPath : Contains the custom xpath components viz. dvm-custom.xml, dvmLookup.jar and dvm-custom.properties
c. SimpleDVMLookup: Contains the Eclipse project for the dvmLookup Java classes
2. Deploy the CommonServices and TestDVMLookup in OSB. In addition import these projects into OEPE.
3. Copy all the contents of CustomXPath into the location %OSB_HOME%/config/ xpath-functions
4. Restart Weblogic and OEPE. Weblogic admin startup log should show the DVM client successfully initiated
5. OEPE should show the custom xpath as follows:
III. Post – Installation Checks
1. The current Setup contains a predefined set of DVMs within CommonServices/DVMs folder:
2. Test the DVMLookup proxy service within DVMLookupTest /DVMTest with the following input in the body
3. The result response should be:
This completes the Post installation check
1. As already mentioned, the CommonServices/DVMs contains predefined DVMs. You would now need to insert your own dvms. Open your existing DVM and create a new XQuery Resource within the CommonServices/DVMs folder in OEPE or the OSB Console. You can use of the existing DVMs to insert your own values or copy the values in the template dvms, create a new XQuery Resource , paste the values and then modify the XQuery Resource with your own values.
2. The LoadDVM stage of the proxy loads the DVM based on the DVM Table name. Hence, you have to add another else-if condition to insert the new DVMTable you just created.
1. A typical XSLT transformation with the DVM Xpath looks like this:
2. Clearly, the only change is the namespace of the XPAth function. The new namespace is:
3. Each lookup call takes an average of 7 ms on a 4 GB Intel Core2 Duo@2.40 GHz running Weblogic Server and OSB. This would definitely perform a lot better in production boxes. To check for the exact lookup time, please execute the dvmLookup.jar on the installed machine. The default run tests for 100 lookups on one of the predefined DVMs.
java –jar %OSB_HOME%/config/xpath-functions/dvmLookup.jar
1. DVMLookup Package (500 KB)
2. PDF whitepaper (200 KB)