Lets examine how to create a MDS repository for new project. We need to following steps for creating and updating MDS
Adding files to MDS:
Step 1: Run RCU by checking the MDS which will create required tables for MDS
Step 2: Create MDS db connection from JDeveloper
Step 3: Create jar file in Jdeveloper and have all the required resources to be uploaded to MDS. (Will provide screenshot and explain it later)
Step 4: Deploy the Application (not jar project created in step 1!)
Step 5: Refresh the MDS DB in Jdeveloper, you will see all the required files.
Updating MDS Files:
Step 1: First download the MDS files from the EM to the jar project which was created in step 1 above.
To download mds file navigate to:
soa-infra -> Adminstration -> MDS Configuration -> and then on the right side of the screen: Import.
Step 2: Update the any file in the jar file and add additional schemas/wsdl.
Step 3: Deploy the Application. Done
-----------------------------------------------------------------------------------------------------------------
Step 3 of creating jar file with soa-bundle is explained Antony here
Creating Shared Resources in a JDeveloper Project
First lets create a JDeveloper project and put our shared resources into that project. To do this
- In a JDeveloper Application create a New Generic Project (File->New->All Technologies->General->Generic Project)
- In that project create a New Folder called apps (File->New->All Technologies->General->Folder) – It must be called apps for local File MDS to work correctly.
- In the project properties delete the existing Java Source Paths (Project Properties->Project Source Paths->Java Source Paths->Remove)
- In the project properties a a new Java Source Path pointing to the just created apps directory (Project Properties->Project Source Paths->Java Source Paths->Add)
Having created the project we can now put our resources into that project, either copying them from other projects or creating them from scratch.
Create a SOA Bundle to Deploy to a SOA Instance
Having created our resources we now want to package them up for deployment to a SOA instance. To do this we take the following steps.
- Create a new JAR deployment profile (Project Properties->Deployment->New->Jar File)
- In JAR Options uncheck the Include Manifest File
- In File Groups->Project Output->Contributors uncheck all existing contributors and check the Project Source Path
- Create a new SOA Bundle deployment profile (Application Properties->Deployment->New->SOA Bundle)
- In Dependencies select the project jar file from the previous steps.
- On Application Properties->Deployment unselect all options.
The bundle can now be deployed to the server by selecting Deploy from the Application Menu.
Create a Database Based MDS Connection in JDeveloper
Having deployed our shared resources it would be good to check they are where we expect them to be so lets create a Database Based MDS Connection in JDeveloper to let us browse the deployed resources.
- Create a new MDS Connection (File->All Technologies->General->Connections->SOA-MDS Connection)
- Make the Connection Type DB Based MDS and choose the database Connection and parition. The username of the connection will be the <PREFIX>_mds user and the MDS partition will be soa-infra.
Browse the repository to make sure that your resources deplyed correctly under the apps folder. Note that you can also use this browser to look at deployed composites. You may find it intersting to look at the /deployed-composites/deployed-composites.xml file which lists all deployed composites.
Create an File Based MDS Connection in JDeveloper
We can now create a File based MDS connection to the project we just created. A file based MDS connection allows us to work offline without a database or SOA server. We will create a file based MDS that actually references the project we created earlier.
- Create a new MDS Connection (File->All Technologies->General->Connections->SOA-MDS Connection)
- Make the Connection Type File Based MDS and choose the MDS Root Folder to be the location of the JDeveloper project previously created (not the source directory, the top level project directory).
We can browse the file based MDS using the IDE Connections Window in JDeveloper. This lets us check that we can see the contents of the repository.
Using File Based MDS
Now that we have MDS set up both in the database and locally in the file system we can try using some resources in a composite. To use a WSDL from the file based repository:
- Insert a new Web Service Reference or Service onto your composite.xml.
- Browse the Resource Palette for the WSDL in the File Based MDS connection and import it.
- Do not copy the resource into the project.
- If you are creating a reference, don’t worry about the warning message, that can be fixed later. Just say Yes you do want to continue and create the reference.
Note that when you import a resource from an MDS connection it automatically adds a reference to that MDS into the applications adf-config.xml. SOA applications do not deploy their adf-config.xml, they use it purely to help resolve oramds protocol references in SOA composites at design time. At runtime the soa-infra applications adf-config.xml is used to help resolve oramds protocol references.
The reason we set file based MDS to point to the project directory rather than the apps directory underneath is because when we deploy SOA resources to MDS as a SOA bundle the resources are all placed under the apps MDS namespace. To make sure that our file based MDS includes an apps namespace we have to rename the src directory to be apps and then make sure that our file based MDS points to the directory aboive the new source directory.
Patching Up References
When we use an abstract WSDL as a service then the SOA infrastructure automatically adds binging and service information at run time. An abstract WSDL used as a reference needs to have binding and service information added in order to compile successfully. By default the imported MDS reference for an abstract WSDL will look like this:
<reference name="Service3"
ui:wsdlLocation="oramds:/apps/shared/WriteFileProcess.wsdl">
<interface.wsdl interface="http://xmlns.oracle.com/Test/SyncWriteFile/WriteFileProcess# wsdl.interface(WriteFileProcess)"/>
<binding.ws port="" location=""/>
</reference>
Note that the port and location properties of the binding are empty. We need to replace the location with a runtime WSDL location that includes binding information, this can be obtained by getting the WSDL URL from the soa-infra application or from EM. Be sure to remove any MDS instance strings from the URL.
The port information is a little more complicated. The first part of the string should be the target namespace of the service, usually the same as the first part of the interface attribute of the interface.wsdl element. This is followed by a#wsdl.endpoint and then in parenthesis the service name from the runtime WSDL and port name from the WSDL, separated by a /. The format should look like this:
{Service Namespace}#wsdl.endpoint({Service Name}/{Port Name})
So if we have a WSDL like this:
<wsdl:definitions
…
targetNamespace=
"http://xmlns.oracle.com/Test/SyncWriteFile/WriteFileProcess">
… <wsdl:service name="writefileprocess_client_ep">
<wsdl:port name="WriteFileProcess_pt"
binding="client:WriteFileProcessBinding">
<soap:address location=… />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Then we get a binding.ws port like this:
http://xmlns.oracle.com/Test/SyncWriteFile/WriteFileProcess# wsdl.endpoint(writefileprocess_client_ep/WriteFileProcess_pt)
Note that you don’t have to set actual values until deployment time. The following binding information will allow the composite to compile in JDeveloper, although it will not run in the runtime:
<binding.ws port="dummy#wsdl.endpoint(dummy/dummy)" location=""/>
The binding information can be changed in the configuration plan. Deferring this means that you have to have a configuration plan in order to be able to invoke the reference and this means that you reduce the risk of deploying composites with references that are pointing to the wrong environment.