Terminal Emulation & Transformation Community
  • Home
  • Blogs
  • FORUM
  • About
  • Contact
  • Resources

Accessing Transformation Connection from Integration Objects

7/25/2019

0 Comments

 
Picture
IBM HATS provides advanced customization options to create future proof, rich & complex web applications. This can be achieved by using Macros, Integration Objects and ReST APIs. Along with that, if Integration Objects can get access to the transformation connection (HATS web connection), it enables easy integration of HATS applications with third party applications.
​
HATS provides Connection Management APIs, which can be used to acquire the transformation connection (also referred to as the "default connection") in a servlet context. This is in anticipation of executing an Integration Object against that transformation connection. The purpose of this API is to provide better integration between HATS applications and other, non-HATS Web applications.
 
The API consists of two static methods, acquireExistingTransformationConnection and releaseExistingTransformationConnection, added to the RuntimeFunctions class in the com.ibm.hats.runtime package.
 
The signatures of these methods are as follows:
 
public static final String acquireExistingTransformationConnection(HttpServletRequest request) throws HostConnectionException, ApplicationUnavailableException
 
public static final void releaseExistingTransformationConnection(HttpServletRequest request)
 
 
If you have a scenario in which you are displaying HATS custom page and want to make a background transaction to extract/send data from/to the same connection without changing the active transformation page, then these APIs are best suitable to use the same transformation connection in the background through Integration Objects and make te traction without changing the active transformation.
 
Below is a sample code which explains how to use these APIs in a non-HATS jsp page. Similarly, you can use these APIs in a java file/servlet and invoke using specific paths.
 
In this sample observe the comments next to each of the method calls, which explains the significance of each of those APIs used.

<%@page import="com.ibm.HostPublisher.IntegrationObject.HPubCommon"%>
<%@page import="IntegrationObject.SignOn"%>
<%@page import="com.ibm.hats.runtime.RuntimeFunctions"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

<%
String connection = RuntimeFunctions.acquireExistingTransformationConnection(request); // Lock the corresponding session's transformation connection and return the name of the underlying connection.
SignOn signonIO = new SignOn();   // the integration object
signonIO.setHPubStartType(HPubCommon.BEAN_START_FROM_CONNECTION); // Not required to set if the Integration object is middle-in-chain.
signonIO.setHPubStartChainName(connection); // Must set the return value of acquireExistingTransformationConnection.
signonIO.setHPubSaveConnOnError(true);         // To prevent the Integration Object from destroying the transformation connection when an error is encountered, this method should be called prior to invoking doHPTransaction() to run the Integration Object.
​signonIO.setHPubEndType(HPubCommon.BEAN_END_TO_CONNECTION); // To make sure the connection is not closed and returned for transformation/web context use after completing the Integration object request.

signonIO.doHPTransaction(request, response); // Instead of regular DoTheWork(), to run the Integration Object, you must call doHPTransaction by passing httprequest and httpresponse objects.
RuntimeFunctions.releaseExistingTransformationConnection(request); // Purpose of this method is to check-in or return the application so that it can be used through the entry servlet or by other Integration Object chains. This call signifies that the Integration Object chain no longer needs access to the transformation connection.
%>
 
<!-- After releasing the transformation connection you can access Integration Objects getter methods to retrieve the data generated by the Integration Object
 
You can even access this data without releasing the connection. But releasing the connection earlier makes it available for other requests -->

 
</body>
</html>

For more details on these APIs, refer the below link and search for “Connection management API” in the page

https://www.ibm.com/support/knowledgecenter/en/SSXKAY_9.7.0/com.ibm.hats.doc/pgcusio.htm#wq142

Note: Ensure that transformation connection busy time is handled correctly. Otherwise, you will end up getting application busy page for web transformation and application unavailable issues for Integration Objects.
​

Santhakumari Ramala
Chief Architect, IBM Host Access Transformation Services
santhakumari.r@hcl.com



0 Comments



Leave a Reply.

    Archives

    October 2019
    July 2019
    June 2019
    May 2019
    March 2019
    November 2018
    October 2018
    September 2018
    August 2018
    July 2018
    June 2018
    May 2018
    April 2018
    March 2018
    February 2018
    January 2018
    December 2017
    October 2017
    September 2017

    Categories

    All
    HACP
    HACPEE
    HATS
    HOD
    PCOMM

    RSS Feed

Proudly powered by Weebly
  • Home
  • Blogs
  • FORUM
  • About
  • Contact
  • Resources