4 Controlling Oracle WebLogic Tuxedo Connector Connections and Services

This chapter describes how to control connectivity and services between WebLogic Server applications and Tuxedo environments. Oracle WebLogic Tuxedo Connector uses attributes that are analogous to the interoperability attributes required for the communication between Tuxedo access points.

Dynamic Administration of Connections

You can dynamically list, start, and stop individual connections using the Administration Console or WLST scripting language. Refer to the following sections for how to start and stop WTC server connections using the available tools.

Using the WLS Administration Console

The Administration Console allows you to start and stop Oracle WebLogic Tuxedo Connector connections. Refer to the Administration Console Help for how to start and stop WTC server connections.

Using WebLogic Scripting Tool (WLST)

The listConnectionsConfigured() attribute lists the configured connections, startConnection() attribute allows you to start an individual connection, and stopConnection() attribute allows you to stop individual connections. For information on how to administer individual connections dynamically, refer to the Oracle Fusion Middleware Oracle WebLogic Scripting Tool.

Listing Connections

Using the WebLogic Scripting Tool (WLST), you can dynamically list the connections for a domain with the listConnectionsConfigured() attribute. When you run cmo.listConnectionsConfigured(), a reference to an array of DSessConnInfo structures is returned. It is convenient to save this in a local WLST variable, such as

wls:/mydomain/serverRuntime/WTCRuntime/WTCService> r=cmo.listConnectionsConfigured()

Each DSessConnInfo instance has a local access point ID, remote access point ID, and status (boolean, true = connected, false = not connected). For example,

wls:/mydomain/serverRuntime/WTCRuntime/WTCService> print r[0].getLocalAccessPointId()
WLSDOM
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> print r[0].getRemoteAccessPointId()
TUXDOM
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> print r[0].isConnected()
0

Starting Connections

Using the WebLogic Scripting Tool (WLST), you can dynamically start individual connections for an access point with the startConnection() attribute.

To start a connection between a local and a remote access point, specify the access point IDs in the arguments. For example,

cmo.startConnection('WLSDOM','TUXDOM')

To start a connection between a local and all associated remote access points, specify the local access point ID in the argument. For example,

cmo.startConnection('WLSDOM')

Stopping Connections

Using the WebLogic Scripting Tool (WLST), you can dynamically stop individual connections for an access point with the stopConnection() attribute.

To stop a connection between a local and a remote access point, specify the access point IDs in the arguments. For example,

cmo.stopConnection('WLSDOM','TUXDOM')

To stop all connections involving a given local access point, specify the local access point ID in the argument. For example,

cmo.stopConnection('WLSDOM')

The following code list is an example of dynamically listing, starting and stopping connections using WLST.

Example 4-1 Dynamically List, Start, and Stop Connections

java weblogic.WLST
wls:/offline> connect('weblogic','weblogic')
wls:/mydomain/serverConifg> cd('WTCServers')
wls:/mydomain/serverConfig/WTCServers> cd('myWTC')
wls:/mydomain/serverConfig/WTCServers/myWTC> cd('LocalTuxDoms')
wls:/mydomain/serverConfig/WTCServers/myWTC/LocalTuxDoms> ls()
dr--   TDOM2
wls:/mydomain/serverConfig/WTCServers/myWTC/LocalTuxDoms> cd('../../..')
wls:/mydomain/serverConfig> serverRuntime()
wls:/mydomain/serverRuntime> cd('WTCRuntime')
wls:/mydomain/serverRuntime/WTCRuntime> cd('WTCService')
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> r=cmo.listConnectionsConfigured() 
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> print r[0].getLocalAccessPointId()
TDOM2
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> print r[0].getRemoteAccessPointId()
TDOM1
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> print r[0].isConnected()
0
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> cmo.startConnection('TDOM2','TDOM1') 
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> r=cmo.listConnectionsConfigured() 
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> print r[0].isConnected() 
1
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> cmo.stopConnection('TDOM2','TDOM1') 
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> r=cmo.listConnectionsConfigured() 
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> print r[0].isConnected() 
0 
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> disconnect() 
wls:/offline> exit() 

Modifying Configuration Attributes

Using the WebLogic Scripting Tool (WLST), you can dynamically modify a configuration attribute.

The following code listing is an example that modifies the setInteroperate() attribute.

Example 4-2 Modifying Configuration Attributes

java weblogic.WLST
wls:/offline> connect('weblogic','weblogic')
wls:/mydomain/serverConifg> edit()
wls:/mydomain/edit> startEdit()
wls:/mydomain/edit> cd("WTCServers/myWTC")
wls:/mydomain/edit/WTCServers/myWTC> cd("LocalTuxDoms")
wls:/mydomain/edit/WTCServers/myWTC/LocalTuxDoms> cd("TDOM2")
wls:/mydomain/edit/WTCServers/myWTC/LocalTuxDoms/TDOM2> cmo.setInteroperate("Yes")
wls:/mydomain/edit/WTCServers/myWTC/LocalTuxDoms/TDOM2> validate()
wls:/mydomain/edit/WTCServers/myWTC/LocalTuxDoms/TDOM2> showChanges()

Changes that are in memory and saved to disc but not yet activated are:

MBean Changed           : mydomain:Name=TDOM2,Type=WTCLocalTuxDom,WTCServer=myWTC
Operation Invoked       : modify
Attribute Modified      : Interoperate
Attributes Old Value    : No
Attributes New Value    : Yes
Server Restart Required : false

wls:/mydomain/edit/WTCServers/myWTC/LocalTuxDoms/TDOM2> save()
wls:/mydomain/edit/WTCServers/myWTC/LocalTuxDoms/TDOM2> activate(block="true")
wls:/mydomain/edit/WTCServers/myWTC/LocalTuxDoms/TDOM2> disconnect()
wls:/offline> exit()

Suspend/Resume WTC Services

Using the WLS Administration Console or WLST, an administrator can suspend and resume a service on a specific WTC server. When an imported service is suspended on a WTC server, then all the JATMI client requests sent to the WTC server for that service are returned immediately by WTC throwing a TPException.TPENOENT. The service will not become available until the service is explicitly resumed.

For service requests from a Tuxedo client to WTC that are targeted to a suspended exported service, the service request is returned with TPENOENT without ever invoking the actual services. Any service requests already received and in processing will continue to process and is not affected by the suspend operation.

For information on how to suspend and resume WTC services dynamically, refer to Suspend/Resume WTC Services Dynamically

Refer to the following sections for how to suspend and resume WTC services using the available tools.

Using the WLS Administration Console

The Administration Console allows you to suspend and resume Oracle WebLogic Tuxedo Connector services. Refer to the Administration Console Help for how to suspend and resume WTC services.

Using WebLogic Scripting Tool (WLST)

WLST allows you to suspend and resume Oracle WebLogic Tuxedo Connector services through the WTCRuntimeMBean. You can also check the status of the service.

Checking Status of WTC Service

To determine the status of a service, specify the SvcName, LDOM, or RDomList in the arguments. For example,

int WTCService.getServiceStatus(String SvcName)

In this case, the code returns a status of all the imported and exported services with the name SvcName for the targeted WTC server. If there is more than one imported service or exported service with the same resource name 'SvcName', then if at least one service is available, the status will return AVAILABLE. If there is more than one imported service or exported service with the same resource name 'svcName' and some services are suspended and some are unavailable, the status returns a SUSPENDED value. If all services are unavailable, the status returns an UNAVAILABLE value. TPException.TPENOENT is thrown when no match is found.

The legal values of the returned status are as shown in Table 4-1.:

Table 4-1 Status Values for a Service

Status Values Description
WTCServiceStatus.SUSPENDED 

The service is suspended administratively.

WTCServiceStatus.AVAILABLE 

The service is not suspended, and is accessible

WTCServiceStatus.UNAVAILABLE 

The service is not suspended, but is not accessible because there is no connection available to remote Tuxedo GWTDomain gateway that provides this service.


Suspending WTC Services

You can suspend any imported or exported service advertised by a WTC server. Any service suspended administratively will become available only when either WTC server is redeployed, WLS server is rebooted, or the service is resumed administratively.

To suspend an available service, specify the SvcName, LDOM, or RDomList in the arguments. For example,

Void WTCRuntimeMBean.suspendService(String SvcName, boolean isImported)

This case suspends all the Import or Export services with the specified name. If isImported is true, then only imported services are suspended; if it is false, then only exported services are suspended. TPException.TPENOENT is thrown if nothing is found.

Resuming WTC Services

You can resume any imported or exported service advertised by a WTC server that has a status of suspended. Any service suspended administratively will become available only when either WTC server is redeployed, WLS server is rebooted, or the service is resumed administratively.

To resume a suspended service, specify the SvcName, LDOM, or RDomList in the arguments. For example,

void WTCRuntimeMBean.resumeService(String SvcName)

This example resumes all the Import and Export services with SvcName configured for the targeted WTC server. TPException.TPENOENT is thrown if no match is found.

Suspend/Resume WTC Services Dynamically

Using the WLS Administration Console or WLST, an administrator can suspend and resume a service on a specific WTC server. When an imported service is suspended on a WTC server, then all the JATMI client requests sent to the WTC server for that service are returned immediately by WTC throwing a TPException.TPENOENT. The service will not become available until the service is explicitly resumed.

The dynamic status only affect imported service. When there is at least one TDomain session available or possibly available, then the imported service will become available. It will become suspended only when no TDomain session is available. When connection policy resolution for a WTCRemoteTuxDom is ON_DEMAND then the TDomain session is always available even though it does not exist. When a connection policy resolution for WTCRemoteTuxDom is INCOMING_ONLY or ON_STARTUP, then the TDomain session becomes available only when the connection is made and the TDomain session exists.

The following code list is an example of dynamically listing, starting and stopping connections using WLST.

Example 4-3 Dynamically Suspend and Resume Services

java weblogic.WLST 
wls:/offline> connect('weblogic','weblogic','t3://localhost:7001')
wls:/mydomain/serverConfig> serverRuntime()
wls:/mydomain/serverRuntime> cd('WTCRuntime/WTCService')
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> ls() 
-r-- Name WTCService
-r-- ServiceStatus weblogic.wtc.gwt.DServiceInfo[weblogic.wtc.gwt.DServiceInfo@1947a96]
-r-- Type WTCRuntime 
-r-x getServiceStatus Integer :
                 String(java.lang.String),String(java.lang.String),String(java.lang.String)
-r-x getServiceStatus Integer : String(localAccessPoint),String(svcName)
-r-x getServiceStatus Integer : String(localAccessPoint),String(svcName),Boolean(isImport)
-r-x getServiceStatus Integer : String(svcName)
-r-x getServiceStatus Integer : String(svcName),Boolean(isImport)
-r-x listConnectionsConfigured weblogic.wtc.gwt.DSessConnInfo[] : 
-r-x resumeService Void : String(localAccessPoint),String(remoteAccessPointList),String(svcName)
-r-x resumeService Void : String(localAccessPoint),String(svcName)
-r-x resumeService Void : String(localAccessPoint),String(svcName),Boolean(isImport)
-r-x resumeService Void : String(svcName)
-r-x resumeService Void : String(svcName),Boolean(isImport)
-r-x startConnection Void : String(LDomAccessPointId)
-r-x startConnection Void : String(LDomAccessPointId),String(RDomAccessPointId)
-r-x stopConnection Void : String(LDomAccessPointId)
-r-x stopConnection Void : String(LDomAccessPointId),String(RDomAccessPointId)
-r-x suspendService Void : String(localAccessPoint),String(remoteAccessPointList),String(svcName)
-r-x suspendService Void : String(localAccessPoint),String(svcName)
-r-x suspendService Void : String(localAccessPoint),String(svcName),Boolean(isImport)
-r-x suspendService Void : String(svcName)
-r-x suspendService Void : String(svcName),Boolean(isImport) 
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> status=cmo.getServiceStatus()
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> print status[0].getServiceName()
TOUPPER
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> print
         weblogic.wtc.gwt.WTCServiceStatus.svcTypeToString(status[0].getServiceType())
IMPORT
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> print
         weblogic.wtc.gwt.WTCServiceStatus.statusToString(status[0].getStatus())
AVAILABLE
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> cmo.suspendService('TOUPPER')
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> status=cmo.getServiceStatus()
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> print
         weblogic.wtc.gwt.WTCServiceStatus.statusToString(status[0].getStatus())
SUSPENDED
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> cmo.resumeService('TOUPPER') 
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> status=cmo.getServiceStatus()
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> print
         weblogic.wtc.gwt.WTCServiceStatus.statusToString(status[0].getStatus())
AVAILABLE
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> print status[0].getServiceName()
TOUPPER 
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> cmo.suspendService('TDOM1','TOUPPER') 
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> status=cmo.getServiceStatus()
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> print status[0].getServiceName()
TOUPPER
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> print
         weblogic.wtc.gwt.WTCServiceStatus.statusToString(status[0].getStatus())
SUSPENDED
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> cmo.resumeService('TDOM1','TOUPPER') 
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> status=cmo.getServiceStatus()
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> print status[0].getServiceName()
TOUPPER
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> print
         weblogic.wtc.gwt.WTCServiceStatus.statusToString(status[0].getStatus())
AVAILABLE
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> 
wls:/mydomain/serverRuntime/WTCRuntime/WTCService> disconnect()
wls:/offline> exit()