How Do I: Use a Tuxedo Service in a Web Service
   The Tuxedo control allows you to create a web service
  or Workshop application that uses one or multiple Tuxedo services in its business
  logic. The Tuxedo control is a generic interface. To use the control to communicate
  with specific Tuxedo services, you must create a control. The control consists
  of a Java interface and implementation file pair that tells the Tuxedo control
  the names of the Tuxedo services you want to invoke, the type of interaction
  the services require (service with reply, queued service, etc), and the Tuxedo
  buffer types the services expect as input. Your application invokes the methods
  defined by the control interface to invoke the Tuxedo services. After
  you create a control for a specific set of Tuxedo services, you can
  reuse the control in any application that needs to access those services.
  Workshop does most of the work of creating a control for you.
   In this section, the example shown represents creating
  a web service.
   To create a web service that uses a Tuxedo service:
    
   Set Up Your Environments
    
      -  Start the Tuxedo server that advertises the Tuxedo service you want to use.
 
      -  Start Workshop.
 
      -  Start WebLogic Server. You can confirm
        the status of WebLogic Server by checking the Server view.        
 
    
   Create a  Web Service Project with the Tuxedo Control
  Facet 
Note: if you already have a web service project, you can
  add the Tuxedo Control facet by right-clicking the project and select Properties
  > Project Facets. 
      - Select File > New > Project. 
 
      - In the New Project dialog, select Web Services
          > Web Service Project > Next.
 
      - Enter a Project Name and click Next.
 
      - In the Project Facets page, select Tuxedo Control and
        click Next.   
		
  
       
 
	  Create a Web Service 
	  
	  
      - 
        
 Create a new folder/package
          in the src dir.
       
      - 
        
 Right-click the new folder and select New
        > WebLogic Web Service.
       
      -  Complete the wizard and click Ok.
 
    
   Add a Tuxedo Control to Your Web Service
   Controls act as interfaces between your web service
  and other data sources. Therefore, you want to add a Tuxedo control to your
  web service to provide your web service with access to Tuxedo services.
   The tasks in this step are:
    
   Use a Tuxedo Control
   In this task you will use a Tuxedo Control file and then add a method to the control file.
    
      -  Open the web service in which you
        want to use a Tuxedo service.
 
      - Right-click in the web services Design view or Source
          view and select Insert
          > Control. 
 
      - From the Select Control  menu, choose either an existing Tuxedo
        control or choose New
        System  Control          > Tuxedo Control and click Ok.
        The New Control dialog displays.
 
      - For a new control,  follow the procedures described in How
          Do I: Create a Tuxedo Control, to create a new Tuxedo control to
          use in your application.
 
      
   Create a WebLogic Tuxedo Connector (WTC) Service
   WTC acts as a gateway between the Tuxedo environment and WebLogic environment; therefore, a WTC service definition must exist that maps to the Tuxedo service you want to use in your web service.
   Import the Tuxedo service that you want to use in your web service. For information on how to import WTC services, see How Do I: Configure a WTC Service.
   Use Public Methods from the Control
   The Tuxedo control provides the following public methods
  to use in your web service in addition to the methods defined by your control.
  If you want to use these methods you must call them explicitly.
  
  
     | 
     | 
  
  
     getConnection()  | 
     Gets the WTC connection currently used by this control. This allows you to use more of the WTC APIs defined for a connection. getConnection() returns an instance of an ApplicationToMonitorInterface object that can be used to interact with Tuxedo through JATMI calls.   Note: This method will not allow you to terminate the connection or use tpacall with asynchronous calls.
  Using the getConnection() method assumes that the developer has a working knowledge of WTC calls.  | 
  
  
     getMappingIssues()  | 
     Returns an array of MappingIssues associated with the last request made. Mapping issues are generated by the control when there is a discrepancy between the Java data type and the Tuxedo buffer.  | 
  
  
     gettpurcode()  | 
     Returns the tpurcode associated with the last exception that occurred.  | 
  
  
     gettperrno()  | 
     Returns the tperrno associated with the last request made by the control.  | 
  
   Use a Tuxedo Service from the Control
   Next you must incorporate one or more methods from the
  control just created in the previous step in your web service.
    
      -  Open the web service file in Design
          view.
 
      -  Right-click the method on the Tuxedo
        control and select Generate Delegate Method. This will
        create a corresponding method in the web service. 
 
      
   For the web service to provide additional processing before or after the call to the Tuxedo service or if the web service needs a different signature, click the Source view tab and edit the Java code as needed.
      -  From the menu, select File > Save.
 
    
   Test the Web Service Using Debugger
   Next you will test your web service using debugger.
    
      -  Right-click the web service and select
        Run As > Run on Server. 
 
      -  The Workshop test client displays
        with a place to enter the parameters for the web service method that
        was previously added. Enter the appropriate parameters and click the
        method name button.
 
      -  Verify the results that return at the bottom of the page when the test browser refreshed the window.
 
 
   Related Topics