Getting up and running quickly with WS-Notification

Use a script to configure the necessary resources to get up and running quickly with WS-Notification in WebSphere® Application Server.

Before you begin

The example script provided in this topic is intended for development use on a single server only, and not for use in production or network deployment environments.

About this task

You can use the example script to configure a default set of resources that enable you to connect WS-Notification applications for development purposes. When executed, the script takes the following actions:

  1. It searches in the configuration for an existing service integration bus, and creates one if necessary.
  2. It searches for an existing bus member, and if one is not found it adds the (standalone) server to the bus, using the default data source.
  3. It searches for an existing service integration bus topic space destination, and creates one if necessary.
  4. It creates a WS-Notification service.
  5. It creates a WS-Notification service point on the local server for a SOAP over HTTP binding.
  6. It creates a WS-Notification permanent topic namespace to reference the service integration bus topic space that was found or created in step 3.
  7. It saves the configuration, and describes where to find the WSDL for the new notification broker Web service that has been exposed.

To use the example script, complete the following steps:

Procedure

  1. Save the script to the file system using a name of your choice (for example wsnQuickStart.jacl).
  2. Modify the hostRoot variable defined at the top of the script to point to the HTTP port of the local server (usually 9080).
  3. Install and configure the SDO repository.
  4. Start the server, then execute the following command. If you saved the script with a name other than wsnQuickStart.jacl, then use that name instead.
    wsadmin -f wsnQuickStart.jacl

Example

Here is the example script:
#######################################################################################
# WS-Notification QuickStart script                                                   #
#                                                                                     #
# This JACL script will quickly create the basic resources required in order to start #
# using WS-Notification in WebSphere Application Server Version 6.1 or later          #
#                                                                                     #
# Before executing it you must modify the variables defined below to match your       #
# configuration settings.                                                             #
#                                                                                     #
# Note:                                                                               #
#    - This script is not intended for production use, and is intended for use on     #
#      a standalone server (not Network Deployment) only.                             #
#    - The script will search the configuration for an existing bus, and if one is    #
#      not found then a new bus will be created                                       #
#    - It will then look for an existing Bus Member on the chosen bus. If one is not  #
#      found then one will be created using the default File Store                    #
#    - It will then look for an existing service integration bus topic space. If one  #
#      is not found then it will create one.                                          #
#                                                                                     #
# Execute the script by typing;                                                       #
#   wsadmin -f wsnQuickStart.jacl                                                     #
#                                                                                     #
#######################################################################################


###########################################################
# Configuration variables                                 #
#                                                         #
# Set the following variables to match your configuration #
###########################################################
# The URL root of HTTP port on the local server
set hostRoot "http://xyz.ibm.com:9080"




#######################################################################################
# Now create the configuration objects using the variables defined above              #
#######################################################################################

# These variables are arbitrary choices and need not be set by the user unless desired.
set wsnServiceName "myWSNService"
set wsnServicePointName "myWSNServicePoint"
set eplName "myNewEPL"
set tnsNamespaceURI "http://example.org/topicNamespace/example1"

puts "###########################################################"
puts "# Check the pre-requisites before we begin                #"
puts "###########################################################"
# Check for the existence of the bus
set requiresRestart false
set myBuses [ $AdminTask listSIBuses ]
set myBus [ lindex $myBuses 0 ]
if {$myBus == []} {
  puts "  *** Creating new SIBus "
  set myBus [ $AdminTask createSIBus { -bus MySampleBus -busSecurity false 
                                       -scriptCompatibility 6.1 } ]
  set requiresRestart true
}
set siBusName [ $AdminConfig showAttribute $myBus name ]
puts "  service integration bus name: $siBusName "

# Check for the existence of the bus member
set busMembers [ $AdminTask listSIBusMembers " -bus $siBusName " ]
set myBusMember [ lindex $busMembers 0 ]

if {$myBusMember == []} {
  puts ""
  puts "  *** Creating new Bus Member "

  set nodeName [ lindex [ $AdminTask listNodes ] 0 ]
  set server [ lindex [ $AdminTask listServers ] 0 ]
  set busMemberName [ $AdminConfig showAttribute $server name ]
  set myBusMember [ $AdminTask addSIBusMember " -bus $siBusName 
                     -node $nodeName -server $busMemberName " ]
  puts ""
  set requiresRestart true
} else {
  set nodeName [ $AdminConfig showAttribute $myBusMember node ]
  set busMemberName [ $AdminConfig showAttribute $myBusMember server ]
}
puts "  service integration bus Member on node: $nodeName "
puts "                               on server: $busMemberName "


# Find a topic space to use
set topicSpaces [ $AdminTask listSIBDestinations " -bus $siBusName 
                   -type TopicSpace " ]
set tSpace [ lindex $topicSpaces 0 ]

if {$tSpace == []} {
  puts "  *** Creating a Topic Space "
  set tSpace [ $AdminTask createSIBDestination " -bus $siBusName 
                -node $nodeName -server $myBusMember 
                -name MyTopicSpace -type TopicSpace " ]
  puts ""

}
set siBusTopicSpaceName [ $AdminConfig showAttribute $tSpace identifier ]
puts "     service integration bus topic space: $siBusTopicSpaceName "


puts ""
puts "###########################################################"
puts "# Create the WS-Notification service                      #"
puts "###########################################################"
set newService [ lindex [ $AdminTask listWSNServices " -name $wsnServiceName 
                           -bus $siBusName " ] 0 ]

if {$newService == []} {
  set newService [ $AdminTask createWSNService " -name $wsnServiceName -bus $siBusName " ]
  puts "WS-Notification service created: $wsnServiceName "
  puts "                         on bus: $siBusName "
} else {
  puts "WS-Notification service '$wsnServiceName' already exists on bus '$siBusName' "
}

puts ""
puts "###########################################################"
puts "# Create the WS-Notification service point                #"
puts "###########################################################"
set eplURLRoot $hostRoot/wsn
set wsdlURLRoot $hostRoot/SIBWS/wsdl

set newServicePoint [ lindex [ $AdminTask listWSNServicePoints $newService " 
                                -name $wsnServicePointName " ] 0 ]

if {$newServicePoint == []} {
  set newServicePoint [ $AdminTask createWSNServicePoint $newService " 
                         -name $wsnServicePointName 
                         -node $nodeName -server $busMemberName -eplName $eplName 
                         -eplURLRoot $eplURLRoot -eplWSDLServingURLRoot $wsdlURLRoot " ]
  puts "WS-Notification service point created: $wsnServicePointName "
  puts "                        on bus member: $busMemberName "
  puts "                              on node: $nodeName "
} else {
  puts "WS-Notification service point '$wsnServicePointName' 
        already exists on WS-Notification service '$wsnServiceName' "
}

puts ""
puts "###########################################################"
puts "# Create the WS-Notification permanent topic namespace    #"
puts "###########################################################"
set newTopicNamespace [ lindex [ $AdminTask listWSNTopicNamespaces $newService "
                                  -namespace $tnsNamespaceURI " ] 0 ]

if {$newTopicNamespace == []} {
  set newTopicNamespace [ $AdminTask createWSNTopicNamespace $newService "
                           -namespace $tnsNamespaceURI -busTopicSpace $siBusTopicSpaceName 
                           -reliability RELIABLE_PERSISTENT " ]
  puts "WS-Notification topic namespace created: $tnsNamespaceURI "
  puts "                        bus topic space: $siBusTopicSpaceName "
} else {
  puts "WS-Notification permanent topic namespace already exists: $tnsNamespaceURI "
}



#######################################################################################
# All the objects have been created - inform the user where to proceed next           #
#######################################################################################

puts ""
puts "###########################################################"
puts "# Summary                                                 #"
puts "###########################################################"

# Calculate where you would find the WSDL for the new service.
set brokerInboundService [ $AdminTask getWSN_SIBWSInboundService $newService " -type BROKER " ]
set svcName [ $AdminConfig showAttribute $brokerInboundService name ]
set wsdlLocation $wsdlURLRoot/$siBusName/$svcName
puts " The WSDL for the new service can be viewed at the following location; "
puts "   $wsdlLocation "
puts ""
puts " Your web service applications can publish and subscribe to any topics in the namespace; "
puts "   $tnsNamespaceURI "
puts ""
if {$requiresRestart == "true"} {
  puts " You must now restart the server for the changes to take effect. "
  puts ""
}

puts ""
puts "###########################################################"
puts "# Save the configuration and exit                         #"
puts "###########################################################"
$AdminConfig save
exit



In this information ...


IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic    

Terms of Use | Feedback

Last updated: Feb 19, 2011 5:25:36 AM CST
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=v610web&product=was-nd-mp&topic=tjwsn_task_sysa0
File name: tjwsn_task_sysa0.html