Monday, September 27, 2010

Adding and removing files To and from MDS in SOA 11g

In this post we will see how can we add and remove files to MDS through ant script files.
First we have to create folder structure in ${wn.bea.home}\jdeveloper\integration\seed\soa [Ex: apps\PavanFolder1\PavanFolder2\ABC.wsdl]

${wn.bea.home}\jdeveloper\integration\seed\soa folder is the home folder for MDS repository.
By default we will see configuration and shared folder here.

Now create a folder with name (any location our wish) PavanFolder1 and place properties file, build.xml and .cmd file in this folder.

Now we have to give mds.applications value as PavanFolder1.

build.properties file:

# global
wn.bea.home=D:\Jdeveloper1113
oracle.home=${wn.bea.home}/jdeveloper
java.passed.home=${wn.bea.home}/jdk160_18
wl_home=${wn.bea.home}/wlserver_10.3
# temp
tmp.output.dir=c:/temp
mds.reposistory=D:/Jdeveloper1113/jdeveloper/integration/seed/soa/apps/
mds.applications=PavanFolder1
mds.undeploy=true
deployment.plan.environment=dev
# dev deployment server weblogic
dev.serverURL=http://localhost:8001
dev.overwrite=true
dev.user=weblogic
dev.password=welcome1
dev.forceDefault=true
# acceptance deployment server weblogic
acc.serverURL=http://localhost:8001
acc.overwrite=true
acc.user=weblogic
acc.password=welcome1
acc.forceDefault=true

build.xml file:

<?xml version="1.0" encoding="iso-8859-1"?>
<project name="soaDeployAll" default="deployMDS">
    <echo>basedir ${basedir}</echo>
    <property environment="env"/>
    <echo>current folder ${env.CURRENT_FOLDER}</echo>
    <property file="${env.CURRENT_FOLDER}/build.properties"/> 
    <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
    <target name="unDeployMDS">
        <echo>undeploy MDS</echo>
        <foreach list="${mds.applications}" param="mds.application" target="undeployMDSApplication" inheritall="true" inheritrefs="false"/>
    </target>
    <target name="deployMDS">
        <echo>undeploy and deploy MDS</echo>
        <if>
          <equals arg1="${mds.undeploy}" arg2="true"/>
          <then>
            <foreach list="${mds.applications}" param="mds.application" target="undeployMDSApplication" inheritall="true" inheritrefs="false"/>
          </then>
        </if>
        <foreach list="${mds.applications}" param="mds.application" target="deployMDSApplication" inheritall="true" inheritrefs="false"/>
    </target>
    <target name="deployMDSApplication">
        <echo>deploy MDS application ${mds.application}</echo>
        <echo>Directory ${mds.reposistory}</echo>
        <echo>remove and create local MDS temp</echo>
        <property name="mds.deploy.dir" value="${tmp.output.dir}/${mds.application}"/>
   
        <delete dir="${mds.deploy.dir}"/>
        <mkdir dir="${mds.deploy.dir}"/>
        <echo>create zip from file MDS store </echo>
      <zip destfile="${mds.deploy.dir}/${mds.application}_mds.jar" compress="false">
        <fileset dir="${mds.reposistory}" includes="**"/>
      </zip>
        <echo>create zip with MDS jar</echo>
      <zip destfile="${mds.deploy.dir}/${mds.application}_mds.zip" compress="false">
        <fileset dir="${mds.deploy.dir}" includes="*.jar"/>
      </zip>
        <propertycopy name="deploy.serverURL"    from="${deployment.plan.environment}.serverURL"/>
        <propertycopy name="deploy.overwrite"    from="${deployment.plan.environment}.overwrite"/>
        <propertycopy name="deploy.user"         from="${deployment.plan.environment}.user"/>
        <propertycopy name="deploy.password"     from="${deployment.plan.environment}.password"/>
        <propertycopy name="deploy.forceDefault" from="${deployment.plan.environment}.forceDefault"/>
        <echo>deploy MDS app</echo>
        <echo>deploy on ${deploy.serverURL} with user ${deploy.user}</echo>
        <echo>deploy sarFile ${mds.deploy.dir}/${mds.application}_mds.zip</echo>
        <echo>Oracle Home: ${oracle.home}</echo>
        <ant antfile="D:/Jdeveloper1113/jdeveloper/bin/ant-sca-deploy.xml" inheritAll="false" target="deploy">
             <property name="wl_home" value="${wl_home}"/>
           <!--  <property name="oracle.home" value="${oracle.home}"/>-->
             <property name="serverURL" value="${deploy.serverURL}"/>
             <property name="user" value="${deploy.user}"/>
             <property name="password" value="${deploy.password}"/>
             <property name="overwrite" value="${deploy.overwrite}"/>
             <property name="forceDefault" value="${deploy.forceDefault}"/>
             <property name="sarLocation" value="${mds.deploy.dir}/${mds.application}_mds.zip"/>
        </ant>
    </target>
    <target name="undeployMDSApplication">
        <echo>undeploy MDS application ${mds.application}</echo>
       <propertycopy name="deploy.serverURL"    from="${deployment.plan.environment}.serverURL"/>
        <propertycopy name="deploy.overwrite"    from="${deployment.plan.environment}.overwrite"/>
        <propertycopy name="deploy.user"         from="${deployment.plan.environment}.user"/>
        <propertycopy name="deploy.password"     from="${deployment.plan.environment}.password"/>
        <propertycopy name="deploy.forceDefault" from="${deployment.plan.environment}.forceDefault"/>
         <echo>undeploy MDS app folder apps/${mds.application} </echo>
         <ant antfile="D:/Jdeveloper1113/jdeveloper/bin/ant-sca-deploy.xml" inheritAll="false" target="removeSharedData">
              <property name="wl_home" value="${wl_home}"/>
           <!--   <property name="oracle.home" value="${oracle.home}"/>-->
              <property name="serverURL" value="${deploy.serverURL}"/>
              <property name="user" value="${deploy.user}"/>
              <property name="password" value="${deploy.password}"/>
              <property name="folderName" value="${mds.application}"/>
         </ant>
    </target>
</project>

deployMDS.cmd:

set ORACLE_HOME=D:\Jdeveloper1113
set ANT_HOME=%ORACLE_HOME%\jdeveloper\ant
set PATH=%ANT_HOME%\bin;%PATH%
set JAVA_HOME=%ORACLE_HOME%\jdk160_18
set CURRENT_FOLDER=%CD%
ant -f build.xml deployMDS


Now run this deployMDS.cmd.

Create a MDS connection in Jdev and now we can see apps folder along with configuration and shared folders, and the structure we have created in apps folder.

We can access the files we have placed in MDS in BPEL. We will see this in coming posts.


Regrads,
PavanKumar.M.V.S.S.S.S.

Sunday, September 26, 2010

Fault-policy frame work in SOA 11g

In this post we will discuss the fault-policy framework in SOA 11g.
Conceptual wise no changes in this release when compare to 10g. But some changes are there in placing these files and etc.

First of all this framework will work only for the faults at invoke activity.
To implement fault-policy framework we have to have two xml files called fault-bindings.xml and fault-policies.xml.

A fault policy bindings file associates the policies defined in a fault policy file with the SOA composite application or the component.

A fault policy file defines fault conditions and their corresponding fault recovery actions. Each fault condition specifies a particular fault or group of faults, which it attempts to handle, and the corresponding action for it.
And these files should be created based on below XML schema.

http://download.oracle.com/docs/cd/E12839_01/integration.1111/e10224/med_faulthandling.htm#BABJGAEI

We can have these xml files in the same directory as the composite.xml file of the SOA composite application or we can place it in a different location and access those by using below properties in composite.xml

oracle.composite.faultPolicyFile
oracle.composite.faultBindingFile

Ex:
<property name="oracle.composite.faultPolicyFile">oramds:/apps/components/faultpolicies/fault-Policies.xml
</property>
<property
name="oracle.composite.faultBindingFile">oramds://apps/components/faultpolicyfiles/fault-bindings.xml
</property>
Below diagram shows how BPEL process behaves when we use fault-policy frame-work.

So when we are using this framework, it takes precedence over catch and catchAll blocks in BPEL.
 
Below are the sample fault-policies and fault-bindings.xml

fault-policies.xml :

<?xml version="1.0" encoding="UTF-8"?>
<faultPolicies xmlns="http://schemas.oracle.com/bpel/faultpolicy"
xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<faultPolicy version="2.0.1" id="PannPolicy1">
<Conditions>
<faultName xmlns:bpelx="http://schemas.oracle.com/bpel/extension" name="bpelx:remoteFault">
<condition>
<action ref="ora-terminate"/>
</condition>
</faultName>
<faultName xmlns:bpelx="http://schemas.oracle.com/bpel/extension" name="bpelx:bindingFault">
<condition>
<action ref="ora-retry"/>
</condition>
<condition>
<action ref="ora-human-intervention"/>
</condition>
</faultName>
</Conditions>
<Actions>
<Action id="ora-terminate">
<abort/>
</Action>
<Action id="ora-retry">
<retry>
<retryCount>2</retryCount>
<retryInterval>2</retryInterval>
<exponentialBackoff/>
</retry>
</Action>
<Action id="ora-human-intervention">
<humanIntervention/>
</Action>
</Actions>
</faultPolicy>
</faultPolicies>

 fault-bindings.xml:

<?xml version="1.0" encoding="UTF-8"?>
<faultPolicyBindings version="2.0.1" xmlns="http://schemas.oracle.com/bpel/faultpolicy"

<composite faultPolicy=" PannPolicy 1"/>
<component faultPolicy=" PannPolicy 1 ">
<name>TestProcess</name>
</component>
<component faultPolicy=" PannPolicy 1 ">
<name>SecondProcess</name>
</component>
</faultPolicyBindings>

Infault-policies.xml condition section, we can have actions based on the evaluation of fault-variable available on the fault. Like below.

<condition>
<test>$fault.code="ABC Error"</test>
<action ref="ora-terminate"/>
</condition>

Some predefind actions were provided by oracle are:

retry
human-intervention
replay
rethrow
terminate
javaAction

We will see how to use custom java code in fault-policy framework in coming posts.

Regards

PavanKumar.M.V.S.S.S.S.

Wednesday, September 22, 2010

Creating domains in SOA11g

In SOA-10g we have domains concept in BPEL PM.

Now ORACLE has reintroduced this feature in SOA 11g PS2.


But in SOA Suite 11g we are calling these as partitions as weblogic server has the concept of domains.

Here are the steps to create partitions


1) Login to enterprise manager

2) Select soa-infra under SOA folder.

3) Click the drop-down ( SOA Infrastructure) under soa-infra.

4) Select Partitions and click on create.

5) Give the name and finish it.


Regards

PavanKumar.M.V.S.S.S.S.

Creating JMS Queue and Posting messages to it from SOA 11g

In this post first I am going to give the steps to create JMS queue in weblogic.

Pre requisites to do these.. You have to have weblogic server and SOA suite installed.

You can do this in existing JMSServer and JMSModule or fisrt you can create new JMSServer and then JMSModule in the created JMSServer.

We will see the second scenario here.(This covers first case also)

1) Login to weblogic administration console.
2) Navigate to Services-->Messaging-->JMSServers.
3) Now in JMS Servers table click New


4) Give the server name and persistent store.
5) Select the target server. (Generally SOA server) and finish.

Changes happened beacuse of JMSServer creation refelcts in config.xml ( D:\Jdeveloper1113\user_projects\domains\base_domain\config)


6) Now Navigate to Services-->Messaging-->JMSModules
7) Click on New in JMS Modules table.
8) Give the name and click on Next
9) Select the target and click on Next and in next page finish the creation of JMSModule.


10) You can see the created JMSModule in the JMSModule table as above and chages will be reflected in jmsmodulenamemodule-jms.xml [@ D:\Jdeveloper1113\user_projects\domains\base_domain\config\jms]
11) Now create Queue and connection factory by clicking on the created JMSModule.
12) Click new on Summary of Resources table.
13) Select Queue and then next
14) Now give the queue name and JNDI name and then to next page
15) Here if we are doing queue creation in existing module it will show us existing subdeployment. If we are doing in new one create new subdeployment, give some name and select the JMSSerevr finish the queue creation.

Here entries will be added to the same jmsmodulenamemodule-jms.xml

16) Now select connection factory after reaching the step 12 page and in next page give connection factory name and JNDI and finish the CF creation.

These entries also will be added to the same jmsmodulenamemodule-jms.xml

Now we are done with queue and connection factory creation


Now we have to redeploy JMSAdapter after configuring connection pools.

Select the Deployments (above Services) then in the table displayed select JMSAdapter
Now select configuration and then Outbound Connection Pools.




Now click on New button in Outbound Connection Pool Configuration Table and go to next page.
Here select the radio button (oracle.tip.adapter.jms.IJmsConnectionFactory) and next
Give the JNDI name and finish the process.(say eis/PavanQueue/PavanQueueCF)

At this point, it will ask us for the deployment plan location. Click on the path to the directory you created earlier and enter Plan.xml for the plan name. If we are doing this first time it will create new Plan.xml at the specified location.



If we oracle.tip.adapter.jms.IJmsConnectionFactory we can see the Pool we have created as above.
Select the one created now, then it will take us to a page where we can see Outbound Connection Properties table. In this table give the connection factory location (The one we have given in step 16 and click Enter and then save)

We have done with configuration of the connection pool, now we have to redeploy the JMSAdapter
Now again Come to Deployments (above Services) then in the table select JMSAdapter(not clicking the link, check the check box ).Now Update button will get enabled.
Click on Update and in next page check the redeploy button and finish the redeployment.

With these steps we are ready with the queues.

Now in BPEL while configuring the JMS adapter select the queue created in the server and give the location that we have provided while configuring Connection pool(eis/PavanQueue/PavanQueueCF)

Now deploy the the process and you can checkthe queue in monitor tab.(JMSModules-->YourJMSModule-->YourQueue-->Monitoring)




Regards
PavanKumar.M.V.S.S.S.S.