Using the optimized REST service interface

If the Java™ application and the z/TPF application service are running on the same z/TPF processor, you can optimize the REST service interface by configuring a z/TPF conduit and specifying a local REST service call.

Before you begin

If you use a stateful service, the Java application and the z/TPF application service must be run on the same z/TPF processor. You must optimize the REST service interface by configuring a z/TPF conduit and specifying a local REST service call.

Procedure

  • Configure a z/TPF conduit.

    If the Java CXF client is available on the z/TPF system and the stateless service that is called is located on the same z/TPF processor, the network overhead is unnecessary and the optimized REST service interface can be used.

    If a stateful service is called, the Java application must call the stateful service by using the Java CXF client and the optimized REST service interface.

    To use the optimized REST service interface and call a z/TPF application service that is running on the z/TPF system, you need to configure a z/TPF conduit. A z/TPF conduit is a z/TPF-specific conduit for the CXF library and is built on top of the CXF HTTPConduit class.

    To configure a z/TPF conduit, include the tpfclient.jar file as part of your Java class path. The default location of the file on the z/TPF system is /sys/tpf_pbfiles/apps/tpfjax/tpfclient.jar.

  • Specify a local service call.

    When you call a REST service from a Java application that is running on the same z/TPF processor, the optimized REST service interface can be used if the specified host name in the URL is localhost.

    In the following example, a hardcoded IP address with a port number is used to make a remote call to the fibonacci service.
    String url = "http://9.57.13.180:81/fibonacci";
    To make a local call, you must change the URL as follows:
    String url = "http://localhost:81/fibonacci";
    Notes:
    • When you call stateful services, you must set the host name in the URL to localhost.
    • Whatever the port number is, it is ignored when you make a local call. You can choose whether to include it or not.