Calling Integration Server from COBOL under IBM i

This document covers the following topics:

This scenario uses the tools IDL Extractor for Integration Server and COBOL Wrapper of the Designer.


Introduction

graphics/common_intro.png

graphics/blue_1.gif Use IDL Extractor for Integration Server to generate Integration Server connections and listeners from the Integration Server service to be called.
graphics/blue_2.gif Generate client interface objects and build COBOL client application.
graphics/blue_3.gif Execute the call from the COBOL client to the Integration Server service.

This scenario makes the following important assumptions:

For Task 1:

  • You have an Integration Server with EntireX Adapter installed.

For Task 3:

  • You have an Integration Server with EntireX Adapter installed.

  • You can call the Integration Server service at runtime using different methods:

    • EntireX RPC
      For the EntireX RPC connection method you need EntireX Broker on one of the supported platforms: z/OS | UNIX | Windows | BS2000 | z/VSE.

      graphics/common_intro_assume.png

    • EntireX Direct RPC
      For the EntireX Direct RPC connection method there are no additional prerequisites.

      graphics/common_intro_assume-directRpc.png

Task 1: Generate Integration Server Connections and Listeners

This section covers the following topics:

Introduction

Follow the instructions for extracting a webMethods Integration Server (IS) service under Using the IDL Extractor for Integration Server.

This process creates the following EntireX metafiles:

  • an IDL file, containing definitions of the interface between client and server; see Software AG IDL File in the IDL Editor documentation

  • a webMethods IS Connection

  • a webMethods IS Listener, depending on connection type. See Listeners in the EntireX Adapter documentation.

Connection types are described under Creating Listener Objects in Integration Server.

Sample webMethods IS Service

Imagine that a new order management system is being developed with webMethods Integration Server in your organization. A package OrderManagement with flow service is provided. From your existing COBOL application you would like to call the flow service placeOrder on the IS.

graphics/common_generate-server_sample.png

The following input is required:

  • ID of the item to be ordered (OrderItemID)

  • a quantity (OrderQuantity)

  • customer ID OrderCustomerID)

The following output is returned:

  • item name (OrderItemName)

  • unit and total price (OrderUnitPrice and OrderTotal)

  • etc.

Extracting the Interface of the webMethods IS Service

First create a project in Designer. This project is the container into which all extracted and generated EntireX artifacts are placed. Name this project COBOL placeOrder client.

Start of instruction setTo start the IDL Extractor for Integration Server

  1. Switch to the EntireX perspective.

  2. Invoke the IDL Extractor for webMethods IS, which is a New Wizard in Eclipse. From the File menu, choose New. Select IDL Extractor for webMethods IS in the following page.

    Or:
    Choose New from the toolbar or context menu of a view showing resources.

    Or:
    Press Ctrl-N to start the selection of the New Wizards.

  3. If you are using the wizard for the first time without any predefined Integration Server connections, enter the TCP/IP address of the webMethods IS to extract from. Otherwise select the connection to the Integration Server.

  4. Press Next.

Start of instruction setTo extract the IDL from the selected package

  1. Under Source (Integration Server), select the package you want to extract from.

    graphics/common_generate-server_extract.png

  2. For Target (Eclipse Workspace), specify project COBOL placeOrder client. Extraction results will be placed in this container. You can keep the IDL File Name as it has been derived from the package name by default. Since COBOL is your desired endpoint, select Optimize extracted IDL for usage with: COBOL.

    Note:
    COBOL only supports fixed-length data items, whereas webMethods IS has variable length types, often without any length restrictions (constraints). Parameters with no specified constraints will take the default fixed length. You can specify this default in field alphanumeric with fixed length. Use 256 for this example. You can see the effect of this default under Viewing the Extracted IDL.

  3. A listener is required for calling webMethods IS from an RPC client, so check Create Listener Objects in Integration Server.

  4. Press Next.

Creating Listener Objects in Integration Server

Start of instruction setTo create Listener Objects in Integration Server

  1. Select a Listener connection type used for inbound connection to the Integration Server.

    • An EntireX RPC Listener connection is the standard way and is always available.

    • If your interface contains only In parameters, an EntireX Reliable RPC Listener connection is available.

    • If it is enabled by the license for the webMethods Integration Server:

      • an EntireX Direct RPC Listener connection is available

      • if your interfaces contain only In parameters, an EntireX Direct Reliable RPC Listener connection is available

    graphics/common_generate-server_listener.png

  2. On this page, you set the properties for the listener objects to create; these objects will wait for the incoming COBOL requests. Select the package and specify the folder name into which the listener is generated. If the folder does not exist, it will be created automatically.

  3. Keep the defaults given for RPC Listener Connection to EntireX. The Broker ID is a TCP/IP or SSL/TLS address and Server Address is an EntireX-specific namespace to locate a target server (here: OrderManagementListener).

  4. When creating a connection, a package dependency is added such that the selected package depends on webMethods EntireX (the package WmEntireX) with the version currently used.

  5. Press Finish. The listener and the connection appear in the package navigator. For the package navigator, switch to the service development perspective by choosing Window > Perspective > Open Perspective > Service Development.

Viewing the Extracted IDL

Start of instruction setTo view the extracted the IDL

  • The Software AG IDL is saved in the target Eclipse workspace as selected: container COBOL placeOrder client and IDL file OrderManagement.idl:

    graphics/common_generate-server_view.png

The IDL placeOrder is a description of the interface of the flow service placeOrder. See Sample webMethods IS Service above.

Parameters with no constraints specified are given the specified default length of 256. During runtime, if concrete business data fits into the length given (either by constraint or by default), then you are on the safe side. However, if the runtime data length exceeds the data field length, then you will not be able to transport the full data length. Therefore you have to choose both the data length constraints and the default carefully. See also note under To extract the IDL from the selected package above.

graphics/common_generate-server_view2.png

For more information on data type mapping, see Mapping Integration Server Data Types to IDL in the IDL Extractor for Integration Server documentation.

Testing the Extraction Results (Optional)

You can test the results of the extraction and the server back end, using the EntireX IDL Tester.

Start of instruction setTo test the extraction results

  1. For EntireX RPC (see Task 3 in the Introduction) and an RPC Listner Connection, make sure EntireX Broker is running.

  2. Enable the EntireX Adapter Listener.

    graphics/common_generate-server_test.png

  3. Activate the EntireX perspective by choosing Window > Perspective > Open Perspective > EntireX, and from the context menu of the IDL file, choose IDL Tester.

  4. This step depends on the method used to call the server (see Task 3 in the Introduction).

    • For EntireX RPC, enter the same TCP/IP address for Broker that you supplied when you created the RPC Listener Connection to EntireX (localhost:1971).

    • For Direct RPC, that is, you generated a Direct RPC Listener Connection, enter the TCP/IP address from the Integration Server (localhost:1971).

  5. For Server, enter the values you specified for the server address (RPC/SRV1/CALLNAT).

    graphics/common_generate-server_test-2.png

Task 2: Generate Client Interface Objects and Build Client Application

This section covers the following topics:

Setting Generation Options (Properties) for the COBOL Wrapper

Start of instruction setTo set generation options (properties) for the COBOL Wrapper

  1. To generate suitable COBOL code for your environment, first set the correct target operating system. Make sure the EntireX perspective is active (Window > Perspective > Open Perspective > EntireX) and call the properties of the COBOL Wrapper.

    graphics/common_generate-client_options-1.png

  2. From the context menu of the IDL file, choose Properties > EntireX COBOL Wrapper. On the COBOL Wrapper Properties page, set the Target Operating System

  3. Adapt the name of the generated COBOL program: Choose Customize automatically generated Client Names. Take ORDERCLT as the COBOL program's name.

Generating COBOL Code

Start of instruction setTo generate COBOL code

  • For COBOL code generation, make sure the EntireX Perspective is active: Choose Window > Perspective > Open Perspective > EntireX. From context menu of the IDL file, choose COBOL > Generate RPC Client. This generates the COBOL client ORDERCLT in folder client and a copybook in folder include:

    graphics/common_generate-client_generate.png

The copybook is the COBOL programmer's API. It is for use in the COBOL application.

As you would expect, the length of generated COBOL parameters exactly matches the lengths extracted. COBOL parameters always have a fixed length defined at compile time. They are not altered at runtime to reflect actual string length as in modern programming languages. This means that if you choose your default length (see Extracting the Interface of the webMethods IS Service) you have to choose the maximum possible data size to ensure all data can be transmitted. However, this may needlessly increase the message size if no constraints are set for fields of shorter data length. Choose your defaults and contstraints carefully.

Building the Client Application

graphics/common-cics_generate-client_options_standard.png

In this scenario, the COBOL client program, every generated client interface object, generic RPC services module and the broker stub are linked together to the client application.

See Using the COBOL Wrapper for Batch (z/OS, BS2000, z/VSE and IBM i).

Task 3: Execute the Call from COBOL to Integration Server

Use the EntireX IDL Tester to execute the call.

Start of instruction setTo execute the call

  1. For EntireX RPC (see Task 3 in the Introduction) and an RPC Listner Connection, make sure EntireX Broker is running.

  2. Enable the EntireX Adapter Listener.

    graphics/common_generate-server_test.png

  3. Activate the EntireX perspective by choosing Window > Perspective > Open Perspective > EntireX, and from the context menu of the IDL file, choose IDL Tester.

  4. This step depends on the method used to call the server (see Task 3 in the Introduction).

    • For EntireX RPC, enter the same TCP/IP address for Broker that you supplied when you created the RPC Listener Connection to EntireX (localhost:1971).

    • For Direct RPC, that is, you generated a Direct RPC Listener Connection, enter the TCP/IP address from the Integration Server (localhost:1971).

  5. For Server, enter the values you specified for the server address (RPC/SRV1/CALLNAT).

    graphics/common_generate-server_test-2.png