Calling Tuxedo Web Services from SOA Suite

<Do not delete this text because it is a placeholder for the generated list of "main" topics when run in a browser>

Purpose

In this tutorial, you learn how to configure all the components required to call Oracle Tuxedo services from Oracle SOA Suite, using the Oracle Service Architecture Leveraging Tuxedo (SALT) product.

After completing this course, you should be able to:

Time to Complete

Approximately 8 hours including product download and installation time.

Overview

Oracle SALT enables developers and administrators to expose Tuxedo services as Web services. SOA Suite can leverage its ability to act as a Web service client to integrate Tuxedo service calls into its various product offerings, such as BPEL PM process flows.

This OBE guides you through constructing an application that demonstrates a Web application that acts as the front end for a SOA Suite BPEL process that manages calling Tuxedo Web services using the SALT SOAP server gateway. The back end for the uBike application is written in Tuxedo. Read the uBike Tuxedo Overview page for detailed information about the back -end services offered on the Tuxedo side of this application.

Scenario

In this tutorial, you begin by creating a WebLogic Server domain that includes the extensions for running SOA Suite. This is going to be a single server domain. Next, you configure the SALT environment to expose uBike Tuxedo services as Web services that can be called by BPEL, and test that your Web services are working using soapUI. Then, you create, deploy, and test the BPEL SOA composite application that calls the uBike Web services. Finally, you import and modify the uBike Web application front end that calls the BPEL process to test the end-to-end solution.

Your company has a pre-existing application, called uBike, that is implemented using Tuxedo. The company is investigating how to leverage this IT investment to work within their overall SOA strategy without making major and expensive changes. The company uses Oracle SOA Suite and WebLogic Server for their application server tier, and has decided to use Oracle SALT to expose their existing uBike Tuxedo services as Web services that can be easily consumed by both products. This strategy integrates existing technologies to enable the application server tier to freely use Tuxedo services with very little change.

The diagram below displays the high-level architecture of the solution:

Software Requirements

The following is a list of software requirements:

Prerequisites

NOTE: Oracle 10g products should be installed into a separate MIDDLEWARE_HOME than Oracle 11g products.

Before starting this tutorial, you should have performed the following in the order specified:

. Installed Oracle XE 10g Universal Database, or other supported Oracle database for SOA Suite 11g PS1. The Oracle XE database was chosen for its smaller footprint and the likelihood that most people would have this database installed on their machine.

Make sure to run these steps to increase Oracle XE's processing capabilities for use with this lab:

Open a command window and run the following commands after the database is installed:

  • sqlplus "/as sysdba"
  • alter system set processes = 200 scope = spfile;
  • alter system set sessions = 400 scope = spfile;
  • alter system set transactions = 360 scope = spfile;
  • shutdown immediate
  • startup

To verify your new settings run the following commands:

  • select name, value
    from v$parameter
    where name in ('processes', 'sessions', 'transactions');

Run the following commands to exit sqlplus

  • quit
.

Installed and run the Repository Creation Utility (RCU) 11.1.1.2.0 to create the schemas for SOA Suite (instructions)

NOTE: If you observe a message while running this tool such as, "The database you are connecting to is not a supported version...", simply ignore the message and processing should continue successfully.

. Installed Oracle Tuxedo 10gR3 (instructions)
. Installed Oracle SALT 10gR3 (instructions)
. Installed Oracle SALT 10gR3 8252856 Patch (instructions)
. Installed Oracle WebLogic Server 11g (instructions)
. Installed JDeveloper 11g (instructions) and JDeveloper Extensions for SOA Applications 11g (instructions)
. Installed Oracle SOA Suite 11g PS1 (instructions)
. Completed the Using the Oracle Service Bus Tuxedo Transport OBE which prepares the following dependencies for this OBE:
  • Installing and configuring Tuxedo 10gR3
  • Installing and configuring Microsoft Visual Studio 2005
  • Installing and configuring the uBike Tuxedo application

Create WebLogic/SOA Suite Domain

The default domain configuration for SOA Suite involves creating a WebLogic AdminServer, and two managed servers for SOA Suite and BAM. We are not using BAM in this tutorial. You will create a domain that includes WebLogic and SOA Suite components all within a single JVM environment for this lab. This lowers the overall memory footprint required to run the tutorial, making it possible to run on machines with less physical RAM.

Follow the steps below to create your single-server domain:

.

Run the Configuration Wizard:

Click Start > Oracle SOA 11g - Home 1 > Configure Application Server to start the Configuration Wizard.

 

.

Welcome:

Choose Create a new WebLogic domain and click the Next button.


.

Select Domain Source:

Select the Oracle SOA Suite and Oracle Enterprise Manager check boxes, and click the Next button. All dependent products are selected automatically.

 

.

Specify Domain Name and Location:

Create the uBike domain at C:\uBike\uBikeSOADomain to keep your lab work in a single location. If you have been following the directory structure that this tutorial uses, then your Tuxedo uBike application is located in C:\uBike.

Enter the values below and click the Next button:

Parameter
Value
Domain Name
uBikeSOADomain
Domain Location
C:\uBike
Application Location
C:\uBike\uBikeSOADomain\applications

 

 

.

Configure Administrator User Name and Password:

Enter weblogic as the user name, welcome1 as the password, and click the Next button.

 

.

Configure Server Start Mode and JDK:

Keep the default values of Development Mode and the Sun JDK 1.6.0_x and click the Next button.

 

.

Configure JDBC Component Schema:

Select all of the check boxes for the component schemas to allow editing for all entries at once.

Set the values as specified in the table below, and click the Next button.

Parameter
Value
Vendor
Oracle
Driver
Oracle's Driver (Thin) for Service connections; ...
Schema Owner
Varies among component schemas
Schema Password
The password you entered when you created the schemas using RCU
DBMS/Service

If you are using Oracle XE, then set this to xe

If you are using the regular Oracle database, then set this to orcl

Host Name
The host name of the computer where you are creating the domain
Port
1521

 

 

.

Test Component Schema:

The next screen tests the database configurations you just set. Ensure that all connection tests are successful, and click the Next button.

 

.

Select Optional Configuration:

Select the Managed Servers, Clusters and Machines check box to modify these settings for your domain, and click the Next button.

 

.

Configure Managed Servers:

You should see a managed server entry, called soa_server1. Delete this entry, and click the Next button.

 

.

Configure Clusters:

There are no clusters to configure so just click the Next button.

 

.

Configure Machines:

Leave the default LocalMachine settings, and click the Next button.

 

.

Assign Servers to Machines:

Assign the AdminServer to LocalMachine, and click the Next button.

 

.

Configuration Summary:

Note that all SOA Suite components are listed under the AdminServer. When ready, click the Create button.

 

.

Creating Domain:

Examine the progress and output to determine that your domain was created successfully, do not select the Start Admin Server check box, and click the Done button.

 

.

Change the memory settings of the AdminServer:

  • Edit C:\uBike\uBikeSOADomain\bin\setSOADomainEnv.cmd

        Change DEFAULT_MEM_ARGS=-Xms512m -Xmx1024m to
                        DEFAULT_MEM_ARGS=-Xms768m -Xmx768m

        Change DEFAULT_MEM_ARGS=%DEFAULT_MEM_ARGS% -XX:PermSize=128m -XX:MaxPermSize=512m to
                        DEFAULT_MEM_ARGS=%DEFAULT_MEM_ARGS% -XX:PermSize=512m -XX:MaxPermSize=512m

Save your changes and continue.

NOTE: You can try higher settings for maximum heap sizes if your machine will allow. This environment would not allow higher settings.

 

.

Run SOA 11g Server:

Double-click C:\uBike\uBikeSOADomain\startWebLogic.cmd to start the server. Wait a few minutes until the the server shows a RUNNING state.

 

Configure SALT and TMMETADATA Servers


To expose the uBike Tuxedo services as Web services, perform the following steps:

Set up SALT Files


. Extract installation files:

  • Unzip the uBikeSALT.zip file to C:\uBike, which will create a C:\uBike\uBikePlugin folder structure
  • Unzip the uBikeSOAClient.zip file to C:\uBike, which will create a C:\uBike\uBikeSOAClient folder structure

                                

The uBikePlugin folder contains files that relate to configuring SALT, and the uBikeSOAClient folder contains an ant build script that compiles Web service client classes from your SALT WSDL.

The table below describes the purpose of each file:

File
Purpose
BikeList.xsd
This file contains the custom schema that is used by the custom mapping plugin to convert from FML32 buffer fields to a list of bikes, which is returned by the SEARCHINVENTORY uBike Tuxedo service. This schema has changed slightly from the similar schema used in the OSB Tuxedo Transport OBE.
makefile
This file contains the build rules for compiling all the code and creating the mapping_plugin.dll file that will be loaded by SALT as a custom mapping plugin.
mapping_ids.c
This file contains the registration information for your mapping plugin. It specifies the number of plugins, the plugin IDs, and the names of the plugins in the .dll file. This file exposes a method called _ws_pi_get_Id_and_Names() function that is called by SALT to register the plugin.
mapping_plugin.dll.manifest
This is a specialized file for .Net and is not the focus of the tutorial.
mapping plugin.ex
This file contains the function names that are contained within your .dll file.
mapping_plugin.h
This is a header file that includes the necessary header file definitions required for Tuxedo mapping plugins.
mapping_uBike.cpp
This file contains the code that registers the plugin and performs the actual mapping from FML32 fields to the BikeList XML schema.
uBike.salt

This file contains the SALT configuration file that is converted into binary form using wsloadcf. The binary file is created in the location specified by the SALTCONFIG environment variable. The binary file is read by the SALT GWWS server. This file specifies the Web Service Definition Files (WSDF), endpoints, and plugins used by this GWWS server.

uBike.wsdf
This file contains the configuration details of your SALT Web services. It defines the services, message handling routines, and SOAP configuration for the uBike SALT Web services.
uBikeSOA.meta
This file contains the service contracts for all the uBike Tuxedo services. It also specifies an external schema for custom mapping for the output of the SEARCHINVENTORY service.
build.xml
This is an ant build file to create the jar file containing all of the Web service client classes for calling the uBike SALT Web services.

 

.

Modify setenv.cmd:

Edit the C:\uBike\setenv.cmd file and make the following changes:

  • Add XSDDIR and XSDFILES entries so SALT can find your external XML schema files:

    @set XSDDIR=%APPDIR%\uBikePlugin
    @set XSDFILES=BikeList.xsd

  • Add the uBikePlugin folder to the path so SALT can load your mapping_plugin.dll file:

    @set PATH=%PATH%;%TUXDIR%\bin;%APPDIR%\uBikePlugin

  • Add SALTCONFIG entry so wsloadcf can create your binary SALT configuration, and so the GWWS server can read it:

    @set SALTCONFIG=%APPDIR%\SALTCONFIG

Create Metadata Repository


. Examine BikeList.xsd:

Open C:\uBike\uBikePlugin\BikeList.xsd to examine its contents. You will notice that this file has changed somewhat from the previous OSB Tuxedo Transport OBE. The data is basically the same, but simplified and changed to work with SALT.

This schema represents the XML data to which we will map the SEARCHINVENTORY service's output FML32 fields. You will see how we reference this schema in the next step.


. Examine uBikeSOA.meta:

Just as you had to create a metadata repository to define the SEARCHINVENTORY service contract, SALT requires that you define a service contract for all Tuxedo services you want to expose as Web services. In this OBE we will handle the transformation of FML32 fields to the BikeList XML schema types using the SALT custom mapping plugin feature.

Open the C:\uBike\uBikePlugin\uBikeSOA.meta file and examine its contents.

The service contract for SEARCHINVENTORY is slightly different in that all the fields are now configured as input only, and no output fields are defined. The outbufschema parameter references the BikeList element within the BikeList.xsd file. SALT will try to find the BikeList element within the http://www.uBike.org/bikelist namespace by searching all files that are specified using the XSDDIR and XSDFILES environment variables. There is no need to define output fields for a service when you configure the outbufschema parameter to use an external schema. It is also possible to define inbufschema and errbufschema parameters.

You should note that there are three other services defined in the uBikeSOA.meta file: ORDERITEM, MODIFYITEM, and SOLDITEM. Each of these services uses simple input and output parameters, so none of them use an external schema.

View the image below to learn more about the outbufschema parameter:

 

. Create metadata repository:

Double-click the C:\uBike\DOSPrompt.cmd file to open a command window.

  • Set the environment using setenv.cmd:

    setenv.cmd

  • Run the following command within the C:\uBike\uBikePlugin folder to create the metadata repository:

    tmloadrepos -e -i uBikeSOA.meta -y ..\metarepo

 

Modify uBike WSDF File


. Examine and modify uBike.wsdf:

Open the C:\uBike\uBikePlugin\uBike.wsdf file and examine its contents.

The WSDF file defines Web service binding details for the Tuxedo services you want to expose as Web services. The uBike.wsdf file defines a Web service that exposes the SEARCHINVENTORY, ORDERITEM, MODIFYITEM, and SOLDITEM Tuxedo services offered by the uBike application. The SEARCHINVENTORY service has a message handler, called BikeConvert, configured to map its output FML32 fields to the XML elements defined in BikeList.xsd. Additionally, the uBike.wsdf file is configured to use the "doc literal" style of SOAP binding, and specifies the endpoint address of http://hostname:8080/uBike where the Web service will be hosted. The endpoint is given an ID of uBike_GWWS_HTTPPort", which is a string value that must match in the corresponding uBike.salt file covered in the next section.

  • Take note of the name attribute value of the Definition element, and the id attribute value of the WSBinding element, as these values are also used in the uBike.salt file.
  • Change the host name value for the Endpoint element from arcyne to your host name and save your changes:

    <Endpoint address="http://<your-host_name>:8080/uBike" id="uBike_GWWS_HTTPPort"/>

  • View the image below to learn more about the uBike.wsdf configuration:

It is important that this file is correct as it will be referenced by the uBike.salt file, and is used when running the wsloadcf command to create the binary SALTCONFIG file in the next section.

 

Create SALTCONFIG File


. Examine uBike.salt:

Open the C:\uBike\uBikePlugin\uBike.salt file and examine its contents.

The uBike.salt file is a text file that is converted to a binary SALTCONFIG file using wsloadcf. The binary SALTCONFIG file location is determined by the SALTCONFIG environment variable that you set in the setenv.cmd file. When you run wsloadcf, the uBike.salt file is read and the binary SALTCONFIG file is created. This file is read by the SALT GWWS server at run time to get the configuration for the Tuxedo services it will expose as Web services.

The uBike.salt file is where the configuration defined in the uBike.wsdf file is realized. The uBike.wsdf file is imported, and becomes part of the overall SALT configuration.

The WSGateway element defines the gateway instance, providing a unique ID that is used by the SALT GWWS server, and the binding configuration points to use from the uBike.wsdf file.

The System element defines the configuration for anything that is system-specific, such as the name of the custom mapping plugin library to load when the GWWS server starts.

View the image below to learn more about the uBike.salt configuration:

 

. Run wsloadcf:

  • Within the same command window, run the following command within the C:\uBike\uBikePlugin folder to create the binary SALTCONFIG file:

    wsloadcf -y uBike.salt


Examine and Create Custom Mapping Plugin


. Examine mapping_ids.c:

The mapping_ids.c file provides information to register the custom mapping plugin. It registers the ID, which is a set SALT name, P_CUSTOM_TYPE, and the name of the plugin, BikeConvert, which maps to the MsgHandler element name in the uBike.wsdf file.

Open the C:\uBike\uBikePlugin\mapping_ids.c file and examine its contents.

 

. Examine mapping_uBike.cpp:

Most of the code in the mapping_uBike.cpp file is boilerplate code that does not need to be changed. The code is already completed for you for this tutorial, and you are examining it to learn by seeing a working example.

The mapping_uBike.cpp file implements four (4) functions. The table below describes each function:

Function
Purpose
_ws_pi_init_P_CUSTOM_TYPE_BikeConvert
Initializes the XML parser for performing XML coding
_ws_pi_set_vtbl_P_CUSTOM_TYPE_BikeConvert
Configures the function pointers for the input and output buffer mapping routines. In this example, the input buffer is NULL since we do not do any mapping for the input buffer. The output buffer points to the ConvertFML32_2_XML() function, which will perform the mapping of FML32 fields to the BikeList XML schema types.
ConvertFML32_2_XML
Performs the actual conversion from FML32 fields to XML that follows the BikeList.xsd schema. It uses FML32 APIs to get data from the Tuxedo FML32 buffer, then uses that data to create the XML payload that gets returned.
_ws_pi_exit_P_CUSTOM_TYPE_BikeConvert
Frees up any resources used by the plugin in preparation for exit

Open the C:\uBike\uBikePlugin\mapping_uBike.cpp file and examine its contents. Find each of the functions listed above (in order) and examine what they do to become familiar with what each should look like.

 

. Build mapping_plugin.dll:

Within the same command window, enter the following command within the C:\uBike\uBikePlugin folder to build the mapping_plugin.dll library:

nmake

Now that all of the SALT artifacts have been configured and created, you can modify the uBike.ubb file to add the TMMETADATA and SALT GWWS SOAP servers.

 

Modify UBB Configuration File and Run Tuxedo


. Modify uBike.ubb:

Open the C:\uBike\uBike.ubb file in a text editor.

  • Add the following group configuration as the last group in the *GROUPS section:

    SOA
       LMID = uBike
       GRPNO = 3

  • Add the following server configuration right before the WSL server in the *SERVERS section:

    TMMETADATA
       SRVGRP = SOA
       SRVID = 10
       CLOPT = "-A -- -f metarepo"
    GWWS
       SRVGRP = SOA
       SRVID = 20
       CLOPT = "-A -- -i SOAPGW"
       REPLYQ = Y

NOTE: The TMMETADATA server must be configured to start before the GWWS server. This is because the GWWS server calls services that are advertised by the TMMETADATA server to access the service contract information contained in the binary metadata repository.

Your file should look similar to the following:

 

. Reload TUXCONFIG:

In the same command window, enter the following to reload the TUXCONFIG file:

tmloadcf -y uBike.ubb


. Run Tuxedo :

In the same command window, enter the following to start the Tuxedo domain:

tmboot -y

Examine the ULOG file for today's date in the C:\uBike folder to verify that the GWWS server loaded the library correctly as shown in the screenshot below:

Now that Tuxedo is started with its new SALT configuration, you can test your SALT Web services to see that your uBike Tuxedo services are being called and operate as expected.


Test uBike SALT Web services using soapUI


. Test GWWS server WSDL and XSD configuration:

  • Enter the following into a Web browser address bar to see if the SALT GWWS server serves the uBike WSDL:

    http://<your-host-name>:8080/wsdl

View the image below to see an excerpt of the WSDL file that relates to the BikeList.xsd file:

  • Enter the following into a Web browser address bar to see if the SALT GWWS server serves the BikeList.xsd schema:

    http://<your-host-name>:8080/xsd/BikeList.xsd

View the image below to see that the BikeList.xsd schema matches the one we configured with SALT:

Now that you have a valid WSDL that uses the BikeList schema, you can use soapUI to test the Web services themselves.

 

. Run soapUI from the Start menu:

Open soapUI by clicking Start>soapUI 3.0.1>soupUI-3.0.1.

 

. Create soapUI workspace:

Right-click the Projects node in the left-hand pane, and select New Workspace.

Enter uBikeSOA as the name of the workspace and click the OK button.

Select the location where to save the workspace file, such as C:\uBike\SOAPUI.

 

. Create soapUI project:

Right-click the uBikeSOA workspace node in the left-hand pane, and select New soapUI Project.

Enter uBikeSOAProject for the project name and http:/<your-host-name>:8080/wsdl for the Initial WSDL property, and click the OK button.

NOTE: If this step fails, and your Tuxedo servers are running, keep trying a few times by clicking the OK button again. Sometimes it takes a few tries.


. Test SEARCHINVENTORY:

Expand the SEARCHINVENTORY node in the uBikeSOAProject and double-click the Request1 node to open the SOAP request and response payload window.

Modify the payload contents to send a request to the SEARCHINVENTORY service with a SKU element of RJ4500. Your payload should look similar to the payload in the image below:

Click the icon to submit the request to the SEARCHINVENTORY service. You should see a list of bicycles returned in the response window as shown in the image below:

Now that you have validated that the SEARCHINVENTORY service is working properly, let's test the ORDERITEM service.

NOTE: If you like, you can open the Tuxedo administration client, tmadmin, to monitor that your Tuxedo services are actually being called. The tmadmin command used to monitor Tuxedo services is called printserver, or psc for short.

 

. Test ORDERITEM:

Expand the ORDERITEM node in the uBikeSOAProject and double-click the Request1 node to open the SOAP request and response payload window.

Modify the payload contents to send a request to the ORDERITEM service with the following elements:

  • A SKU element of RJ4500
  • A SIZE element of 19
  • A COLOR element of BLACK

Your payload should look similar to the payload in the image below:

Click the icon to submit the request to the ORDERITEM service. You should see a status message returned in the response window as shown in the image below:

Examine the data returned in the STATUS element returned. It informs you of the successful status of entering a new bike into the inventory, as well as the new SERIALNO for the inserted bike record. If you execute the SEARCHINVENTORY service again, you should see this new bike appear at the end of the response as shown in the image below:

Now that you have validated that the ORDERITEM service is working properly, let's test the MODIFYITEM service.


. Test MODIFYITEM:

Record the SERIALNO value returned by the ORDERITEM service.

Expand the MODIFYITEM node in the uBikeSOAProject and double-click the Request1 node to open the SOAP request and response payload window.

Modify the payload contents to send a request to the MODIFYITEM service with the following elements:

  • A SERIALNO element with the value returned from the ORDERITEM service
  • A COLOR element of SILVER

Your payload should look similar to the payload in the image below:

Click the icon to submit the request to the ORDERITEM service. You should see a status message returned in the response window as shown in the image below:

Examine the data returned in the STATUS element returned. It informs you of the successful status of modifying a bike in the inventory, as well as the SERIALNO for the updated bike record. If you execute the SEARCHINVENTORY service again, you should see the updated bike information at the end of the response as shown in the image below:

Now that you have validated that the MODIFYITEM service is working properly, let's test the last service, SOLDITEM.

 

. Test SOLDITEM:

View the bicycle list returned by the SEARCHINVENTORY service. Locate a bicycle that is in stock <INSTOCK>Y</INSTOCK>. Record the SERIALNO value of this bicycle. The SOLDITEM service is going to delete this record from the inventory.

Expand the SOLDITEM node in the uBikeSOAProject and double-click the Request1 node to open the SOAP request and response payload window.

Modify the payload contents to send a request to the SOLDITEM service with the following elements:

  • A SERIALNO element with the value recorded previously

Your payload should look similar to the payload in the image below:

Click the icon to submit the request to the SOLDITEM service. You should see a status message returned in the response window as shown in the image below:

Examine the data returned in the STATUS element returned. It informs you of the successful status of deleting a bike from the inventory, as well as the SERIALNO for the deleted bike record.

Execute the SEARCHINVENTORY service again, with the payload shown in the image below, using your SERIALNO value.

You should see that the deleted bike information is not returned in the response as shown in the image below:

Now that you have verified that all your Tuxedo services, associated SALT Web services, and mapping plugin are functioning correctly, you can begin working on the SOA Suite aspect of the tutorial.


Create and Configure BPEL SOA Composite Application

To create, configure, and test a BPEL process that calls the SALT Web services, perform the following steps:

Create SOA Composite Application


. Create SOA Application:

Open JDeveloper Studio 11g, and click New Application...

Enter the following data on the Name your application dialog and click the Next button.

Parameter
Value
Application Name:
uBikeSOAApplication
Directory:
C:\uBike\uBikeJDev\uBikeSOAApplication
Application Package Prefix:
Leave blank
Application Template:
SOA Application

 

Enter a project name of uBikeComposite on the Name your project dialog , leave the other parameters at the default settings, and click the Next button.

On the Configure SOA Settings dialog, select Composite With BPEL and click the Finish button. This creates your SOA Application, opens the composite.xml file for your application, and then automatically opens the Create BPEL Process configuration wizard because you selected BPEL as part of your composite's settings.

Open Windows Explorer and browse to C:\uBike\uBikeJDev\uBikeSOAApplication. This is your workspace folder for this tutorial. The uBikeComposite project can be seen in this folder now. All other projects that are created within this application will be stored in this location.

 

. Create BPEL Process:

On the BPEL Process dialog, enter the following parameters, and click the OK button.

Parameter
Value
Name:
OrderItemBPELProcess
Namespace:
Leave as default
Template:
Synchronous BPEL Process
Service Name:
orderitembpelprocess_client
Expose as a SOAP Service:
true
Input:
Leave as default
Output:
Leave as default

Now you should see the OrderItemBPELProcess.bpel file displayed in JDeveloper as follows:

 

Configure BPEL Process


. Add a Web service reference to SOA composite:

Click the composite.xml tab to display the SOA composite design view. Drag the Web Service component from the Component Palette to the External References column in the design view to add and configure your uBike service to the composite.

In the Web Service dialog, enter the following values, and click the OK button.

Parameter
Value
Name:
uBikeSALTWebServices
Type:
Reference
WSDL URL:
http://<your-host-name>:8080/wsdl
Port Type:
Should populate with uBike_PortType
Callback Port Type:
---- No Callback ----
Copy wsdl and its dependent artifacts into the project:
true

When the Localize Files dialog appears, make sure Maintain original directory structure for imported files and Localize external references are both selected as shown in the image below. Since you elected to copy the WSDL and its dependent artifacts, such as BikeList.xsd, you need to ensure that the dependency between these two files is maintained by keeping them in the same directory structure. In this case, they are in the same directory, and this results in keeping them in the same directly instead of moving the BikeList.xsd file into the SOA composite's xsd folder. Click the OK button when finished.

Your screen should now look like the following image:

You just imported the uBike service for use in your SOA composite, but it isn't ready to use yet. The next step shows you how to make it work with your BPEL process.

 

. Configure BPEL process to use Web service partner link:

On the composite.xml design view, drag a line from the icon of the OrderItemBPELProcess component to the icon of the uBikeSALTWebService component to add it as a partner link to the BPEL process.

When you are done, your screen should look like the following image:

Double-click the OrderItemBPELProcess component in the Components column to open the BPEL design view of the BPEL process. Drag the Invoke BPEL activity from the Component Palette to the area between the receiveInput and replyOutput activities.

Your screen should look like the image below:

Drag a line from the icon from the Invoke_1 activity to the uBikeSALTWebService component in the Partner Links column as depicted in the image below. This will cause the Edit Invoke wizard to appear.

In the Edit Invoke screen, enter the following values. When you are finished, click the OK button.

Parameter
Value
Name:
InvokeOrderItem
Interaction Type:
Partner Link
Partner Link:
uBikeSALTWebServices
Operation:
ORDERITEM
Input:
Use the BLAH icon to enter the input variable for the service call. When the dialog opens, keep the default names and the Global Variable settings. When you are finished, click the OK button.
Output:
Use the BLAH icon to enter the output variable for the service call. When the dialog opens, keep the default names and the Global Variable settings. When you are finished, click the OK button.

 

Your screen should look like the following image:

Now that the uBike service has been configured for the BPEL process, you need to map the input and output variables from your SOA composite to the uBike service.


.

Map BPEL process input and output payload to uBike Web service payloads:

Drag the Assign activity from the Component Palette between the receiveInput and InvokeOrderItem components.

Your screen should look like the following image:

Repeat the assign activity for the output parameters, as shown in the image below.

Before you can perform any data mapping, you need to modify the schema that determines the payload of the input data so that it can match what is expected by the Web service. You do this by opening the schema file that is related to this process, which in this case is called OrderItemBPELProcess.xsd. Open this file in JDeveloper by expanding the uBikeComposite/xsd folder, and double-clicking the file name. Your screen should like like the following image:

Change the input element by clicking the name of the element so that it is highlighted, and then enter SKU as the new element name. For the next two elements, drag the element type from the Schema Components list onto the icon in the design view of the schema two times. Use the table below to set the name and type of each element and compare them to the image below. To change the type of an element, right-click the element and select Set Type. When you are done, you can close the schema file and continue working on the OrderItemBPELProcess.bpel file.

Element Name
Element Type
SKU
string
SIZE
long
COLOR
string

 

Double-click the Assign_1 activity in the BPEL design view to map the input parameters from the SOA composite service to the uBike service. In the Assign dialog, click the icon and select Copy Operation...

The input variable name for the SOA composite entry point is called, inputVariable. The input variable name for the uBike service is called, InvokeOrderItem_ORDERITEM_InputVariable. Map the SKU, SIZE, and COLOR elements from the inputVariable schema to the InvokeOrderItem_ORDERITEM_InputVariable schema as shown in the image below. You will need to perform a separate copy operation for each element.

Your screen should like the following image when all three copy operations are completed. Click the OK button to continue.

Double-click the Assign_2 activity in the BPEL design view to map the output parameters from the uBike service to the SOA composite service. In the Assign dialog, click the icon and select Copy Operation... Map the InvokeOrderItem_ORDERITEM_OutputVariable STATUS element to the outputVariable result element, and click the OK button. Click the OK button on the Assign dialog to return to the BPEL process view.

You have completed the BPEL process creation and configurations steps. Now you are ready to deploy and test the component on the application server.

 

Create Application Server Connection


. Open Application Server Connection Wizard:

In JDeveloper, click File > New...

Select General > Connections > Application Server Connection and click the OK button.

This opens up the Create Application Server Connection Wizard.

 

. Create Application Server Connection: Step 1 of 5:

Enter MyWebLogicConnection as the name of this connection.

Leave the default Connection Type as WebLogic 10.3, and click the Next button.


. Create Application Server Connection: Step 2 of 5:

Enter weblogic as the username, welcome1 as the password for this connection, and click the Next button.


. Create Application Server Connection: Step 3 of 5:

Enter uBikeSOADomain for WebLogic Domain, leave the rest of the fields at their default values, and click the Next button.


. Create Application Server Connection: Step 4 of 5:

On the Test page, click the Test Connection button to see if JDeveloper can connect to your application server domain. Your domain must be running for this step to work. Click the Next button to continue.


. Create Application Server Connection: Step 5 of 5:

On the Finish page, review that your connection has been created successfully, and click the Finish button.


Deploy and Test BPEL Process


. Disable JDeveloper Proxy Settings:

Click Tools > Preferences > Web Browser and Proxy, and deselect the Use HTTP Proxy Server if it is set. This can cause your deployment to fail if it is set. Click the OK button.

 

. Deploy uBikeComposite:

Right-click the uBikeComposite project in the Application tab, and select Deploy > uBikeComposite...


. Deployment Action:

Select Deploy to Application Server and click the Next button.


. Deploy Configuration:

Select the Overwrite any existing composites with the same revision ID check box, leave all other fields as their default, and click the Next button.


. Select Server:

Select MyWebLogicConnection as the Application Server Connection to use, and click the Next button.


. SOA Servers:

Select the Admin Server check box, and click the Next button.


. Summary:

Review the configuration and click the Finish button.


. Authorization request:

When JDeveloper prompts you for login credentials, enter weblogic for the username and welcome1 for the password. Click the OK button to submit.


. Monitor SOA Log:

JDeveloper begins to build the uBikeComposite application. Click the SOA tab to view the progress of the build. If you see some warnings or errors regarding an unexpected namespace:id you can ignore them for now.


. Deployment Log:

Click the Deployment tab to view the progress of the deployment process. Make sure there are no deployment errors.


. Open Enterprise Manager to Test uBikeComposite:

  • Browse to http://localhost:7001/em to open Enterprise Manager.
  • Log in using weblogic as the username, and welcome1 as the password.
  • Expand the SOA>soa-infra (Admin Server) node in the left-hand pane to reveal the uBikeComposite [1.0] application, and click the uBikeComposite application to load its summary page.


. Open Test Service Page:

Click the Test button to open the test page for uBikeComposite.


. Enter Test Data:

  • Prior to entering the data for the test, run tmadmin in your Tuxedo command shell, and run its psc command. This will print out the service information of the Tuxedo environment. Find the entry for the ORDERITEM service, and take note of how many service requests it has done by looking at the number in the Done column.
  • Scroll to the bottom of the test page until you can see the Input Arguments section
  • Enter RJ4500 for the SKU, 21 for the SIZE, and YELLOW for the COLOR


. Review Results:

Click the Test Web Service button to run the test.

You should see a success message showing that the service has been called successfully, and the new SERIALNO value of the newly inserted bicycle record as shown in the image below:

Now you have successfully deployed and tested your SOA composite that calls Tuxedo Web services using SALT. The next section guides you through configuring a Web application to call the BPEL process within your SOA composite, which will in turn call your Tuxedo ORDERITEM service, using the SALT gateway.


Import and Modify uBike Web Application

This section guides you through adding the uBikeWeb application to your JDeveloper workspace, reviewing its code to become familiar with how it works, and developing the missing parts of the application that complete the end-to-end integration of this tutorial.

Import uBike Web Application


. Install uBikeWeb Application:

Extract the contents of uBikeWeb.zip to C:\uBike\uBikeJDev\uBikeSOAApplication. This should create a folder structure with uBikeWeb directly within the uBikeSOAApplication folder as shown below:

 

. Open uBikeWeb Project:

In JDeveloper, right-click uBikeSOAApplication and select Open Project...

Browse to and select the C:\uBike\uBikeJDev\uBikeSOAApplication\uBikeWeb\uBikeWeb.jpr file, and click the Open button.

In the JDeveloper Application tab, expand the uBikeWeb application so it looks like the image below:

You have the uBikeWeb application opened within your JDeveloper workspace, but it is missing a few key aspects of the code required to call SALT Web services directly, and to call the entry point into the BPEL process that calls the ORDERITEM service through the SALT gateway. The next section takes you through the steps required to accomplish these tasks.


Modify uBike Web Application


. Build & Install uBike SALT Web Service Client Classes:

  • Double-click C:\uBike\DOSPrompt.cmd to open a command shell.
  • Enter setenv.cmd to set the Tuxedo environment.
  • Enter uBikeSOADomain\bin\setDomainEnv.cmd to set the WebLogic environment.
  • Change to the C:\uBike\uBikeSOAClient folder.
  • Open the build.xml file and modify the line: wsdl="http://arcyne:8080/wsdl" to wsdl="http://<your-host-name>:8080/wsdl" and save your changes .
  • Enter ant to build the Web service client artifacts needed to call SALT Web services.
        

         NOTE: If this fails, keep trying a few times until it works. There is a known issue in that
         the SALT server appends some extra characters to the end of the BikeList.xsd file, which
         causes this process to fail. If it does not work, then use your Web browser to load
         http://<your-host-name>:8080/wsdl and http://<your-host-name>:8080/xsd/BikeList.xsd, and save the contents
         to the C:\uBike\uBikePlugin folder. Make sure to remove the extra characters from the BikeList.xsd file
         prior to saving. You may also need to modify the WSDL file's import element to point
         to the local BikeList.xsd file by changing it to schemaLocation="BikeList.xsd". You may need
         to use your browser's View Source feature to see the contents of the files. If so,
         simply copy and paste the contents into the files manually. This will also require modifying the
         URL parameter in the build.xml file to point to your saved WSDL file instead of the browser page.

  • You should see a successful run of ant as shown in the image below:

  • Copy the uBikeSOAClient.jar file to C:\uBike\uBikeJDev\uBikeSOAApplication\uBikeWeb\WebContent\WEB-INF\lib


. Build & Install uBike BPEL Web Service Client Classes:

  • Unzip the uBikeBPELClient.zip file to C:\uBike, which will create a C:\uBike\uBikeBPELClient folder structure

Within the same command shell window that was used in the last step:

  • Change to the C:\uBike\uBikeBPELClient folder
  • Enter ant to build the Web service client artifacts needed to call the BPEL entry point
  • You should see a successful run of ant as shown in the image below

  • Copy the uBikeBPELClient.jar file to C:\uBike\uBikeJDev\uBikeSOAApplication\uBikeWeb\WebContent\WEB-INF\lib


. Modify uBikeWeb Project Libraries:

  • In JDeveloper, right-click the uBikeWeb project, and select Project Properties...

  • In the Project Properties dialog, select Libraries and Classpath on the left-hand side.
  • Locate the Wls-api.jar, Wsse.jar, Javax.xml.rpc_1.2.1.jar, and Weblogic.jar files in your ORACLE_HOME\wlserver_10.3\server\lib and ORACLE_HOME\modules folders. You will need to remove the existing entries from JDeveloper, and manually add each of these jar files using the Add JAR/Directory button
  • Use the Add JAR/Directory button to add C:\uBike\uBikeJDev\uBikeSOAApplication\uBikeWeb\WebContent\WEB-INF\lib\uBikeBPELClient.jar to the list. You may or may not have to do this with the uBikeSOAClient.jar file
  • You may remove the Glassfish.jstl_1.2.0.1.jar file from the list if needed
  • Your screen should look similar to the image below
  • Click the OK button when finished


. Modify uBikeController.java Initialization Code:

  • Within the JDeveloper IDE, open the uBikeWeb/Application Sources/servlet/uBikeController.java file
  • After the first TODO: tag in the file, add the code to import the BPEL Web service client definitions:

import ubikeBPEL.client.*;

  • Scroll down until you see the uBikeController() constructor method
  • The uBikeWeb application is already coded to make direct service calls to the SALT gateway for the SEARCHINVENTORY and SOLDITEM Tuxedo services. The first block of class member variables defined are used for these direct calls
  • The next block of code has a TODO: tag where you will place the variable definitions required for calling your BPEL process' entry point. Place the following code under the first TODO: tag:

private Orderitembpelprocess_Client_Ep BPELService = null;
private OrderItemBPELProcess process = null;

  • Notice how the URL that is specified for the TuxedoWebService_Impl() method call points to a file for the WSDL. This is due to a known issue with the SALT gateway that randomly appends extra characters to the end of the referenced BikeList.xsd file. In order to work around this issue, you must open http://<your-host-name>:8080/wsdl and http://<your-host-name>:8080/xsd/BikeList.xsd in a Web browser, view the page source for each, copy the contents of the WSDL into C:\uBike\uBikePlugin\uBikeSOA.wsdl, copy the contents of the bike schema into C:\uBike\uBikePlugin\BikeList.xsd, and make sure that the WSDL file's import element has a schema location setting of schemaLocation="BikeList.xsd". Save both files.
  • On the ENDPOINT_ADDRESS_PROPERTY line, you must change the hostname, arcyne, to your host name
  • Under the second TODO: tag, place the following code that initializes the endpoint for calling your BPEL process:

BPELService = new Orderitembpelprocess_Client_Ep_Impl("http://localhost:7001/soa-infra/services/default/uBikeComposite/orderitembpelprocess_client_ep?WSDL");
process = BPELService.getOrderItemBPELProcess_Pt();


. Review uBikeController.java doPost() Code:

Scroll further down the file and find the servlet's doPost() method. Notice that the caller sets an OPCODE parameter that is used to control which business method to invoke. This is the processing center of the uBikeController class. The default business method is searchInventory, which either returns the entire list of bicycle records in the database, or only the matching records for a SKU parameter that has been passed in. When each of the other business methods are invoked, they set a STATUS attribute in the response, and the searchInventory method is run again to return the current view of the database to the caller.


. Review uBikeController.java searchInventory() Code:

The searchInventory method takes a SKU parameter to return any matching records found in the database. If the SKU is empty or NULL, then all bicycle records in the database are returned. This service uses a direct Web service call to the SALT gateway. You reviewed that SALT mapping plugin earlier. This method makes use of that plugin to map the FML fields returned by the SEARCHINVENTORY Tuxedo service into the list of bike records defined in BikeList.xsd. This method returns that list of bikes to the caller.


. Review uBikeController.java soldItem() Code:

The soldItem business method is also a direct call to the Web services defined by the SALT gateway. It takes the SERIALNO of a bicycle record, and removes that record from the database. The STATUS of the operation is placed in the response, and sent back to the caller.


. Review uBikeController.java orderItem() Code:

The orderItem business method takes three parameters, SKU, size, and color. These are the same parameters that you created for the BPEL Web service entry point parameters. This method gets those parameters from the request, and needs to populate them into the Web service request to call your BPEL process.


. Modify uBikeController.java orderItem() Code:

  • After the TODO: tag in the orderItem method, add the following code to call your BPEL Web Service and populate the STATUS message with the service result:

String status = process.process(SKU, size, color);
request.setAttribute("STATUS", status);


. What about the modifyItem() Code?

This method was intentionally left unimplemented. As a bonus exercise, you can optionally develop the JSP page and servlet code required to call the MODIFYITEM Web service. There is no solution or instruction on how to develop the functionality of the uBike modify item feature.


Deploy uBike Web Application


. Open Deployment Profile for uBikeWeb:

In JDeveloper, right-click the uBikeWeb project, and select Project Properties...

 

. Edit Deployment Profile for uBikeWeb:

On the Project Properties dialog, select Deployment in the left-hand pane, and then click the Edit button to edit the uBikeWebApp deployment profile.

In the Edit WAR Deployment Profile Properties dialog, select Library Dependencies in the left-hand pane, then select the check boxes for UBikeSOAClient.jar and UBikeBPELClient.jar. Make sure all other check boxes are not selected. This step is required, because otherwise JDeveloper will try to include all of the build-time libraries in the deployment itself. This increases the footprint of the deploy, and more importantly causes the deployment to fail as several of these libraries are running on the system classpath as part of the running application server.

Click the OK button twice to return to the JDeveloper IDE.


. Deploy uBikeWeb to WebLogic Server:

Now that the deployment profile has been configured properly, you can deploy uBikeWeb to the server. In JDeveloper, right-click the uBikeWeb project, and select Deploy>uBikeWebapp...

The Deployment Wizard appears. On the Deployment Action dialog, select Deploy to Application Server, and click the Next button.

On the Select Server dialog, select MyWebLogicConnection, deselect the check box for the Deploy to all server instances in the domain option, leave all other fields at their default values, and click the Next button. Manually selecting which server to deploy to is important because sometimes JDeveloper will mistakenly try to deploy to JMS servers.

On the Server Instances dialog, select the AdminServer entry, and click the Next button.

On the Summary dialog, review your settings, and click the Finish button when done.

Monitor the Deployment log by clicking on the Deployment tab to ensure that the deployment is successful.

Congratulations! Now all development for the application should be complete, and you are ready to test the complete end-to-end integration.


Test End-to-End Integration

Perform the following steps to test the end-to-end integration of SOA Suite, BPEL, Tuxedo, and SALT:

Test uBike Web Application


. Open uBikeWeb Application:

Open a web browser and go to http://localhost:7001/uBike/index.jsp to open the uBike Web Application.

When you first run this page, the uBike Web application makes a call to Tuxedo via a direct call to the SALT gateway Web service endpoint. This call returns a list of bicycle records that is displayed on the page as shown in the image below. If you can see a list of bicycles in your Web browser, then this call is working successfully. You can test it again by selecting a SKU in the Search drop down list box. This will only return a list of bicycles that match the selected SKU.

 

. SOLDITEM Test:

Find a bicycle in the list of bicycles that is in stock (Instock: Y), and click the Sold button for that record. This causes the Web application to call the SOLDITEM Tuxedo service directly using the SALT gateway. When the service is called, the bicycle list is refreshed, and a status message is displayed near the top of the page. Make sure that the bicycle record you performed the operation on is no longer in the list. This can be done by verifying that the serial number in the status message no longer exists in the list of bicycles. Notice in the image above that there is a record for serial number 147890000002, but in the image below that record is gone, and the status indicates that the sold item operation was successful for that serial number.


. ORDERITEM End-to-End Integration Test:

Now comes the real test, the end-to-end integration test of BPEL with Tuxedo SALT Web services.

  • In your Web browser, scroll all the way down to the end of the page to view the last bicycle in the list
  • Take note of its serial number
  • In the Tuxedo command shell, run the tmadmin psc command and record the number of times the ORDERITEM service has been called
  • Use the Order form on the left-hand side of the page (near the top of the page) to order a new bicycle using the following fields

        SKU: RJ4500
        SIZE: 19
        COLOR: BLACK

  • If you have not done so already, click the Order button to initiate the test
  • When the page refreshes, verify that you have a successful status message, and verify that the last bicycle record at the end of the page is created and matches the order fields you used. Also note that it is after the serial number you recorded earlier
  • Run the tmadmin psc command again to ensure that the ORDERITEM service count has increased by 1

CONGRATULATIONS! You have completed the 'Calling Tuxedo from SOA Suite' OBE!


Solution Setup

This section contains instructions for installing the solutions for this tutorial. Please note that not all aspects of the tutorial contain a canned solution, and may require manual steps that are included in this tutorial. All required software installations must be completed before attempting to use any solution materials.

Solution File
Instructions
Install Tuxedo uBike Environment
  • Extract uBikeSOASolution.zip to C:\
  • Modify C:\uBike\setenv.cmd to match your environment
  • Double-click C:\uBike\DOSPrompt.cmd
  • Type build.cmd to build Tuxedo environment
  • tmboot -y to start Tuxedo
  • tmshutdown -y to shut down Tuxedo when done
Create uBike SOA Domain
JDeveloper Solution
  • Open JDeveloper
  • Select Open Application and browse to C:\uBike\uBikeJDev\uBikeSOAApplication\uBikeSOAApplication.jws
  • Create Application Server Connection
  • Set Library Paths
  • In JDeveloper: Change arcyne to <your-host-name> in uBikeComposite/SOA Content/wsdl.wsdl
  • In JDeveloper: Change arcyne to <your-host-name> in uBikeWeb/Application Sources/servlet/uBikeController.java
  • Deploy uBikeComposite
  • Deploy uBikeWeb
  • Change arcyne to <your-host-name> in C:/uBike/uBikePlugin/uBikeSOA.wsdl
Run End-to-End Solution

Summary

Congratulations! You have successfully completed this OBE tutorial.

Oracle SALT exposes Tuxedo services as Web services, and is a bidirectional gateway to and from Tuxedo applications. This enables SOA Suite applications to call Tuxedo services as part of an Enterprise SOA application. Now you can implement your own solutions that use these technologies together.

In this tutorial, you should have learned how to:

Check back on OTN for more OBE tutorials that build on this example to demonstrate other Tuxedo product integration examples.

Resources