Friday, September 26, 2008

Creating customized partnerlink bindings for deployment in different environments

The problem
Every BPEL process has a bpel.xml(deployment descriptor) file that provides information about the partners the BPEL interacts with. It does so by providing a partnerLinkBinding tag for every web service that the process invokes. Essentially, this tag gives the absoulute location of the WSDL file that is referred to by that partnerlink. A typical binding looks like this

<partnerLinkBinding name="SayHi">
<property name="wsdlLocation">
http://nebulasky.blogspot.com:7777/orabpel/develop/SayHiService/1.0</property></partnerLinkBinding>

Notice that the WSDL URL contains tokens like host, port, domain and revision of your web service. Since these values will differ in different environments(development, test, and production), your partnerLinkBindings too will change for different enviroments. A typical solution would be to have different bpel.xml files for different environments. This is the easy way but cumbersome and error-prone.

The solution
Fortunately, there is another way and which is much more simple. A customize ant task is provided that enables you to specify the property value for development and production environments in a single build file location. The customize task captures the changes between different versions of bpel.xml using the build file. This task can be used as a subtask of bpelc or as a standalone ant task. This is the subject matter of this post.

Customize Ant Task
Follow these steps to achieve the customization.

1. Create a custom build.xml under the bpel directory of your project folder. Here you will specify WSDL URL contains tokens like host, port, domain and revision of your web service. Here is how the new build.xml will look like.

<?xml version="1.0" encoding="iso-8859-1"?>
<project name="bpel.deploy" default="compile" basedir=".">
<target name="compile">
<bpelc input="${basedir}/bpel.xml" out="${process.dir}/output" rev="${rev}" home="${bpel.home}">
<customize>
<partnerLinkBinding name="SayHiService">
<property name="wsdlLocation">
">http://${host_name}:${port_number/orabpel/${domain_name/SayHiService/${rev}/SayHiService?wsdl</property>
</partnerLinkBinding>
</customize>
</bpelc>
</target>
</project>

2. Specify values for the host name, port, domain name, and process revision properties in the SOA_Oracle_Home\bpel\utilities\ant-orapbel-properties file. Here is an extract from the

file.host_name=nebulasky.blogspot.com
port_number=7777

domain_name=develop
rev=1.0
# --------------------------------------------------
# END OF FILE

Now, this is the only file you need to edit to take care of BPEL process migrations among various environents.

3. Go to the main bpel.xml file located under the project folder and specify a new target to override the one that is already there in this file. Here the target name of compile is changed to compileTest.

<target name="process-deploy" depends="validateTask, compileTest, deployProcess, deployTaskForm, deployDecisionServices" />

Now you need to create a new target by the same name(compileTest) in the same file. Within this you will provide the location to the custom build.xml file you created a few steps before. This way you shall override the target that already exists in the old build.xml file.

<target name="process-deploy" depends="validateTask, compileTest, deployProcess, deployTaskForm, deployDecisionServices" />
<target name="validateTask">
<validateTask dir="${process.dir}/bpel" />
</target>
<target name="compileTest">
<ant dir="${process.dir}/bpel"/>
</target>
<target name="compile">

4. Save the project. If you are using Jdeveloper in some other machine than the one where the application server is running, you need to transfer the project to the machine running the server. once this is done deploy the project using Ant. Fire up the developer prompt and navigate to the project directory and issue the following command

ant process-deploy

5. Go to the Oracle BPEL Console and ensure that the process was deployed successfully.

1 comment:

Anonymous said...

I�m nοt that much of a onlinе
rеaԁеr to be honеst but your sites really nice, keep
іt up! І'll go ahead and bookmark your website to come back later. Many thanks

Feel free to visit my homepage; Dien thoai