Friday, August 2, 2013

WLST command to deploy multiple SOA composites

In my previous post, we have seen how to deploy single composite using WLST command.

Unfortunately , there is no WLST command which deploys all the composites to the Server at once.
We need to handle this separately. There are various ways to achieve this. You can use either Ant script available from Oracle and needs to be tweaked little bit . We can use shell script with the Same WLST Command repeated multiple times for each composite.

I am going to discuss here about the python way. Yes, I am going to show how we can achieve this using python script.

The following are the steps for the same.

1. First define the soadeploy.properties file
The content of the file is shown below
# The address and port of the SOA server
soa.soa_server = localhost:8001
# The absolute path to the folder containing the JAR files
soa.jar_location = /xyzfolder/app/soa/sar/
# The absolute path to the folder containing the XML files
soa.xml_location = /xyzfolder/app/soa/config/
# The WebLogic username
soa.username = weblogic
# The WebLogic password
soa.password = weblogic1

2.Next write the python script soadeploy.py as shown below

from java.io import FileInputStream

# This python scripts deploys all the composites listed below to a particular SOA server


print '*** Script invocation : Starting ***'

readSOAProperties = FileInputStream("soadeploy.properties")
configProps = Properties()
configProps.load(readSOAProperties)
   
soa_server = configProps.get("soa.soa_server")
jar_location = configProps.get("soa.jar_location")
xml_location = configProps.get("soa.xml_location")
username = configProps.get("soa.username")
password = configProps.get("soa.password")

# list of composites, JARs in left column, XMLs in right column
composites = [
['sca_ABC_rev25.jar',    'ABC_cfgplan.xml'],
['sca_XYZ_rev26.jar',    'XYZ_cfgplan.xml'],
['sca_MNO_rev27.jar',    'MNO_cfgplan.xml']
]

   
for composite in composites:
    print '----------------------------------------------------------------------------------------------------'
    print 'Starting  to deploy: ' + composite[0]
   
    try:
        if composite[1] is None:
            # No config file
            configpath = None
        else:
            # Config file exists
            configpath = xml_location + composite[1]

        sca_deployComposite(soa_server,jar_location + composite[0],true,username,password,true,configpath)

    except:
        print 'Failed to deploy: ' + composite[0]
        pass
   
    print '----------------------------------------------------------------------------------------------------'
       
print 'All composites deployed successfully'
exit()

print '*** Script Invocation : STOPPED ***'




3.  Follow the steps to run the above script

 Run the python script using the wlst executable located in the SOA_HOME/common/bin directory. For example:
$ /soainstallationfolder/app/oracle/mw_home/Oracle_SOA/common/bin/./wlst.sh soadeploy.py

Verify all the composites are deployed to the server



3 comments:

Onkar Shoker said...

You can use the sca_deployComposite wlst command to deploy multiple SOA services. Instead of pointing to sca file, point to .zip file that contains all sca files.

Vijay Reddy said...

enjoyed reading it. I need to read more on this topic...I admiring time and effort you put in your blog.
ecorp

Ramya Lanka said...

hi aleem i am new to wlst. in this python script what are those xml and jar file u have used.