Oracle Service Bus using external Domain Value Mappings (DVM)

Guido Schmutz and Chris Tomkins already made great blogs which show us how to use Domain Value Maps in the Oracle Service Bus.

In my case i wanted to store my domain value maps on a central location (http) and not within my OSB Project itself.
My backend-system creates a new employee and returns with a resultcode. Based on the operation i used on the backendsystem and the resultcode i want to retrieve a ‘resourcebundle-code’ (frontend applications will retrieve messages based on this string) and some free-format message (just used to inform the client).

Jdeveloper

I used the next dvm (created in JDeveloper)

<?xml version="1.0" encoding="UTF-8" ?>
<!-- Generated by Oracle DVM Editor version 1.0 at [12/23/10 11:15 AM]. -->
<dvm name="return_code_dvm" xmlns="http://xmlns.oracle.com/dvm">
  <description>
  </description>
  <columns>
    <column name="Operation"/>
    <column name="ReturnCode"/>
    <column name="MeldingCode"/>
    <column name="MeldingTekst"/>
  </columns>
  <rows>
    <row>
      <cell>newEmployee</cell>
      <cell>1</cell>
      <cell>SAP-NEW-EMPLOYEE</cell>
      <cell>Employee created</cell>
    </row>
    <row>
      <cell>deleteEmployee</cell>
      <cell>2</cell>
      <cell>SAP-REMOVE-EMPLOYEE</cell>
      <cell>Employee removed</cell>
    </row>	
  </rows>
</dvm>

Put the dvm on a location on the webserver so we can retrieve it by use of the http protocol.

Eclipse

In Eclipse with the OSB plugin create a new OSB Project.

Create a new xquery

xquery version "1.0";
declare namespace xf = "http://tempuri.org/employee/transformations/2/";
(: declare variable $myOperation as xs:string :="newEmployee"; 🙂
(: declare variable $myReturnCode as xs:string :="1"; 🙂

declare function xf:dvmLookup($myOperation as xs:string, $myReturnCode as xs:string)
    as xs:string {
    	let $mydata := doc("http://localhost/return_code.dvm")
    	let $myCode := $mydata/*:dvm/*:rows/*:row[*:cell[1]=$myOperation and *:cell[2]=$myReturnCode]/*:cell[3]
    	let $myText := $mydata/*:dvm/*:rows/*:row[*:cell[1]=$myOperation and *:cell[2]=$myReturnCode]/*:cell[4]
    	return concat($myCode, ' xxx ',$myText)
};

declare variable $myOperation as xs:string external;
declare variable $myReturnCode as xs:string external;

xf:dvmLookup($myOperation,$myReturnCode)

The Xquery will have two input parameters on which i will do my selection on the dvm table.
The content of the dvm table itself i retrieve from my shared http location.

I didn’t make the selection very dynamic, for this have a look at the other articles.

Create a new Proxy Service and add an assign to call the xquery.

Select the xquery in the assign


Assign the result to a temp variable


Result of the lookup of the resultcode of the New employee operation


Result of the lookup of the resultcode of the Remove employee operation


The flow should look a bit like this. I used a simple proxy service with anyxml interface (with no routing) just for testing

Conclusion

With the doc() function we’re able to import the domain value map into our xqueries so we can execute the xpath selections on it.
I also tried to include the dvm in the osb project itself and then use the doc-function like “doc(return_code.dvm)”. This will result in a file not found error (haven’t really digged into this, to see what the correct location should be). When we use the function like doc(‘d:/workspace/myosbproject/dmv/return_code.dvm’) it will work.

Share this Post:
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

8 Responses to “Oracle Service Bus using external Domain Value Mappings (DVM)”

[…] Oracle Service Bus using external Domain Value Mappings (DVM … […]

commenter

Hi Eric,

Since we are using the doc function within the xquery, I think each time there will be a remote lookup at the dvm server for the dvm which might not be desired if performance is important. So if the dvm is fairly static it would be better to use service callout ( with result caching for the business service turned on) to retrieve the dvm and then pass it to the XQuery. However, this article shows usage of doc() function to retrieve remote artifacts which is quite nice.
Rgds
Atheek

commenter

Good note! thanks. Will send you a short note to discuss something.

commenter

Hello, I like your approach because of trying to centralize. We have alot of BPEL projects that we would like to migrate to OSB but an issue we have is that we can’t reuse the XSLs because of the heavy use of DVM. There have been promises of DVM being included in OSB. Has it been included in 11.1.1.5? If not, do you have any insight as to where it might be currently on the roadmap?

commenter

At the moment it isn’t included yet and i’m not sure if it will be in the next release. When i speak to someone of product management i will ask if they’re planning to include it in the next release.

[…] read the content of this file from some other external location by use of the doc() function, see this […]

commenter

Hi,

I tried deploying project with just DVM in it. But when I am trying to open it as HTTP url its not opening its giving some error as not found.

Could you please kindly help me with this?

Thanks.

Leave a Reply:

Name (required):
Mail (will not be published) (required):
Website:
Comment (required):
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>