Wednesday, 25 January 2012

Deploying BPEL process to multiple environments

BPEL process can be directly deployed into Development instance from JDeveloper using the ANT script created by it. However this is not good practice to deploy into multiple environments (like TEST, QA, PRE-PROD & PROD) as the configuration properties typically vary from environment to environment. For example, the common error handling web service partner link URL for the production Environment is typically different from the one used in the testing environment.

Beginning with 10.1.3.1 release of SOA suite, customize ANT feature is provided using which we can specify property values for different environments in a single build file location. This task can be used as subtask of bpelc.

Below is sequence of steps to define the ANT ‘customize’ task and deploy BPEL to multiple environments:

Step1: Create environment specific .properties files:
1.Create configuration properties files for each environment with file names following notation of “build_$env.properties”:
Eg:
build_test.properties
build_qa.properties
build_pre-prod.properties
build_prod.properties

2.In each of these properties files, provide all the environment specific variables as follows:

# environment – TEST/QA/PRE-PRD/PRD
host_name=
xyz.us.xyz.com
port_number=9700
domain_name=default
rev=1.0
#Parameters for common Error handling
eh_domain_name=default
eh_rev=1.0
# --------------------------------------------------
# END OF FILE

Step2: Create build.xml with ant customization:
1.Copy build.xml from main folder to BPEL sub-folder

2.Modify this build.xml in BPEL sub-folder to point to the properties file:
Find the below property tag in build.xml:
<!--property file="${process.dir}/build.properties"/>Replace the above XML with the following:
<!--property file="${process.dir}/build_${env}.properties"/>
3.Define ANT ‘customize’ task to change the WSDL URL of a PartnerLink
Find the following target XML tag in the build.xml file under BPEL sub-folder:
<!--target name="compile">
<!--echo>
Compiling bpel process ${process.name
}, revision ${rev} 
<!--bpelc input="${process.dir}/bpel/bpel.xml" out="${process.dir}/output"
rev="${rev}" home="${bpel.home}"/>

Replace the above XML with the following to create customize task for all partner links in BPEL process
<!--target name="compile">
<!--bpelc input="${process.dir}/bpel/bpel.xml" out="${process.dir}/output"
rev="${rev}"home="${bpel.home}">
<!--customize>
<!--partnerLinkBinding name="CommonErrorHandling">
<!--property name="wsdlLocation">
http://${bpel_host}:${bpel_port}/orabpel/${eh_domain_name}/TestProcess/${eh_rev}/TestProcess?wsdl
<!--/property>
<!--/partnerLinkBinding>
<!--partnerLinkBinding name="CustomerUpsertProcess">
<!--property name="wsdlLocation">
http://${bpel_host}:${bpel_port}/orabpel/${domain}/CustomerUpsertProcess/${rev}/CustomerUpsertProcess?wsdl
<!--/property>

<!--/partnerLinkBinding>
<!--/customize> 
<!--/bpelc> 
<!--/target>

Step 3: Create custom target in main build.xml to direct to build.xml created & modified in Step2 above:
1. Add following target to {BPEL Process}/build.xml file
<!--target name="compile1">
<!--echo>
Compiling bpel process with following ${
process.name}/bpel/build.xml file
<!--ant dir="${process.dir}/bpel"/>
<!--/target>

2.Modify process-deploy target to invoke the new compile1target created in above:
Find following target xml tag in {BPEL Process}/build.xml file
<!--target name="process-deploy"
depends="validateTask, compile, deployProcess, deployTaskForm, deployDecisionServices" />
Replace it with the following:
<!--target name="process-deploy"
depends="validateTask, compile1, deployProcess, deployTaskForm, deployDecisionServices" />
3.Change property file value of XML in the build.xml file under {BPEL Application} folder:
Find following property xml tag in {BPEL Process}/build.xml file
<!--property file="${process.dir}/build.properties"/>Replace it with the following:
<!--property file="${process.dir}/build_${env}.properties"/>
Step4 : Use ANT and deploy the BPEL process to respective environment:
Make sure to modify the ant property env= test/qa/pre-prod/prod depending on environment before deploying

No comments:

Post a Comment