Saturday, May 9, 2015

How to deploy multiple SOA composites using WLST

Following post describes the process to deploy multiple soa composites .

Step1 . Create a file with list of soa composites that are needed to deploy.

Stpe2 . Create env.properties file with environment details

env.properties

soa.soa_server = http://<SOA Server Address>:<Port>
soa.jar_location = <Path to SAR Files>/sar/
soa.xml_location = <Path to Config Plan>/configPlan/
soa.username = weblogic
soa.password = <weblogic password>

Step 3. Create soadeploy.py

from java.io import FileInputStream

propInputStream = FileInputStream("env.properties")
configProps = Properties()
configProps.load(propInputStream)
soa_server = configProps.get("soa.soa_server")
jar_location = configProps.get("soa.jar_location")
config_location = configProps.get("soa.xml_location")
username = configProps.get("soa.username")
password = configProps.get("soa.password")
composites = [line.strip() for line in open('soa_list')]
configpath = config_location + "soa_cfgplan.xml"
error_occurred = False
failed_composites = []
for composite in composites:
    print "----------------------------------------------------------------------------------------"
    print 'Attempting to deploy: ' + composite
    try:
        sca_deployComposite(soa_server,jar_location + composite,true,username,password,true,configpath)

    except:
        print 'Failed to deploy: ' + composite
        print "Exeception info: ", sys.exc_info()[0]
        error_occurred = True
        failed_composites.append(composite)
    print "----------------------------------------------------------------------------------------"
if error_occurred:
    print "\nThe following soa composites failed to deploy:"
    for failure in failed_composites:
        print failure
else:
    print "\nAll soa composites deployed successfully!"
print "\nDone."
exit()

------------------------------------------------------------------------------------

1 comment:

  1. Can you send me the sample file on how to list down all composites with Configuration Plan

    ReplyDelete