Monday, 20 April 2015

How to remove contents from MDS repository



Oracle SOA 11G MDS used as a shared repository for managing and reusing shared resources like WSDL, XSD, DVM, XREF, FAULT-POLICIES and CONSTANTS across applications.
Here below are the WLST commands to import , export and delete contents from MDS

1. Execute wlst.cmd :


cd ${ORACLE_HOME}/oracle_common/common/bin

Execute wlst.sh file:
----------------------
wlst.cmd


2. Connect to WL Server :



connect('weblogic','welcome1','t3://localhost:7001')(if you have only adminserver)

connect('weblogic','welcome1','t3://localhost:8001') (if you have managed server)



3. Import Contents to MDS :



Import all files and folder :
-----------------------------
importMetadata(application='soa-infra',server='soa_server1',
               fromLocation='C:/Oracle/Middleware1/jdeveloper/integration/seed',docs='/apps/**')

Import files under specified directory to MDS:
----------------------------------------------
importMetadata(application='soa-infra',server='soa_server1',
           fromLocation='C:/Oracle/Middleware1/jdeveloper/integration/seed',docs='/apps/DVM/**')
importMetadata(application='soa-infra',server='soa_server1',
           fromLocation='C:/Oracle/Middleware1/jdeveloper/integration/seed',docs='/apps/XREF/**')

Import specific file to MDS:
---------------------------------
importMetadata(application='soa-infra',server='soa_server1',
               fromLocation='C:/Oracle/Middleware1/jdeveloper/integration/seed',
               docs='/apps/util/DVM/samplecountry.dvm')

 

4. Export Contents from MDS :


Export all files and folders from MDS:
--------------------------------------
exportMetadata(application='soa-infra', server='soa_server1',
               toLocation='C:/Oracle/Middleware1/jdeveloper/integration/seed', docs='/**')

Export all files and folders inside "/apps" folder :
----------------------------------------------------
exportMetadata(application='soa-infra', server='soa_server1',
              toLocation='C:/Oracle/Middleware1/jdeveloper/integration/seed', docs='/apps/**')

Export specific folder :
-----------------------
exportMetadata(application='soa-infra', server='soa_server1',
               toLocation='C:/Oracle/Middleware1/jdeveloper/integration/seed', 
               docs='/apps/util/fault-policies/**')
exportMetadata(application='soa-infra', server='soa_server1',
           toLocation='C:/Oracle/Middleware1/jdeveloper/integration/seed', docs='/apps/util/DVM/**')
exportMetadata(application='soa-infra', server='soa_server1',
           toLocation='C:/Oracle/Middleware1/jdeveloper/integration/seed', docs='/apps/util/XREF/**')

Export specific file:
---------------------
exportMetadata(application='soa-infra', server='soa_server1',
               toLocation='C:/Oracle/Middleware1/jdeveloper/integration/seed',
               docs='/apps/util/DVM/samplecountry.dvm')


5. Delete Contents from MDS :



Delete all files:
-----------------------------
deleteMetadata(application='soa-infra',server='soa_server1',docs='/apps/')

Delete files under specific folder:
-----------------------------------
deleteMetadata(application='soa-infra',server='soa_server1',
               docs='/apps/util/DVM')

Delete specific file:
---------------------
deleteMetadata(application='soa-infra',server='soa_server1',
               docs='/apps/util/DVM/samplecountry.dvm')


5. Delete Folder from MDS :



1. Go to ${ORACLE_HOME}/Oracle_SOA1/common/bin
2. Execute wlst.sh file.
3. wls:/offline>connect('weblogic','welcome1','t3://localhost:7011')
4. wls:/SOA-domain/serverConfig> sca_removeSharedData('http://localhost:8011',
                                    'DVM')
Example: sca_removeSharedData('http://<ManagerServerHost>:<ManagedServerPort>',
                              'DVM')

Just mention the any folder name inside root folder "/apps", that folder 
and files inside that folder will be deleted.




You can use asterisk(*) to specify more than one files e.g. to delete all files with names starting with Gen use 
deleteMetadata(application='soa-infra',server='soa_server1',docs='/apps/AIAMetaData/AIAComponents/ApplicationConnectorServiceLibrary/Gen*.wsdl')
Exception:
You may get the following exception
MDS-91002: MDS Application runtime MBean for "soa-infra" is not available. "deleteMetadata" operation failure.


Solution:
- Verify that your soa-infra is up and running and is on the correct server (Admin, soa_server1) as specified in the deleteMetadata() command 
- Verify that you've not fired the command to connect to other managed server during the steps to delete the file. If you connected firstly to SOA server, then to Admin Server and now you try to fire deleteMetadata(), it will give above error. Hence start again.




                                                                                                                                   By  
                                                                                                                    Deepthi reddy

Tuesday, 7 April 2015

DB based MDS and adf-config.xml

 DB based MDS and adf-config.xml



Version 11.1.1.6

JDeveloper can be used to connect to DB based MDS. The steps to create DB based MDS are -


  1. Create DB connection to DEV_MDS.
  2. Create MDS connection (DB based) while selecting the db connection created in first step.
  3. Add that MDS connection to the repository and you are ready to refer the artifacts from DB based MDS.


Sometimes if adf-config.xml is not correct you may face below error while opening the application.

Error: oracle.fabric.common.FabricException: oracle.mds.config.MDSConfigurationException: MDS-01330: unable to load MDS configuration document 

MDS-01329: unable to load element "persistence-config"
MDS-01370: MetadataStore configuration for metadata-store-usage "mstore-usage_2" is invalid. 
MDS-00011: unable to create configuration object or MDSInstance due to invalid configuration information: oracle.mds.exception.MDSException: MDS-01373: unable to retrieve password. 
MDS-01373: unable to retrieve password.



Make sure that mstore-usage is defined correctly. Pasting the correct adf-config.xml here -

<metadata-namespaces>
          <namespace path="/deployed-composites/default"
                     metadata-store-usage="mstore-usage_2"/>
          <namespace path="/soa/shared" metadata-store-usage="mstore-usage_3"/>
        </metadata-namespaces>
        <metadata-store-usages>
          <metadata-store-usage id="mstore-usage_2">
            <metadata-store class-name="oracle.mds.persistence.stores.db.DBMetadataStore">
              <property name="jdbc-userid" value="DEV_MDS"/>
              <property name="jdbc-password" value="password"/>
              <property name="jdbc-url"
                        value="jdbc:oracle:thin:@<ipaddress>:<port>:<SID>"/>
              <property name="partition-name" value="soa-infra"/>
            </metadata-store>
          </metadata-store-usage>
.....


modified above:

 <metadata-store-usages>
          <metadata-store-usage id="mstore-usage_1">
        <metadata-store class-name="oracle.mds.persistence.stores.db.DBMetadataStore">
              <property name="jdbc-userid" value="DEV_MDS"/>
              <property name="jdbc-password" value="system"/>
              <property name="jdbc-url"
                        value="jdbc:oracle:thin:@localhost:1521:XE"/>
              <property name="partition-name" value="soa-infra"/>
            </metadata-store>
          </metadata-store-usage>
        </metadata-store-usages>



My DB based MDS connection looks like:






my Folder structure in MDS conncetion lokks like :


                                                                                                                             

SOA 11g MDS - Share Common Artifacts

I am detailing the step-by-step instructions which allows for sharing of common artifacts (schema files/WSDLs) among SOA projects and more importantly helps in loose coupling of service bindings & remove service dependencies.

A typical use case is where the abstract WSDL definition of an external service can be stored in MDS and referenced from the SOA composite which will loosely couple the services and also guard against 'SOA Composite Invalidation' issues.

SOA 11g provides us with MDS repository (both file based & DB based) where common artifacts can be stored and referenced by all projects in the SOA infrastructure.

File based MDS is used during design/deploy time where as DB based MDS is used at run-time by the SOA infra. A configuration file named adf-config.xml that is part of every SOA project manages this partition mapping to be used by JDeveloper during design/deploy time.



All SOA projects that are deployed on the SOA infrastructure are stored in the MDS repository. If you create a connection from the JDeveloper 'Resource Palette' to the SOA MDS, there will be a 'deployed composites' folder which will contain all deployed artifacts.

MDS is created under <jdeveloper-home>/integration/seed directory. Default folder “soa” is used to store common system soa artifacts. All custom artifacts are supposed to be stored under a folder called “apps”, since this folder already exists in server.

Create directory structure under apps folder. In my case, I’ve created folder structure ../apps/cosdeaia/ApplicationConnectorServiceLibrary to store XML schema files. This ideally should match your schema structure.

1. First you go to your local 11g Jdeveloper installation folder. In my case it is C:\JDEV_HOME11.1.1.3\jdeveloper\integration\ folder (if you have already applied third party plugin patch provided by oracle then you will see seed folder by default with all previous configuration done). If not create a seed folder under integration folder.

2. Now create folder with name apps under seed (remember to create folder with name apps else you might face issue this oracle documents say i didn’t try out).

3. Under apps you can create your folder structure to place all your XSD, WSDL files.

4. We can create a SOA_MDS connection in Jdeveloper as below –

New Connections — > SOA-MDS Connection

5. The SOA-MDS connection can be created in two ways. One is File Based MDS and other is Data Based MDS.

MDS Setup

6. In Create SOA_MDS Connection window, select File Based MDS as Connection              Type for file based MDS connection, we will point to the local folder in our system               where all the WSDL and XSD files are placed as shown below. So when we use the wsdl         and xsd files in the  project, they will be referred from the local system.

MDS Setup

7. Click OK. Now the File Based MDS connection is created.


Connection Information for the MDS connection:
username: XXX_MDS (usually DEV_MDS) /SOA_MDS
password: xxxxxxxxx
MDS Partition: soa-infra
 

8. Lets see how to create DB based MDS connection. In Create SOA_MDS Connection window, select DB Based MDS as Connection Type for file based MDS connection.
 
 

 The file based MDS repository is generally the 'seed' partition under a typical JDeveloper install;

< JDev_Home>\integration\seed


Under this partition there is a root folder (soa) available by default which contains all the configuration files, schemas & WSDLs required by various different SOA components during design time. These files are also pre-deployed on the database MDS repository.

We are now free to create custom folders under the 'seed' partition to hold artifacts that are common references in a SOA environment. Generally, we create an 'apps' folder under the 'seed' partition which in turn holds various folders to hold various artifact types;
 Once the artifacts that needs to be shared/referenced are placed under the appropriate namespace (in this case 'apps'), we can let the SOA project in JDeveloper to point to MDS for these artifacts from a common location


 For DB Based MDS connection, we should have created all the schema for the weblogic in the database by running the Repository Creation Utility (RCU) wizard. After RCU execution, the DEV_MDS schema will get created in the database. We need to use the DEV_MDS schema connection and soa-infra as MDS Partition while creating the DB Based MDS connection as shown in the above screen shot.( Get in touch with your DBA for MDS schema credentials)

Click OK. Now the DB Based MDS connection is created.

Deploy MDS repository to Weblogic Server
First, we need to create JAR file bundle to include schemas,WSDL's  we need. Then we need to include this jar file into a SOA bundle that can be deployed to the SOA Server.

In JDeveloper Create Generic Application - MediatorMetaData




Create a project – MediatorLib

Right click on MediatorLib and select New –> Deployment Profile –> JAR File



Enter mediatorlib as the deployment profile name.





In the JAR deployment properties dialog, click on Contributors, click on Add button and select apps directory from your JDeveloper seed location – JDEV_HOME/integration/seed/apps  As for below screenshots





Click on OK. This completes creation of JAR file. We now need to create an application deployment profile to install these schemas in SOA Server.

Right click on MediatorMetaData application and select Deploy –> New Deployment Profile. Select “SOA Bundle” as Profile type.



Enter mediatorlib for Deployment Profile Name. From the properties dialog, open Dependencies and select mediatorlib.




To deploy MediatorLib to SOA Server, right click on MediatorMetaData and select Deploy –> mediatorlib.