Thursday, April 21, 2011

getting started with custom commands in WLST @SOASuite11g

I was recently having a requirement to use WebLogic Scripting Tool because it gave a lot of flexibility to configure SOA composite applications. In WLST there was OFFLINE option for doing deployments and for Composite Application Management.

You can get  wlst commands  @ here

Some of the commands which I loved using are
1.    sca_deployComposite : Deploy a SOA composite application.
2.    sca_undeployComposite : Un deploy a SOA composite application.
3.    sca_startComposite : Start a previously stopped SOA composite application.
4.    sca_stopComposite :Stop a SOA composite application.
5.    sca_activateComposite : Activate a previously retired SOA composite application.
6.    sca_retireComposite : Retire a SOA composite application.
7.    sca_listDeployedComposites : List the deployed SOA composite applications.

Oracle SOA Suite, MDS, and services such as SSL and logging, supply custom WLST commands.
To use those custom commands, you must invoke the WLST script from the Oracle home. Do not use the WLST script in the WebLogic Server home.
The script is located at:

(UNIX) MIDDLEWARE_HOME/ORACLE_SOA1/common/bin/wlst.sh
(Windows) MIDDLEWARE_HOME\Oracle_SOA1\common\bin\wlst.cmd

In case you use the WLS tool from
 MIDDLEWARE_HOME\oracle_common\common\bin
Or  from
MIDDLEWARE_HOME \wlserver_10.3\common\bin

It will throw following error.

Traceback (innermost last):
  File "", 1,="" ?<="" in="" line="" span="">",>
NameError: sca_undeployComposite

To show the way, I will use  sca_undeployComposite command. For un-deploying composite processes using wlst while the soa-infra is offline use the following custom command.

>>  sca_undeployComposite

Syntax
sca_undeployComposite(serverURL, compositeName, revision, user, password)
Argument
Definition
serverURL
URL of the server that hosts the SOA Infrastructure application (for example, http://localhost:8001).
compositeName
Name of the SOA composite application.
Revision
Revision ID of the SOA composite application.
User
Optional. User name to access the composite deployer servlet when basic authentication is configured.
Password
Optional. Password to access the composite deployer servlet when basic authentication is configured.

How to use it

(UNIX) ORACLE_HOME/common/bin/wlst.sh
(Windows) ORACLE_HOME\common\bin\wlst.cmd

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

wls:/offline> connect()
Please enter your username [weblogic] :weblogic
Please enter your password [welcome1] :
Please enter your server URL [t3://localhost:7001] : t3://localhost:7001
Connecting to t3://localhost:7001 with userid weblogic ...
Successfully connected to Admin Server 'AdminServer' that belongs to domain 'soa_domain'.

wls:/soa_domain/serverConfig> sca_undeployComposite("http://localhost:8001","GeoComposite", "1.0","weblogic","weblogic123")
serverURL = http://localhost:8001
user = weblogic
partition = default
compositeName = GeoComposite
revision = 1.0
timeout= -1
set user and password...
compositeDN = default/GeoComposite!1.0
Creating HTTP connection to host:localhost, port:8001
Received HTTP response from the server, response code=200
---->Undeploying composite (default/GeoComposite!1.0) success.

That’s pretty much for the day. Happy Easter and a long weekend

7 comments:

Krishna said...

Hi,
Is it possible to deploy or undeploy any SOA composite when SOA server is shutdown?. All the wlst commands will try to connect to SOA server while deploying or undeploying.

Krishna said...

Thanks Thomas,
Please suggest me how to do...sca_undeploy command needs soa server which it uses to connect to server in my case server is shutdown...how can we do this?

Unknown said...
This comment has been removed by the author.
Unknown said...

WLST Online means that you can use WLST to connect to a running Administration Server to do the weblogic administration tasks where as WLST offline means that you do not have to connect to a running Administration Server to do the weblogic administration.

In case you want to stay offline ,the connect() method should not be used. connect() makes an online connection

Unknown said...

Krishna,
The sca commands cannot be executed when the soa server is shutdown.The offline and online funda is specific to WLST and not to the server. The WLST can be offline,but the server needs to be running since undeploy and deploy uses the hostname and port of the server and it validates this entry by connecting to it.

Krishna said...

Thanks Thomas

Unknown said...

more info
http://georgie-soablog.blogspot.com/2011/08/executing-wlst-offline-and-online.html