You can add many different types of artifacts to business-level
applications. For example, you can add applications or modules, Java archives (JAR files), data
in compressed files, and other business-level applications. This example
describes how to create an empty business-level application and then
add a Service Component Architecture (SCA) JAR file to the application
using scripting.
Before you begin
In a product installation, verify that the target server
is configured. As part of configuring the server, determine whether
your application files can run on your deployment target. You must
deploy SCA composite assets of a business-level application to a Version
8.0 or later server or cluster (target) or
to a Version 7.0 target that is enabled for the Feature Pack for SCA.
Download
the
helloworld-ws-asynch.jar SCA sample file
from a product download site:
- Go to the Samples, Version 8.5 information
center.
- On the Downloads tab, click FTP or HTTP in
the Service Component Architecture section.
- In the authentication window, click OK.
- In the SCA.zip compressed file, go to the SCA/installableApps directory
and download the helloworld-ws-asynch.jar file.
About this task
For this example, use wsadmin scripts in the Jython or
Jacl language to create a business-level application named HelloWorldAsync
that has an SCA JAR file, helloworld-ws-asynch.jar,
as an asset.
Procedure
- Start the wsadmin scripting tool.
- Create an empty business-level application named HelloWorldAsync.
Use the createEmptyBLA command to create
the business-level application.
Using Jython:
AdminTask.createEmptyBLA('-name HelloWorldAsync')
Using
Jacl:
$AdminTask createEmptyBLA {-name HelloWorldAsync}
After
the command runs, the blaID output displays in the command window:
WebSphere:blaname=HelloWorldAsync
You
can run the listBLAs command to view a list of
all business-level applications in the cell and to confirm that the
HelloWorldAsync business-level application exists.
Using Jython:
AdminTask.listBLAs()
To view a more readable
list of business-level applications, try
print before
the command:
print AdminTask.listBLAs()
Using
Jacl:
$AdminTask listBLAs
- Import the SCA JAR asset.
Use the importAsset command
to import the JAR file to the product configuration repository.
Using
Jython:
AdminTask.importAsset('-source app_server_root/installableApps/helloworld-ws-asynch.jar')
Using
Jacl:
$AdminTask importAsset {-source app_server_root/installableApps/helloworld-ws-asynch.jar}
After
the command runs, the assetID output displays in the command window:
WebSphere:assetname=helloworld-ws-asynch.jar
You
can run the listAssets command to view a list of
all assets in the cell and to confirm that the helloworld-ws-asynch.jar
asset exists:
Using Jython:
AdminTask.listAssets()
To
view a more readable list of assets, try
print before
the command:
print AdminTask.listAssets()
Using
Jacl:
$AdminTask listAssets
- Add the SCA JAR asset as a composition unit of the business-level
application.
Use the addCompUnit command
to add the asset to the business-level application.
Using Jython:
AdminTask.addCompUnit('[-blaID HelloWorldAsync -cuSourceID helloworld-ws-asynch.jar -MapTargets [[ .* SCA_server_name ]] ]')
Using
Jacl:
$AdminTask addCompUnit {-blaID HelloWorldAsync -cuSourceID helloworld-ws-asynch.jar -MapTargets {{ .* SCA_server_name }} }
SCA_server_name is
the name of the target; for example, server1. The
target must support SCA composites. You must specify only a single
server or cluster as the target, and not
map an SCA composition unit to multiple targets.
After the command
runs, the composition unit ID output displays in the command window:
WebSphere:cuname=helloworldws
During deployment
of the composition unit, you can view the Uniform Resource Identifier
(URI) for composite level service of some bindings, along with the
service name and binding type. Only the URI is editable. The product
does not validate the URI.
You can run the listCompUnits command
to view a list of all composition units in a specified business-level
application and to confirm that the helloworldws composition unit
exists in HelloWorldAsync.
Using Jython:
AdminTask.listCompUnits('-blaID HelloWorldAsync')
Using
Jacl:
$AdminTask listCompUnits {-blaID HelloWorldAsync}
- Save the configuration changes.
Using Jython:
AdminConfig.save()
Using Jacl:
$AdminConfig save
- Start the HelloWorldAsync business-level application.
Use the startBLA command to start the
application.
Using Jython:
AdminTask.startBLA('-blaID HelloWorldAsync')
Using
Jacl:
$AdminTask startBLA {-blaID HelloWorldAsync}
Verify
that you see the following message indicating that the application
started successfully:
CWWMH0196I: BLA "WebSphere:blaname=HelloWorldAsync" was started successfully.
Optionally,
query the status to see whether the application is running with the getBLAStatus command.
Using
Jython:
AdminTask.getBLAStatus('-blaID HelloWorldAsync')
Using
Jacl:
$AdminTask getBLAStatus {-blaID HelloWorldAsync}
The
following message indicates that the application is started:
BLA: WebSphere:blaname=HelloWorldAsync State of BLA WebSphere:blaname=HelloWorldAsync is Started.
- Exit the wsadmin command shell.
exit
What to do next
Optionally examine, and possibly use in applications,
other SCA sample files in the SCA/installableApps directory
of the downloadable SCA samples.
If the business-level application
does not start, ensure that the deployment target to which the application
maps is running and try starting the application again. If SCA composite
assets do not start, ensure that each asset is mapped to a deployment
target that supports SCA composites.
If an asset composition
unit uses an Enterprise JavaBeans (EJB)
binding and does not start because it has a non-WebSphere
target of "null", delete the asset composition unit and add
it again to the business-level application. Specify a target hat supports
SCA composites when you add the asset to the business-level application.
You cannot change the target after deployment.
If the SCA application
uses security, the target must be in the global security domain.
In multiple-node environments, synchronize the nodes
after you save changes to the target before starting the business-level
application.