Writing Java client applications

Before a Java™ client application can send a request to the CICS® server, it must create and open a JavaGateway object. The JavaGateway object is a logical connection between your application and the Gateway daemon when the application is running in remote mode. If a Java Client application is running in local mode, the JavaGateway is a connection between the application and the CICS server, bypassing the Gateway daemon.

When the JavaGateway is open, the Java client application can flow requests to the CICS server using the flow method of the JavaGateway. When there are no more requests for the CICS Transaction Gateway, the Java client application closes the JavaGateway object.

There are several constructors available for creating a JavaGateway. The default constructor creates a JavaGateway with no properties. You must then use the set methods to set the required properties and the open method to open the Gateway. There are other constructors which set different combinations of properties and open the Gateway for you.

Use one of the constructors provided to create a JavaGateway. You must specify the protocol you are using, and the network address and port number of the remote Gateway daemon. You can specify this information either by using the setAddress, setProtocol and setPort methods, of the JavaGateway class, or by providing all the information in URL form: Protocol://Address:Port. If you specify a local connection, you must specify a URL of local: You can use the setURL method or pass the URL into one of the JavaGateway constructors.
Note: The IP address can be in IPv6 format.
The JavaGateway supports the following protocols:
  • TCP/IP
  • SSL
  • Local

Java applications that connect to the Gateway daemon using TCP or SSL can specify a local port number to use for the connection. Set the JavaGateway.PROP_CLIENT_PORT property in a java.util.Properties object to the numeric value of the port to use, then pass the Properties object to the JavaGateway constructor. If the local port is already in use the connection will fail, so a different property value must be used for each concurrent TCP or SSL connection.