Accessing IBM i programs as web services: keystroke details

The EGL generator can create a SOAP web service or an EGL REST web service so that an application that acts as a service requester can access these types of IBM i programs: rpgle, cbl, cblle, sqlrpgle, sqlcbl, and sqlcblle.

Before you can perform this task, the following prerequisites must be fulfilled:
Note: The wizard described here does not create an Interface part to access a SOAP service. To create an Interface part to access a SOAP service:
  1. Generate the deployment descriptor, which creates the WSDL file and places it in the WebContent/WEB-INF/wsdl directory.
  2. Right-click the WSDL file name, select EGL Services > Create EGL client interface , and continue with the process that is described in "Creating an Interface part to access a SOAP service." Remember to place the Interface part in the Rich UI project.

This topic describes the instructions to access IBM i programs as web services. For background information, see "Accessing IBM i programs as web services: overview."

To access an IBM i program as a web service, do as follows:

  1. Create external types and structured Record parts.
    1. In the Remote Systems Explorer perspective, right-click the entry for IBM i program source or for an existing Program Call Markup Language (PCML) definition.
    2. Select EGL Services > Create EGL: External Type, Interface, and records .
    3. The first of two "New EGL part" windows is displayed. In the middle of the box, select an external type to create. At the bottom of the box, select one or more check boxes to indicate whether to create a web (SOAP) service, a web (REST) service, or both.
      • If you select Create REST web services, you can create an Interface part and non-structured Record parts for use by the Rich UI application.
      • If you do not want the Interface and Record parts, clear Create EGL Rich UI Interface for REST web service. Later, if you want an Interface part for the REST service, right-click the external type, select EGL Services > Extract EGL Interface, and complete the steps in the wizard. Remember to place the Interface part in the Rich UI project.
    4. Click Next. The second "New EGL part" window is displayed:
      1. In the Source folder field, specify the project that receives the external type and structured Record parts. Also specify a backslash (\) and the source folder.
      2. In the Package field, specify the package name. Be sure to specify a package name; otherwise, no other project can access the parts in the project you identified.
      3. In the EGL source file name field, specify the file name.
    5. In the subsequent fields, specify the details for a given external type. Make sure to specify whether the program is a service program:
      1. In the ExternalType Name field, specify the name to create for the external type itself.
      2. In the Host Program Name field, specify the name of the link-edited host program.
      3. In the Host Program Library field, specify the library name for the link-edited host program.
      4. If the program is a service program, select Service Program. Otherwise, clear that field and select the appropriate entry in the Host Program Type list. In that list, you can indicate whether the host program is NATIVE, which is written in COBOL or RPG; or EGL, which is written in EGL.
      5. In the Entrypoints field, select the program functions to expose as service functions. You can select or deselect all functions by clicking Select All or Deselect All.
      6. To overwrite same-named files for the external types, select Overwrite existing files. To protect yourself against overwriting existing files, clear the check box.
    6. Click Next.
  2. Create one or more web (REST) services


  3. Create one or more Interface parts. If you indicated that you want to include Interface and Record parts with the REST services, the "New EGL Interface part" window is displayed.
    1. In the Source folder field, specify the Rich UI project that receives the Interface part, along with the source folder.
    2. In the Package field, specify the package name. Be sure to specify a package name; otherwise, no other project can access the parts in the project you identified.
    3. In the EGL source file name field, specify the file name.
    4. In the subsequent fields, specify the details for a given Interface part and the related Record parts.
      1. In the Interface Name field, specify the name to create for the Interface part
      2. In the functions area, identify each IBM i function that will be represented in the Interface part. The wizard creates a nonstructured Record part for each parameter that is not a primitive type.
    5. To overwrite existing files, select Overwrite existing files. To protect yourself against overwriting existing files, clear the check box.
  4. Create one or more web (SOAP) services. If you are creating web (SOAP) services, the New EGL Web Service window is displayed.
    1. If the Source folder field is available, specify a web or general project, along with the source folder that contains the deployment descriptor. The web service is an output that is created at deployment-descriptor generation time.
    2. If the EGL deployment descriptor file name field is available, specify the name of the deployment descriptor.
    3. In the middle box, select enableGenerate for each service to generate. If you already generated a web service, you can save time at generation by specifying, in the deployment descriptor, that you do not want to generate the service. However, if you change any aspect of the deployment-descriptor entry, you must regenerate the service.
    4. To overwrite same-named SOAP-service entries in the deployment descriptor, select Overwrite existing files. To protect yourself against overwriting existing entries, clear the check box.
    5. In the last section, if available, click the Add button to modify or add a protocol used to access the IBM i program from the web service. The Add Protocol window is displayed. Specify a protocol name, along with the additional information specified in the EGL Generation Guide, "Deployment descriptor options for service requesters." To return to the New EGL Web Service window, click Finish.
    6. Click Finish to complete your work in the wizard.
The new deployment descriptor file is created and opens in the editor.