Monday, May 9, 2011

Demo of Ant scripts for Oracle SOA Suite 11g code deployment

I've written some great Ant script wrappers that simplify the deployment, undeployment, and management of code in bulk for Oracle SOA Suite 11g.

Here is an example of the CustomProcessList.txt, which is merely a list of composites I would want to deploy, undeploy, start, or stop:
CreateItem,inventory,1.0,true,inventory/CreateItem
UpdateItem,inventory,1.0,true,inventory/UpdateItem
UpdateEmployee,hr,1.0,true,hr/UpdateEmployee
What this says is that there are 3 composites you want to manage. If you choose to deploy them, 2 of them will be deployed to the inventory partition, and the last one to the hr partition.


This is how to detokenize the 3 composites above:
oracle@build:/home/oracle> cd ant
oracle@build:/home/oracle/ant> export ORACLE_HOME=/u01/app/oracle
oracle@build:/home/oracle/ant> export ANT_HOME=$ORACLE_HOME/middleware/modules/org.apache.ant_1.7.1
oracle@build:/home/oracle/ant> export PATH=$ANT_HOME/bin:$PATH
oracle@build:/home/oracle/ant> export JAVA_HOME=$ORACLE_HOME/jdk1.6.0_21
oracle@build:/home/oracle/ant> export CURRENT_FOLDER=`pwd`
oracle@build:/home/oracle/ant> ant -f build.soa.xml detokenizeComposites -Dtargetenv=dev
Buildfile: build.soa.xml
detokenizeComposites:
     [echo]
     [echo] ======================================================================
     [echo] DETOKENIZE COMPOSITE #1: CreateItem
======================================================================
     [echo]
   [delete] Deleting: /home/oracle/ant/code/inventory/CreateItem/SCA-INF/classes/META-INF/adf-config.xml
     [copy] Copying 1 file to /home/oracle/ant/code/inventory/CreateItem/SCA-INF/classes/META-INF
  [replace] Replaced 11 occurrences in 6 files.
     [echo]
     [echo] ======================================================================
     [echo] DETOKENIZE COMPOSITE #2: UpdateItem
======================================================================
     [echo]
   [delete] Deleting: /home/oracle/ant/code/inventory/UpdateItem/SCA-INF/classes/META-INF/adf-config.xml
     [copy] Copying 1 file to /home/oracle/ant/code/inventory/UpdateItem/SCA-INF/classes/META-INF
  [replace] Replaced 6 occurrences in 3 files.
     [echo]
     [echo] ======================================================================
     [echo] DETOKENIZE COMPOSITE #3: UpdateEmployee
======================================================================
     [echo]
   [delete] Deleting: /home/oracle/ant/code/hr/UpdateEmployee/SCA-INF/classes/META-INF/adf-config.xml
     [copy] Copying 1 file to /home/oracle/ant/code/hr/UpdateEmployee/SCA-INF/classes/META-INF
  [replace] Replaced 24 occurrences in 3 files.

BUILD SUCCESSFUL
Total time: 2 seconds

This is how to deploy the 3 composites above:
oracle@build:/home/oracle> cd ant
oracle@build:/home/oracle/ant> export ORACLE_HOME=/u01/app/oracle
oracle@build:/home/oracle/ant> export ANT_HOME=$ORACLE_HOME/middleware/modules/org.apache.ant_1.7.1
oracle@build:/home/oracle/ant> export PATH=$ANT_HOME/bin:$PATH
oracle@build:/home/oracle/ant> export JAVA_HOME=$ORACLE_HOME/jdk1.6.0_21
oracle@build:/home/oracle/ant> export CURRENT_FOLDER=`pwd`
oracle@build:/home/oracle/ant> ant -f build.soa.xml deployComposites -Dtargetenv=dev

     [echo] ======================================================================
     [echo] PACKAGE COMPOSITE #1: CreateItem
======================================================================
     [echo]
     [echo] oracle.home = /u01/app/oracle/middleware/Oracle_SOA1/bin/..
    [input] skipping input as property compositeDir has already been set.
    [input] skipping input as property compositeName has already been set.
    [input] skipping input as property revision has already been set.

clean:
     [echo] deleting /home/oracle/ant/code/inventory/CreateItem/deploy/sca_CreateItem_rev1.0.jar
   [delete] Deleting: /home/oracle/ant/code/inventory/CreateItem/deploy/sca_CreateItem_rev1.0.jar

init:

scac-validate:
     [echo] Running scac-validate in /home/oracle/ant/code/inventory/CreateItem/composite.xml
     [echo] oracle.home = /u01/app/oracle/middleware/Oracle_SOA1/bin/..
    [input] skipping input as property compositeDir has already been set.
    [input] skipping input as property compositeName has already been set.
    [input] skipping input as property revision has already been set.

scac:
     [scac] Validating composite "/home/oracle/ant/code/inventory/CreateItem/composite.xml"
     [scac] INFO: SchemaManager.isIncrementalBuildSupported XMLSchema incremental build enabled.
     [scac] warning: in CreateItem.mplan: Case "Case_1_UpdateCustomerProfile" doesnt have any payload transformation Please make sure source and target message part name are same and of same type. Otherwise, target reference may fail to execute with error message like "Input sourcelike Null" or "Part not found"
     [scac] warning: in CreateItem.mplan: Case "UpdateEmployee.CreateCustomerProfile" doesnt have any payload transformation Please make sure source and target message part name are same and of same type. Otherwise, target reference may fail to execute with error message like "Input sourcelike Null" or "Part not found"

package:
     [echo] oracle.home = /u01/app/oracle/middleware/Oracle_SOA1/bin/..
    [input] skipping input as property compositeDir has already been set.
    [input] skipping input as property compositeName has already been set.
    [input] skipping input as property revision has already been set.

compile-source:
    [mkdir] Created dir: /home/oracle/ant/code/inventory/CreateItem/dist
     [copy] Copying 10 files to /home/oracle/ant/code/inventory/CreateItem/dist
     [copy] Warning: /home/oracle/ant/code/inventory/CreateItem/src not found.
     [copy] Warning: /home/oracle/ant/code/inventory/CreateItem/SCA-INF/src not found.
      [jar] Building jar: /home/oracle/ant/code/inventory/CreateItem/deploy/sca_CreateItem_rev1.0.jar
   [delete] Deleting directory /home/oracle/ant/code/inventory/CreateItem/dist
     [echo]
     [echo] ======================================================================
     [echo] DEPLOY COMPOSITE #1: CreateItem
======================================================================
     [echo]
     [echo] oracle.home = /u01/app/oracle/middleware/Oracle_SOA1/bin/..

deploy:
    [input] skipping input as property serverURL has already been set.
    [input] skipping input as property sarLocation has already been set.
[deployComposite] setting user/password..., user=weblogic
[deployComposite] Processing sar=/home/oracle/ant/code/inventory/CreateItem/deploy/sca_CreateItem_rev1.0.jar
[deployComposite] Adding sar file - /home/oracle/ant/code/inventory/CreateItem/deploy/sca_CreateItem_rev1.0.jar
[deployComposite] INFO: Creating HTTP connection to host:dev.raastech.com, port:8001
[deployComposite] INFO: Received HTTP response from the server, response code=200
[deployComposite] ---->Deploying composite success.
     [echo]
     [echo] ======================================================================
     [echo] PACKAGE COMPOSITE #2: UpdateItem
======================================================================
     [echo]
     [echo] oracle.home = /u01/app/oracle/middleware/Oracle_SOA1/bin/..
    [input] skipping input as property compositeDir has already been set.
    [input] skipping input as property compositeName has already been set.
    [input] skipping input as property revision has already been set.

clean:
     [echo] deleting /home/oracle/ant/code/inventory/UpdateItem/deploy/sca_UpdateItem_rev1.0.jar
   [delete] Deleting: /home/oracle/ant/code/inventory/UpdateItem/deploy/sca_UpdateItem_rev1.0.jar

init:

scac-validate:
     [echo] Running scac-validate in /home/oracle/ant/code/inventory/UpdateItem/composite.xml
     [echo] oracle.home = /u01/app/oracle/middleware/Oracle_SOA1/bin/..
    [input] skipping input as property compositeDir has already been set.
    [input] skipping input as property compositeName has already been set.
    [input] skipping input as property revision has already been set.

scac:
     [scac] Validating composite "/home/oracle/ant/code/inventory/UpdateItem/composite.xml"
     [scac] INFO: SchemaManager.isIncrementalBuildSupported XMLSchema incremental build enabled.

package:
     [echo] oracle.home = /u01/app/oracle/middleware/Oracle_SOA1/bin/..
    [input] skipping input as property compositeDir has already been set.
    [input] skipping input as property compositeName has already been set.
    [input] skipping input as property revision has already been set.

compile-source:
    [mkdir] Created dir: /home/oracle/ant/code/inventory/UpdateItem/dist
     [copy] Copying 10 files to /home/oracle/ant/code/inventory/UpdateItem/dist
     [copy] Warning: /home/oracle/ant/code/inventory/UpdateItem/src not found.
     [copy] Warning: /home/oracle/ant/code/inventory/UpdateItem/SCA-INF/src not found.
      [jar] Building jar: /home/oracle/ant/code/inventory/UpdateItem/deploy/sca_UpdateItem_rev1.0.jar
   [delete] Deleting directory /home/oracle/ant/code/inventory/UpdateItem/dist
     [echo]
     [echo] ======================================================================
     [echo] DEPLOY COMPOSITE #2: UpdateItem
======================================================================
     [echo]
     [echo] oracle.home = /u01/app/oracle/middleware/Oracle_SOA1/bin/..

deploy:
    [input] skipping input as property serverURL has already been set.
    [input] skipping input as property sarLocation has already been set.
[deployComposite] setting user/password..., user=weblogic
[deployComposite] Processing sar=/home/oracle/ant/code/inventory/UpdateItem/deploy/sca_UpdateItem_rev1.0.jar
[deployComposite] Adding sar file - /home/oracle/ant/code/inventory/UpdateItem/deploy/sca_UpdateItem_rev1.0.jar
[deployComposite] INFO: Creating HTTP connection to host:dev.raastech.com, port:8001
[deployComposite] INFO: Received HTTP response from the server, response code=200
[deployComposite] ---->Deploying composite success.
     [echo]
     [echo] ======================================================================
     [echo] PACKAGE COMPOSITE #3: UpdateEmployee
======================================================================
     [echo]
     [echo] oracle.home = /l01/apps/oracle/middleware/Oracle_SOA1/bin/..
    [input] skipping input as property compositeDir has already been set.
    [input] skipping input as property compositeName has already been set.
    [input] skipping input as property revision has already been set.

clean:
     [echo] deleting /home/oracle/ant/code/hr/UpdateEmployee/deploy/sca_UpdateEmployee_rev1.0.jar
   [delete] Deleting: /home/oracle/ant/code/hr/UpdateEmployee/deploy/sca_UpdateEmployee_rev1.0.jar

init:

scac-validate:
     [echo] Running scac-validate in /home/oracle/ant/code/hr/UpdateEmployee/composite.xml
     [echo] oracle.home = /l01/apps/oracle/middleware/Oracle_SOA1/bin/..
    [input] skipping input as property compositeDir has already been set.
    [input] skipping input as property compositeName has already been set.
    [input] skipping input as property revision has already been set.

scac:
     [scac] Validating composite "/home/oracle/ant/code/hr/UpdateEmployee/composite.xml"
     [scac] INFO: SchemaManager.isIncrementalBuildSupported XMLSchema incremental build enabled.

package:
     [echo] oracle.home = /l01/apps/oracle/middleware/Oracle_SOA1/bin/..
    [input] skipping input as property compositeDir has already been set.
    [input] skipping input as property compositeName has already been set.
    [input] skipping input as property revision has already been set.

compile-source:
    [mkdir] Created dir: /home/oracle/ant/code/hr/UpdateEmployee/dist
     [copy] Copying 10 files to /home/oracle/ant/code/hr/UpdateEmployee/dist
     [copy] Warning: /home/oracle/ant/code/hr/UpdateEmployee/src not found.
      [jar] Building jar: /home/oracle/ant/code/hr/UpdateEmployee/deploy/sca_UpdateEmployee_rev1.0.jar
   [delete] Deleting directory /home/oracle/ant/code/hr/UpdateEmployee/dist
     [echo]
     [echo] ======================================================================
     [echo] DEPLOY COMPOSITE #3: UpdateEmployee
======================================================================
     [echo]
     [echo] oracle.home = /l01/apps/oracle/middleware/Oracle_SOA1/bin/..

deploy:
    [input] skipping input as property serverURL has already been set.
    [input] skipping input as property sarLocation has already been set.
[deployComposite] setting user/password..., user=weblogic
[deployComposite] Processing sar=/home/oracle/ant/code/hr/UpdateEmployee/deploy/sca_UpdateEmployee_rev1.0.jar
[deployComposite] Adding sar file - /home/oracle/ant/code/hr/UpdateEmployee/deploy/sca_UpdateEmployee_rev1.0.jar
[deployComposite] INFO: Creating HTTP connection to host:dev.raastech.com, port:8001
[deployComposite] INFO: Received HTTP response from the server, response code=200
[deployComposite] ---->Deploying composite success.
     [echo]
     [echo] **************************************************************
     [echo] *
     [echo] *  ANT TARGET NAME:  deployComposites
     [echo] *  FAILED PROCESS:   (none)
     [echo] *
     [echo] **************************************************************
     [echo]

BUILD SUCCESSFUL
Total time: 32 seconds

To get a copy of these scripts for Windows, check out the following link:

17 comments:

Anonymous said...

Thanks for the wonderful scripts written. They are very useful to me.
I am getting some issues in building my applications using these scripts. It would be greatful if you can help me in resolving the issues. I am new to these ant scripts.
It is basically problem with scac.input.
I have added an echo statement in clean target of ant-sca-package.xml like


In the console it is printing as

clean:
[echo] SCAC INPUT /home/dev/.hudson/jobs/BUILD01/workspace/Source/Oracle Fusion/CreatePersonInfoImpl
[echo] /composite.xml

I have added only one line echo statement. But here it dispalyed as 2 lines.

The same scac.input is carrying forward, and ultimately it is failing to comiple & package a soa composite.

Please help in fixing the issue.

SOA and OIC Technology for beginners and learners said...

nice post thanks

i have a question

is it going to deploying dependent composites

Anonymous said...

The short answer is, sort of.

Let's say that HelloWorld1 calls HelloWorld2. In that case, you have no choice but to deploy the HelloWorld2 composite first.

Simply list them in the correct order in your CustomProcessList.txt:

HelloWorld2,default,1.0,true,code/HelloWorld2
HelloWorld1,default,1.0,true,code/HelloWorld1

SOA and OIC Technology for beginners and learners said...

you are really genius.. got.. i did the same wat you i deployed first helloworld1 and called helloworld1 in helloworld2 then i manually deployed helloworld1 in jdev and extracted teh wsdl and called in helloworld2... then i listed.. in

CustomProcessList.txt

HelloWorld1,default,55.0,true,HelloWorld1/HelloWorld1
HelloWorld2,default,55.0,true,HelloWorld2/HelloWorld2

it worked thanks a lot.. ahmed...

SOA and OIC Technology for beginners and learners said...

Hi Ahmed do you have any OSB guide to start with.. i need to learn OSB.. or any blog of yours..

if you dont mind please send to my mail id steve054055@gmail.com

SOA and OIC Technology for beginners and learners said...

Hi Ahmed thanks a lot for the ant script to deploy artifacts with mds..

but i facing an issue when i chage when i am trying to undeplyMDS through deploymds.cmd.. it says

C:\newantscript>set CURRENT_FOLDER=C:\newantscript

C:\newantscript>ant -f build.xml undeployMDSApplication
Buildfile: build.xml
[echo] basedir C:\newantscript
[echo] current folder C:\newantscript

undeployMDSApplication:
[echo] undeploy MDS application ${mds.application}
[echo] undeploy MDS app folder apps/${mds.application}
[echo] oracle.home = C:\Oracle\Middleware\jdeveloper\bin/..

removeSharedData:
[input] skipping input as property serverURL has already been set.
[input] skipping input as property folderName has already been set.
[removeSharedData] setting user/password..., user=weblogic
[removeSharedData] INFO: Creating HTTP connection to host:localhost, port:8001
[removeSharedData] INFO: Received HTTP response from the server, response code=5
00
[removeSharedData] ---->response code=500, error:There was an error removing sha
red data on soa_server1: oracle.mds.naming.InvalidReferenceException: MDS-01161:
Reference "/apps/${mds.application}" has an invalid character "{".: MDS-01161:
Reference "/apps/${mds.application}" has an invalid character "{"..
[removeSharedData]

BUILD SUCCESSFUL
Total time: 1 second
C:\newantscript>

Anonymous said...

What are the contents of your CustomMDSList.txt?

Please refer to "Define the Custom MDS List" section of the blog post below for instructions on how to correctly configure this:

http://blog.ipnweb.com/2011/05/ant-scripts-for-oracle-soa-suite-11g.html

SOA and OIC Technology for beginners and learners said...

Hi Ahmed thanks for awesome insight on ant scripts i have a question regarding socket adapter.. when i am deploying the oracle example soacomposite 1.. i am not a able to find any instance in em console.. can you please let me know how to over come this issue

Anonymous said...

Is this still an issue for you?

SOA and OIC Technology for beginners and learners said...

ant scripts are working but socket adapter is not.. can you please send some example

SOA and OIC Technology for beginners and learners said...

ant scripts working absolutely fine..but socket adapter is not working.. can you please suggest any example

Anonymous said...

Unfortunately, I don't understand.

Are you having problems deploying code that uses the socket adapter using the ant scripts?

SOA and OIC Technology for beginners and learners said...

Hi Ahmed...

i was trying to tell that ant scripts are working fine according to scripts given..

thats the other part..

i am working on socket adapter which is idependent to ant scripts

i just need an example of socket adapter.. which works

Anonymous said...

Hi Ahmed,

This post has been very helpful for a=nt scripts.
I have a query ,can you please show some example of how to attach config plan while deploying with ant scripts?
It would be really helpful.

Anonymous said...

Hi Ahmed,

Where can I find the script??

Anonymous said...

Hi Ahmed,
Can you please provide an example of build.soa.xml that you have used.

Anonymous said...

Check out this page for a link to the scripts:

http://blog.ipnweb.com/2011/05/ant-scripts-for-oracle-soa-suite-11g.html