# How Do I: Create a Tuxedo Control

In this task you will create a Tuxedo Control file and then add a method to the control file.

1. Select the web service in which you want to use a Tuxedo service.
2. Click the Design View tab.
3. From the Insert menu, choose Controls -> Tuxedo. The Insert Control - Tuxedo dialog displays.

4. In Step 1 enter a variable name for the control.
5. In step 2 click the following radio buttons:

Click Create a new Tuxedo Control to use and enter a name for the JCX file in the New JCX name field.

Note: The Tuxedo Control you create must be in a folder within the Project. For example, the JCX name will be folder.name or folder\name.

6. In the Tuxedo Control - Insert Tuxedo dialog specify the following Tuxedo service attributes in Step 3:

Tuxedo Control Field | Description
--- | ---
Service Type | Select the type of service from the menu. This specifies the type of interaction that the Tuxedo Control supports in the Tuxedo service. Possible values are: service which supports synchronous request/response. oneway which supports request without response. queue which supports tpenqueue and tpdequeue. Note: For more information about specifying queue service types, see How Do I: Create a Tuxedo Control That Uses Queue Type Services. The default is service.
Buffer Type | Select the type of buffer from the menu. This specifies the type of buffer that the Tuxedo Control will construct to send to the Tuxedo service. Possible values are: carray used when the data is an unspecified array of characters (byte array), any of which can be null. Tuxedo equivalent: CARRAY. fml used when the data contains named fields of simple types each with a maximum length of 65 K bytes. fml32 used when the data contains named fields including nested FML32 fields each having a maximum length of 4 GB. string used when the data contains a simple string as its only contents. view used to define C or COBOL structures for a Tuxedo application and to define an equivalent Java TypedView buffer for a WebLogic application. A view description file in which the fields and types that appear in the data structure are defined, must be available to client and server processes that use a data structure described in a VIEW typed buffer. Encoding and decoding are performed automatically if the buffer is passed between machines of different types. view32 is equivalent to VIEW but uses 32 bits for length and count fields, which allows for larger and more fields. xml used when data is an XML document. Data input to methods must be in the form of a Java String or an XML Bean. Tuxedo equivalent: XML for Tuxedo Release 7.1 and higher. Note: For input XML using data dependent routing, remove all comments generated by the WebLogic Workshop test browser in the XML buffer. Depending on the location of the comments in the buffer, Tuxedo may have problems parsing the buffer.
Buffer Type (cont.) | x_common is a synonym for the view buffer type. An x_common buffer is represented by a Java class extending the TypedXCommon class. It is identical in semantics to a view buffer. x_c_type is a synonym for the view buffer type. An x_c_type buffer is represented by a Java class extending the TypedXCType class. It is identical in semantics to a view buffer. x_octet is simply a byte array and is analagous to the CARRAY buffer type in Tuxedo. none used when no input buffer is to be used in the request to the Tuxedo service. If the method signature contains input parameters, an error is generated. The default is fml32.
Service Name | Type the WTC imported service name. This name should match the service name that is mapped in Create a WebLogic Tuxedo Connector (WTC) Service. If you are not sure of the service name, you can click Browse and a list of imported WTC service names display. If the service is listed in the WTC Imported Services dialog, you can select it and click OK. If the service you want is not listed, then the service has not been imported into WebLogic Server. To import a service from the WTC Imported Services dialog, click Import and the Services Exported by Tuxedo Application dialog displays. For information about importing WTC services, see Import New Tuxedo Services.
Field Tables | Type the name of the field table for the Tuxedo service when using fml or fml32 buffers. You should specify the field table when using fml or fml32 buffers that are sent or act as reply buffers from the called service. The name of the field table should match the classes generated with the mkfldclass or mkfldclass32 utilities. For buffer types fml and fml32, WTC needs the names and types of the fields the buffer can contain. These are described in field table classes created with mkfldclass and mkfldclass32 utilities. For more information about mkfldclass and mkfldclass32 utilities, see WebLogic Server Javadoc.
Return View Classes | Type the names of the view classes that correspond to the view buffer types that can be received from the Tuxedo service. This field is only required when the Tuxedo service returns a view or view32 buffers. These classes are independent from the Send View Class attribute which is used to specify the view or view32 class that represents the view buffer the Tuxedo service expects as an input. Note: The value of this attribute may be a list of classes so that a single Tuxedo service can respond with different VIEW buffers. For information about viewj and viewj32 utilities, see WebLogic Server Javadoc.
Send View Class | If you have selected view or view32 in the Buffer type field, the Send View Class field becomes active. This attribute provides the name of the class that represents the view/view32 buffer the service is expecting as an input buffer. This view class is used to create the TypedView buffer.

7. Click Create. A new JCX file is created on the Application tab and a new icon appears in Design View of the web service.
8. In Design View, double-click the image of the newly created Tuxedo Control.
9. The new Tuxedo Control file (controlname.jcx) displays in the Design View.
10. Click the Source View tab. Edit the signature of this method in the JCX file to match the buffer contents expected for the Tuxedo service being called.

When using the Insert Wizard to create a new Java Control Extension, a single method is defined that corresponds to the Service Type and Service Name specified in the Insert Wizard. The signature and possibly the name of this method in the JCX file needs to be edited to match the name and buffer contents expected for the Tuxedo service being called. In addition, any other services that this control calls must have methods defined for them in this interface.

For queued services, the method name created by the wizard is enqueue, dequeue, or enqueueDequeue. You can change the wizard-created name.

- If send queue information is provided and no receive queue information is provided then the method inserted is enqueue.
- If receive queue information is provided and no send queue is provided, then the insert method is dequeue.
- If both send and receive queue information are provided, then the insert method is enqueueDequeue.

For information about mapping data and fields to create request/response buffers, see How Do I: Map Java Data Types/FML and VIEW Buffers.

11. Select File -> Save from the menu.
12. Press Ctrl+F4 to close the Tuxedo Control file (controlname.jcx.)

### Import New Tuxedo Services

Within the web service or Java application, you can browse available Tuxedo services from the Insert Control - Tuxedo dialog. In the Service Name or Receive Queue Space fields, you can click Browse and see a list of available WTC imported services. If the service you want is not in the list, then the service has not been imported into WebLogic Server.

Note: Before you can import the service to WebLogic Server, you must configure the WTC service. To configure a WTC service, click Configure on the WTC Imported Services dialog box. Refer to How Do I: Configure a WTC Service.

To import a service from the WTC Imported Services dialog, click Import and the Workstation Address dialog displays.

1. Enter the network address of the workstation listener on a remote Tuxedo domain, such as a machine_name:port number combination //mach1:5100. This is the address of the Tuxedo application so the service names can be retrieved. Click Next.
2. When you click Next on the Workstation Address dialog, if the Tuxedo domain has security turned on, the Security Information for Tuxedo

Note: login dialog displays. Enter the Tuxedo application information and click Next.

A connection to the Tuxedo domain is made and a list of services exported by the Remote Tuxedo Domain displays.

1. Select the services to import. If there is more than one local WTC domain configured in WebLogic Server, then the list of local domains configured displays and you can select the local domain that offers this service. Click Import to create the associated import services.

If you click Cancel, the WTC service is deleted and the WTC Imported Services dialog displays.

If you click Back, the Workstation Address dialog displays.

Click Finish when you have completed importing all required services and the configured WTC service will deploy. The WTC Import Services dialog displays. The services you have imported should display in the list.

For more information about importing WTC services, see "Setting Up a WebLogic Tuxedo Connector (WTC) Connection."