스크립트를 사용하여 빠른 WS-Notification 시동 및 실행

jython 스크립트를 사용하여 WebSphere® Application Server에서 WS-Notification을 바르게 시동 및 실행하는 데 필요한 자원을 구성합니다.

시작하기 전에

이 주제에 제공된 스크립트 예는 단일 서버에서의 개발 용도에만 해당되며 프로덕션 또는 네트워크 배치 환경에서는 사용되지 않습니다.

이 태스크 정보

스크립트 예를 사용하는 WS-Notification 애플리케이션을 개발 용도로 연결할 수 있는 기본 자원 세트를 구성할 수 있습니다. 실행 시 스크립트는 다음 조치를 수행합니다.

  1. 구성에서 기존 서비스 통합 버스를 검색하고 필요한 경우 서비스 통합 버스를 작성합니다.
  2. 기존 버스 멤버를 검색하고 해당 멤버가 없는 경우 버스에 (독립형) 서버를 추가하며 기본 데이터 소스를 사용합니다.
  3. 기존 서비스 통합 버스 토픽 영역 대상을 검색하고 필요한 경우 해당 대상을 작성합니다.
  4. 버전 6.1 또는 버전 7.0 WS-Notification 서비스를 작성합니다.
  5. HTTP를 통한 SOAP 바인딩을 위해 로컬 서버에서 버전 6.1 또는 버전 7.0 WS-Notification 서비스 위치를 작성합니다.
  6. 3단계에서 찾거나 작성된 서비스 통합 버스 토픽 영역을 참조하기 위해 WS-Notification 영구 토픽 네임스페이스를 작성합니다.
  7. 구성을 저장하고 노출된 새 알림 브로커 웹 서비스의 WSDL을 찾을 위치를 설명합니다.

스크립트 예를 사용하려면 다음 단계를 완료하십시오.

프로시저

  1. 파일 시스템에 스크립트를 저장하고 선택한 이름을 사용합니다(예: wsnQuickStart.py).
  2. 스크립트에서 정의된 hostRoot 변수가 로컬 서버의 HTTP 포트(일반적으로 9080)를 가리키도록 수정하십시오.
  3. (이 단계는 버전 6.1 WS-Notification 서비스에만 필요합니다.) SDO 저장소를 설치 및 구성하십시오.
  4. 서버를 시작한 후 다음 명령을 실행하십시오. 스크립트를 wsnQuickStart.py 이외의 이름으로 저장한 경우에는 대신 해당 이름을 사용하십시오.
    wsadmin -f wsnQuickStart.py

스크립트 예는 다음과 같습니다.
#######################################################################################
# WS-Notification QuickStart script                                                   #
#                                                                                     #
# This Jython 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 stand-alone 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.py                                                       #
#                                                                                     #
#######################################################################################

###########################################################
# Configuration variables                                 #
#                                                         #
# Set the following variables to match your configuration #
###########################################################
# The URL root of HTTP port on the local server
hostRoot = "http://xyz.ibm.com:9080"
# The type of WS-Notification service you want to create (Version 6.1 or Version 7.0)
wsnServiceType = "V7.0"

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

# These variables are arbitrary choices and need not be set unless required.
wsnServiceName = "myWSNService"+wsnServiceType
wsnServicePointName = "myWSNServicePoint"+wsnServiceType
eplName = "myNewEPL"
tnsNamespaceURI = "http://example.org/topicNamespace/example1"

# General environment variables
nodeName = AdminTask.listNodes().split("\n")[0].rstrip()
server = AdminTask.listServers().split("\n")[0].rstrip()

print "###########################################################"
print "# Check the pre-requisites before you begin               #"
print "###########################################################"
# Check for the existence of the bus
requiresRestart = "false"
myBuses = AdminTask.listSIBuses().split("\n")
myBus = myBuses[0].rstrip()

if (myBus == ""):
        print "  *** Creating new bus "
        myBus = AdminTask.createSIBus("-bus MySampleBus -busSecurity false 
                                       -scriptCompatibility 6.1")
        requiresRestart = "true"
#endIf 
siBusName = AdminConfig.showAttribute(myBus, "name" )
print "  service integration bus name: "+siBusName+" "

# Check for the existence of the bus member
busMembers = AdminTask.listSIBusMembers(" -bus "+siBusName).split("\n")
myBusMember = busMembers[0].rstrip()

if (myBusMember == ""):
        print ""
        print "  *** Creating new Bus Member "
        busMemberName = AdminConfig.showAttribute(server, "name")
        myBusMember = AdminTask.addSIBusMember(" -bus "+siBusName+" 
                        -node "+nodeName+" -server "+busMemberName)
        print ""
        requiresRestart = "true"
else:
        nodeName = AdminConfig.showAttribute(myBusMember, "node")
        busMemberName = AdminConfig.showAttribute(myBusMember, "server")
#endElse 
print "  service integration bus Member on node: "+nodeName+" "
print "                               on server: "+busMemberName+" "

# Find a topic space to use
topicSpaces = AdminTask.listSIBDestinations(" -bus "+siBusName+" 
                                  -type TopicSpace ").split("\n")
tSpace = topicSpaces[0].rstrip()

if (tSpace == ""):
        print "  *** Creating a Topic Space "
        tSpace = AdminTask.createSIBDestination(" -bus "+siBusName+" 
                        -node "+nodeName+" -server "+myBusMember+" 
                        -name MyTopicSpace -type TopicSpace")
        print ""

#endIf 
siBusTopicSpaceName = AdminConfig.showAttribute(tSpace, "identifier" )
print "     service integration bus topic space: "+siBusTopicSpaceName+" "

print ""
print "###########################################################"
print "# Create the WS-Notification service                      #"
print "###########################################################"
newService = AdminTask.listWSNServices(" -name "+wsnServiceName+" 
                            -bus "+siBusName).split("\n")[0].rstrip()

if (newService == ""):
        newService = AdminTask.createWSNService(" -name "+wsnServiceName+" 
                            -bus "+siBusName+" "+" -type "+wsnServiceType)
        print "WS-Notification service created: "+wsnServiceName+" "
        print "                         on bus: "+siBusName+" "
else:
        print "WS-Notification service '"+wsnServiceName+"' "
        print "  already exists on bus '"+siBusName+"' "
#endElse 

print ""
print "###########################################################"
print "# Create the WS-Notification service point                #"
print "###########################################################"
eplURLRoot = hostRoot+"/wsn"
wsdlURLRoot = hostRoot+"/SIBWS/wsdl"

newServicePoint = AdminTask.listWSNServicePoints(newService, "
                -name "+wsnServicePointName+" " ).split("\n")[0].rstrip()

if (newServicePoint == ""):
        if (wsnServiceType == "V7.0"):
            newServicePoint = AdminTask.createWSNServicePoint(newService, "
            -name "+wsnServicePointName+" -node "+nodeName+" -server "+busMemberName)
        else:
            newServicePoint = AdminTask.createWSNServicePoint(newService, "
            -name "+wsnServicePointName+" 
            -node "+nodeName+" -server "+busMemberName+" -eplName "+eplName+" 
            -eplURLRoot "+eplURLRoot+" -eplWSDLServingURLRoot "+wsdlURLRoot+" " )
        print "WS-Notification service point created: "+wsnServicePointName+" "
        print "                        on bus member: "+busMemberName+" "
        print "                              on node: "+nodeName+" "
else:
        print "WS-Notification service point '"+wsnServicePointName+"' "
        print "already exists on WS-Notification service '"+wsnServiceName+"' "
#endElse 

print ""
print "###########################################################"
print "# Create the WS-Notification permanent topic namespace    #"
print "###########################################################"
newTopicNamespace = AdminTask.listWSNTopicNamespaces(newService, "
                    -namespace "+tnsNamespaceURI+" ").split("\n")[0].rstrip()

if (newTopicNamespace == ""):
    newTopicNamespace = AdminTask.createWSNTopicNamespace(newService, "
      -namespace "+tnsNamespaceURI+" -busTopicSpace "+siBusTopicSpaceName+" 
      -reliability RELIABLE_PERSISTENT")
  print "WS-Notification topic namespace created: "+tnsNamespaceURI+" "
  print "                        bus topic space: "+siBusTopicSpaceName+" "
else:
  print "WS-Notification permanent topic namespace already exists: "
        +tnsNamespaceURI+" "
#endElse 

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

print ""
print "###########################################################"
print "# Summary                                                 #"
print "###########################################################"

# Calculate where you would find the WSDL for the new service.
if (wsnServiceType == "V7.0"):
  print "IMPORTANT: Because you've created a Version 7.0 service" 
  print "you need to start the newly installed application;"
  print "           WSN_"+wsnServiceName+"_"+wsnServicePointName 
  print ""

  wsdlLocation = hostRoot+"/"+wsnServiceName+wsnServicePointName
                         +"NB/Service?wsdl"
else:
  print "IMPORTANT: Because you've created a Version 6.1 service" 
  print "you need to start 2 newly installed applications;"
  serverName = AdminConfig.showAttribute(server, "name")
  print "           "+eplName+"."+nodeName+"."+serverName
  print "           sibws."+nodeName+"."+serverName
  print ""
  wsdlLocation = hostRoot+"/wsn/soaphttpengine/"+siBusName+"/"
                 +wsnServiceName+"NotificationBroker/"
                 +wsnServicePointName+"NotificationBrokerPort?wsdl"
print " The WSDL for the new service can be viewed at the following location; "
print "   "+wsdlLocation+" "
print ""
print " Your web service applications can publish and subscribe to any topics in the namespace; "
print "   "+tnsNamespaceURI+" "
print ""
if (requiresRestart == "true"):
  print " You must now restart the server for the changes to take effect. "
  print ""
#endIf 

print ""
print "###########################################################"
print "# Save the configuration and exit                         #"
print "###########################################################"
AdminConfig.save()
sys.exit()

주제 유형을 표시하는 아이콘 태스크 주제



시간소인 아이콘 마지막 업데이트 날짜: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=tjwsn_task_sysa0
파일 이름:tjwsn_task_sysa0.html