Service Enabling the Tuxedo BankApp Sample with Oracle SALT

SALT stands for Service Architecture Leveraging Tuxedo. As its name suggests it is a web service extension for Tuxedo. It allows a SOAP web service client to call Tuxedo services and Tuxedo processes, client or server, to invoke a web service by making tpcall’s.

SALT was first introduced in 2006 and has been constantly involving. The latest release if 12.1.1, part of 12c Oracle Fusion Middleware release. One of the most notable feature of SALT 12c is the introduction of service discovery feature, which allows a developer or an administrator to select a set of running service and expose them as SOAP web services.

These SALT blogs will show how this service discovery works. But I will begin with a traditional one, first to make you understand what it takes to enable a Tuxedo application, also it will make you appreciate how service discovery has simplified the enablement process.

The Tuxedo application I chose to enable is BankApp, probably the second most well known Tuxedo app all around, after the famous (or infamous) SimpApp, which turns a character string either to upper or lower case. Both SimpApp and BankApp are of part of samples which can be installed with Tuxedo. I did not choose SimpApp as it is part of the SALT sample comes with installation.  Secondly, it is a really simple with just one string buffer argument. BankApp feels more real.

It is fairly simple to run the BankApp following the README file in the sample folder. After the BankApp is up and running, assuming using the ubbshm configuration file in Shared Memory mode, we need to add two servers to run the BankApp with SOAP web service: TMMETADATA, the Tuxedo Service Metadata Repository Server,  and GWWS, the Web Service Gateway Server. At runtime, a SOAP web service is invoked against the endpoint residing on GWWS server, which will translate the call into a Tuxedo service call. The translation, including converting the operation name into a Tuxedo service name, the SOAP input/output message into a Tuxedo buffer, and the XML elements into a FML/View fields in the Tuxedo buffer, is done by GWWS according to the service definition in the Tuxedo service metadata repository. GWWS loads this repository from TMMETADATA server at the start-up time.

To add these two servers in the Tuxedo configuration, we add the following line to ubbshm file’s “*GROUPs” section

GRPGWWS LMID=SITE1 GRPNO=10

and the following two lines to the “*SERVERS” section

TMMETADATA SRVGRP=GRPGWWS SRVID=40 CLOPT = "-A -- -f meta.repos"
GWWS SRVGRP=GRPGWWS SRVID=50 CLOPT="-A -- -i GWW1"

Also you need to increase the value of the following resources at the “*RESOURCE” section: MAXACCESSERS, MAXSERVERS and MAXSERVICES.  This is needed since we added two servers which need more IPC resources.

TMMETADATA server needs the meta.repos binary repository file, which is referred in the TMMEATADATA server line,  to run. GWWS server needs a saltconfig binary file, which is referenced by the SALTCONFIG environment variable.

To prepare the binary repository file we start with the text-based repository file, which defines the Tuxedo service: service name, input/output buffer type, and input/output fields in the buffer. For example, the DEPOSIT service is defined as:

service=DEPOSIT_1
servicetype=service
export=Y
inbuf=FML32
outbuf=FML32
tuxservice=DEPOSIT

param=ACCOUNT_ID
count=1
requiredcount=1
fldnum=110
type=long
access=in

param=SAMOUNT
count=1
requiredcount=1
fldnum=202
type=string
access=in

param=ACCOUNT_ID
count=1
requiredcount=1
fldnum=110
type=long
access=out

param=BALANCE
count=1
requiredcount=1
fldnum=105
type=float
access=out

param=SAMOUNT
count=1
requiredcount=1
fldnum=202
type=string
access=out

param=SBALANCE
count=1
requiredcount=1
fldnum=201
type=string
access=out

It is straightforward for most Tuxedo services. For this BankApp, we picked 6 services to be enabled, which are the 6 services you can run from the bankclt command line client program. I put all the 6 Tuxedo service definitions into the salt_bankapp.mif file, downloadable from salt_bankapp.mif.

It is a little more complicated to generate the SALT configuration file. We need to define two files: the web service description file, salt_bankapp.wsdf, and the SALT deployment configuration file, salt_bankapp.dep.

The following is salt_bankapp.wsdf:

<?xml version="1.0" encoding="UTF-8"?>
<Definition xmlns="http://www.bea.com/Tuxedo/WSDF/2007" name="BankApp" wsdlNamespace="urn:BankApp.wsdl">
  <WSBinding id="bankapp_binding">
	<Servicegroup id="bankclt">
	  <Service name="CLOSE_ACCT_1"/>
	  <Service name="DEPOSIT_1"/>
	  <Service name="INQUIRY_1"/>
	  <Service name="OPEN_ACCT_1"/>
	  <Service name="TRANSFER_1"/>
	  <Service name="WITHDRAWAL_1"/>
	</Servicegroup>
	<SOAP version="1.1" style="document" use="literal">
	  <AccessingPoints>
		<Endpoint address="http://localhost:9999/bankapp" id="bankapp_binding_port"></Endpoint>
	  </AccessingPoints>
	</SOAP>
  </WSBinding>
</Definition>

The file defines contains a Web Service Definition, a unit in the SALT deployment configuration. A definition consists of its name, a WSBinding with the names of the services, and an Endpoint. Please note that in the above the WSDF file, the definition name is “BankApp”, WSBinding has an id of “bankapp_binding” and the Endpoint id of “bankapp_binding_port”. They have to match Binding and Endpoint in the salt_bankapp.dep file:

<Deployment xmlns="http://www.bea.com/Tuxedo/SALTDEPLOY/2007">
  <WSDF>
	<Import location="salt_bankapp.wsdf"/>
  </WSDF>
  <WSGateway>
	<GWInstance id="GWW1">
	  <Inbound>
		<Binding ref="BankApp:bankapp_binding">
		  <Endpoint use="bankapp_binding_port"></Endpoint>
		</Binding>
	  </Inbound>
	  <Properties/>
	</GWInstance>
  </WSGateway>
  <System/>
</Deployment>

Note also the GWInstance id of “GWW1”, it has to be same as the one given by GWWS server’s  ‘-i’ option in the UBB file.

Finally add SALTCONFIG environment to the full path of the binary saltconfig file in bankvar (or bankvar.cmd). Run bankvar to set the environment variable and run the following commands in bash (or Windows Command Prompt):

. bankvar
tmloadrepos -i salt_bankapp.mif meta.repos
wsloadcf -y salt_bankapp.dep
tmloadcf -y ubbshm
tmboot -y

The web service enabled Bankapp domain should be up and running.  You can run the command

tmwsdlgen -c salt_bankapp.wsdf -o bankapp.wsdl

to generate the WSDL file in bankapp.wsdl, or in tuxedo.wsdl without the -o option.

The WSDL can also be access at  http://localhost:9999/wsdl?id=BankApp. Launch SoapUI, create a project with the above WSDL URL, and have fun to try the BankApp with SOAP web services.

Add Your Comment