Access your MDS-SOA repository from your ADF application

In our Enterprise Landscape the SOA Services and our Canonical Data Model (CDM) live on a different WebLogic Server than our ADF application. But often we want to use these services and CDM in our ADF application. 
Calling WebServices from an ADF application is not that difficult, however, we often want to manipulate the result that comes from this WebService. In 90 percent of the time, this are little adjustments to the existing CDM that are UI specific. This knowledge is not something we want to put in our CDM or in our WebService, but in the ADF application. We decided to create an UI specific XSD and map the result from the WebService in CDM to this UI specific XSD. 
To accomplish this, we created an XSD that extends the existing XSD from the CDM. The problem with this approach was to reach the XSD from the CDM that lives on the SOA Server from our ADF Application that lives on our ADF Server. 

It turns out, you can configure the MetaData Repositories on your WebLogic Server to look at different servers. When logged in to the Enterprise Manager, you can go to the MetaData Repositories, now if you click on an existing MDS, you can go through to menu to Administration -> Register/Deregister:


In here you see an overview of both the database and the file based repositories.
Now you can click the Register button to register a new database MDS repository.


This will bring up the screen to register a database based metadata repository in which you need to provide the information of your SOA MDS where the CDM is found.


After filling in the information, press query and enter the repository name ‘mds-soa’ and fill in the correct password. Pressing the OK button will register this mds-soa metadata repository and will bring up the next screen:


In here it is very important not to forget to target the correct server on which you ADF application is running.
Once this has been set up, your ADF application will be able to connect on run time to your CDM that lives inside the soa-mds repository under the /soa-infra partition. Next you need to configure your ADF application to actually look for this repository. You do this in the adf-config.xml:


In the adf-config file you see the mds-config, here you tell the application to look for any mds repository starting with /apps to look in the ‘mstore-usage_2’ this mstore is defined below in the metadata-store-usage section.
You need to enter the partition-name, which is ‘soa-infra’, the metadata-path is used locally and points to an environment variable. When deploying this application from JDeveloper, the deployment wizard understand that the MDS needs to be configured and it brings up the Deployment Configuration wizard:


In this wizard we select the mds-soa repository and select the correct repository and the correct partition. After this your ADF application will be able to resolve oramds urls and you can import XSDs from the CDM. As a result your ADF application specific XSD will be able to understand an import like this:


Meaning you can extend any XSD type defined in the CDM and make it UI specific for your needs.