Thursday 11 July 2013

Environment variables substitution in soa deployment plan

PROBLEM
---------------
1. Create a 'hello world' composite calling another hello1 composite
2. Create a deployment plan:
Jdeveloper -> composite.xml -> right click -> Generate deployment plan.
3. In the deployment plan change from
<replace>http://host:8001/soa-infra/services/default/hello1/bpelhello1_client_ep?WSDL</replace>
to
<replace>http://host:8001/soa-infra/services/default/${my_composite}/bpelhello1_client_ep?WSDL</replace>

where hello1 is changed to ${my_composite} as documented here:

4. Deploy composite.
5. Start soa_server with the following option: -Dmy_composite=hello1


During runtime the following error occurs:

<remoteFault>
<part  name="summary">
<summary>oracle.fabric.common.FabricException: Cannot read WSDL
"{http://xmlns.oracle.com/bpel_owsm_osb/hello1/BPELHello1}bpelhello1_client_ep" from Metadata Manager.: mdm-url-resolver.xml not loaded</summary>
</part>
<part  name="detail">
<detail>mdm-url-resolver.xml not loaded</detail>
</part>
</remoteFault>

SOLUTION:
---------
There are two ways to load custom properties :

OPTION 1: via System Property :oracle.soa.url.resolver.properties.file
-----------------------------------------------------------------------
Use the following system property
-Doracle.soa.url.resolver.properties.file={path_to_properties_xml}
[e.g
-Doracle.soa.url.resolver.properties.file=C:\properties.xml
]

The structure of the properties.xml would be :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<entry key="{key_name}">{value}</entry>
</properties>

[e.g
<entry key="my_composite">hello1</entry>
]


NOTE:
-----
1. We can add multiple key-value pair as multiple <entry> elements.
2. If the SOA server is being started using command line , then the system
property -Doracle.soa.url.resolver.properties.file={path_to_properties_xml}
needs to be added to JAVA_OPTIONS in startManagedServer.sh(bat)

3. If the SOA server is being started from WLS console , then the system
property -Doracle.soa.url.resolver.properties.file={path_to_properties_xml}
needs to be added to java start parameters

OPTION 2: via mdm-url-resolver.xml in fmwconfig directory
---------------------------------------------------------
Create file mdm-url-resolver.xml under {SOA_DOMAIN}\config\fmwconfig
The structure of the  mdm-url-resolver.xml  would be same as properties.xml
from OPTION 1

Restart SOA server for the changes to take effect.


NOTE:
-----
SOA first attempts to load the property file from the path specified using
oracle.soa.url.resolver.properties.file system property.
If it fails to find the system property then it attempts to load the property
file from {SOA_DOMAIN}\config\fmwconfig\mdm-url-resolver.xml.
If we decide to use OPTION 2 , then we should not set the system property.

No comments:

Post a Comment