Pages

Wednesday, March 7, 2012

Oracle SOA Suite - Generic plan file to deploy the composites to different environments


Oracle SOA Suite - Generic plan file to deploy the composites to different environments:

The deployment plan file can be used to change the run time configurations like WSDL endpoint, value of the partner link properties and the host details across the environments.
The below approach will help you to have one tokenized deployment plan file (template plan file) and build.properties file for each environments. The tokens will be replaced at deployment time based on the details available in the build.properties file corresponds to the particular environment. The generated deployment file needs to be attached to the composite.

Create a template plan file with tokenized properties that needs to be replaced with the build.properties file data - EAI_cfgplan_template.xml


<?xml version="1.0" encoding="UTF-8"?>
<SOAConfigPlan xmlns:jca="http://platform.integration.oracle/blocks/adapter/fw/metadata" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:orawsp="http://schemas.oracle.com/ws/2006/01/policy" xmlns:edl="http://schemas.oracle.com/events/edl" xmlns="http://schemas.oracle.com/soa/configplan">
<composite name="Test_Invoker | Test1_invoker">
<reference name="Test">
<binding type="*">
<property name="oracle.webservices.auth.password">
<replace>@server.password@</replace>
</property>
<property name="oracle.webservices.auth.username">
<replace>@server.username@</replace>
</property>
</binding>
</reference>
</composite>
<wsdlAndSchema name="Test1.wsdl|Test2.wsdl ">
<searchReplace>
<search>http://testserver:8000</search>
<replace>@server.protocol@://@server.host@/@server.port@</replace>
</searchReplace>
</wsdlAndSchema>
</SOAConfigPlan>

Create build property files for each environment


dev_build.properties
server.host= server1.com
server.port=7003
server.protocol=http
server.username=testuser
server.password=password
QA_build.properties
server.host= server1.com
server.port=7003
server.protocol=http
server.username=QAuser
server.password=password


Ant script to generate the actual plan files by filling the tokens in the template plan files from the environment property file - GeneratePlanFile.xml


<?xml version="1.0" encoding="iso-8859-1"?>
<project name="GeneratePlanfile" default="generatePlanfile" basedir=".">
<target name="generatePlanfile">
<delete>
<fileset dir="${basedir}" includes="EAI_cfgplan.xml"/>
</delete>
<copy file="${basedir}/EAI_cfgplan_template.xml" tofile="EAI_cfgplan.xml">
<filterchain>
<filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
<param type="propertiesfile" value="${basedir}/${envType}_build.properties"/>
<param type="tokenchar" name="begintoken" value="@"/>
<param type="tokenchar" name="endtoken" value="@"/>
</filterreader>
</filterchain>
</copy>
</target>
</project>

Execute the ant script, this will generate the actual Plan file required as shown below


ant -DenvType=dev -f GeneratePlanFile.xml

EAI_cfgplan.xml


<?xml version="1.0" encoding="UTF-8"?>
<SOAConfigPlan xmlns:jca="http://platform.integration.oracle/blocks/adapter/fw/metadata" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:orawsp="http://schemas.oracle.com/ws/2006/01/policy" xmlns:edl="http://schemas.oracle.com/events/edl" xmlns="http://schemas.oracle.com/soa/configplan">
<composite name="Test_Invoker | Test1_invoker">
<reference name="Test">
<binding type="*">
<property name="oracle.webservices.auth.password">
<replace>password</replace>
</property>
<property name="oracle.webservices.auth.username">
<replace>testuser</replace>
</property>
</binding>
</reference>
</composite>
<wsdlAndSchema name="Test1.wsdl|Test2.wsdl ">
<searchReplace>
<search>http://testserver:8000</search>
<replace>http://server1.com/7003</replace>
</searchReplace>
</wsdlAndSchema>
</SOAConfigPlan>






3 comments:

  1. Hi Albin,
    Thanks for sharing your thoughts, did you think of any alternatives to using multiple properties files in order to use a template config plan and generate the actual config plan?

    ReplyDelete
  2. Is it possible to change the revision attribute on the composite element using the config plan?

    ReplyDelete
    Replies
    1. I guess this is not possible through configuration plan.

      Even though we are able to change the revision number using configuration plan still we have to provide the revision number when deploying the code via JDeveloper or ANT script.

      Regards
      Albin I

      Delete