Monday, October 20, 2014

Working with Domain Value Maps (DVM) in SOA 11g

Hi, I want to Discuss About  Domain Value Maps(DVM) in Oracle SOA Suite 11g in this post

Domain Value Maps(DVM)  They enable you to map from one vocabulary used in a given domain to another vocabulary used in a different domain. For example, one domain may represent a city with a long name (Mumbai), while another domain may represent a city with a short name (MB). In such cases, you can directly map the values by using domain value maps. 
(or)
In Oracle SOA 11g When ever we integrate the two applications with different names and it gives same information. A general example one application contains a city name as Hyderabad and another application contains the same city name as Hyd, the both the applications are different domains. These type of situations we can use a domain value map between the two domains.

Domain value map values are static. You specify the domain value map values at design time using Oracle JDeveloper, and then at runtime, the domain value map columns are looked up for values.

Domain Value Map Features

Qualifier Support

Qualifiers qualify mappings. A mapping may not be valid unless qualified with additional information. For example, a domain value map containing a city code-to-city name mapping may have multiple mappings from KN to Kensington because Kensington is a city in both Canada and the USA. Therefore, this mapping requires a qualifier (USA or Canada) to qualify when the mapping becomes valid

Qualifier Support Example
Country (Qualifier)CityCodeCityName
USABOBoston
USABELG_NCBelgrade
USABELG_MN_StreamsBelgrade
USANPNorthport
USAKNKensington
CanadaKNKensington

Note: You can also specify multiple qualifiers for a domain value map
            Qualifier Order Support:- A qualifier order is used to find the best match during lookup at run time. Domain value maps support hierarchical lookup. If you specify a qualifier value during a lookup and no exact match is found, then the lookup mechanism tries to find a more generalized match by setting the higher order qualifiers to "". It proceeds until a match is found, or until a match is not found with all qualifiers set to "".
              One-to-Many Mapping Support:- You can map one value to a multiple values in a domain value map. For example, a domain value map for Payment Terms can contain mapping of payment terms to three values such as discount percentage, discount period, and total payment period.
Scenario:   
     In My example we use File Read and write Using DVM Logic 

After Completion of this scenario composite will look like this,


In the above Example Mediater Mediating All Incoming files to File Write Location based on below XSD,

<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns="http://www.example.org"
            targetNamespace="http://www.example.org"
            elementFormDefault="qualified">
  <xsd:element name="ListofOrder">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="Order" >
    <xsd:complexType>
    <xsd:sequence>
     <xsd:element name="OrderID" type="xsd:string" />
    <xsd:element name="basedata">
    <xsd:complexType>
    <xsd:sequence>
     <xsd:element name="CityCode" type="xsd:string" />
      <xsd:element name="CityName" type="xsd:string" />
       <xsd:element name="State" type="xsd:string" />
        <xsd:element name="Country" type="xsd:string" />
    
    </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="PricingData" maxOccurs="unbounded">
    <xsd:complexType>
    <xsd:sequence>
     <xsd:element name="Freightamount" type="xsd:string" />
      <xsd:element name="PricingData" type="xsd:string" />
       <xsd:element name="Taxamount" type="xsd:string" />
    
    </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

Step 1:  
Create .DVM FILE using  Right click on project -> Select SOA-> Transformation-> Domain Value Map . Give some name to domain value map file and give some name to the domain fields then click OK.

Step 2: Define File Name and Description for the DVM file you created.  Enter the Domain Name and Domain Value .Enter the Domain value to the particular domain name and click on OK



Step 3: Now we will get Domain value Map Editor

How to add columns to DVM
Click on Add Column 
Step 4: While you creating a Domain prompts you below window

The Create Domain Popup window  is displayed  
Enter the Name in the Name field
Select the True if you want to column as a Qualifier
Select Qualifier Order field enter a qualifier number (If you want enabled this field then select as true in Qualifier field)
Click on OK (As discussed in 
Domain Value Map Features)

Repeat same steps to create a Domain Country with Qualifier set to True
Step 5: Adding rows to DVM. Click on Add Domain Values


 Create Domain Value Map as below

Now DVM is used for Domain Value Mapping
1. Create the Project with Empty Composite 
2. Add File Adapter in Exposed Services (i.e used for Read file)
3. Add File Adapter in External Services (i.e used for Writing file)
4. The Two Adapter connect with the Mediator
Step-1:
Drag file Adapter to Exposed Services and do following steps










 Step-2:
Drag file Adapter to External References and do following steps








Step-3:Add the Mediator to the composite.xml and do wiring 


Double Click on Mediator

Click on transform using Icon
 



If you select the Advanced tab then you will get DVM Functions 
Now add lookupValue in the middle which element do you want lookup


When you double click on the DVM function Popup window will appear 


When you double click on the DVM function Popup window will appear 
Here Main step will raise 
Add dvmlocation, if you click on magnifying glass icon then you will add The domain value map URI.
Add sourceColumnName 
Add targetColumnName
Add defaultValue
Add qualifierColumnName 
Add qualifierValue



Specify values for the following fields in the Edit Function – lookupValue1M dialog:
  • In the dvmLocation field, enter the location URI of the domain value map file or clickBrowse to the right of the dvmLocation field to select a domain value map file. You can select an already deployed domain value map from the metadata service (MDS) and also from the shared location in MDS. This can be done by selecting the Resource Palette.
  • In the sourceColumnName field, enter the name of the domain value map column that is associated with the source element value, or click Browse to select a column name from the columns defined for the domain value map you previously selected.
  • In the sourceValue field, enter a value or press Ctrl-Space to use the XPath Building Assistant. Press the up and down arrow keys to locate an object in the list, and press Enterto select an item.
  • In the targetColumnName field, enter the name of the domain value map column that is associated with the target element value, or click Browse to select the name from the columns defined for the domain value map you previously selected.
  • In the QualifierCloumnName field,enter a value of the domain value map column that is associated with the qualifier  element value , or click Browse to select a column name from the columns defined for the domain value map you previously defied to be qualifier.
  •  In the QualifierValue nter a value or press Ctrl-Space to use the XPath Building Assistant. Press the up and down arrow keys to locate an object in the list, and press Enter to select an item.
Finally Transformation look like below.

Deploy the files in Server

Add xml to particular directory
If the value is correct the output XML file will be like this

If the value is not valid the output XML file will be like this







No comments:

Post a Comment