Tuesday, February 15, 2011

Simple DVM sample in SOA 11g

DVM enables you to map from one vocabulary used in a given domain to another vocabulary used in a different domain.In this post we will go through how to create a light weight lookup service using DVM and mediator.In this example the service will return Nationality based on the country name.

1.Create a new SOA project with mediator.



2.Create a mediator with synchronous interface based on the below schema.


 <?xml version="1.0" encoding="UTF-8"?>  
 <schema attributeFormDefault="unqualified"  
       elementFormDefault="qualified"  
       targetNamespace="http://com.sample/LookUpUtilProcess/v1.0"  
       xmlns="http://www.w3.org/2001/XMLSchema">  
       <element name="process">  
             <complexType>  
                   <sequence>  
                         <element name="country" type="string"/>  
                   </sequence>  
             </complexType>  
       </element>  
       <element name="processResponse">  
             <complexType>  
                   <sequence>  
                         <element name="nationality" type="string"/>  
                   </sequence>  
             </complexType>  
       </element>  
 </schema>  


3.Right click on the project -->New -->Domain Value Map(DVM)



4.Provide a name for the DVM and put the initial entries  as below.





5.More Domains and domain valus can be added by opening the .dvm file in jdeveloper


6.Open the mediator and click on and add "static routing rule "



7.Select "Echo"


8.Click on Assign and use the dvm:lookupValue method to get the value from DVM.



For example, dvm:lookupValue("Nationality.dvm","Country",$in.request/inp1:process/inp1:country,"Nationality","Nationality Not Found")


Usage: dvm:lookupValue(dvmLocation as string, sourceColumnName as string, sourceValue as string, targetColumnName as string, defaultValue as string, (qualifierColumnName as String, qualifierValue as string)*))


9.Deploy the project and Test it with different inputs.

10.The SOA Composer is available in the below URL. http://hostname:port/soa/composer


11.The DVM can be opened and value can be changed at runtime from the soa composer without moving objects.