The EGL generator can create a SOAP web service
or 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.
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.”
Before you begin
- Your workspace must include a web or General project to contain
the following data:
- The external type that represents your IBM i program
- The structured Record parts that are used as the basis of the
records that are exchanged between the web service and the IBM i program
- Your workspace must include a Rich UI project to contain the Interface
and non-structured Record parts that your Rich UI application uses
to access the IBM i code at
run time.
- Your workspace is connected to your IBM i
system. A connection is available in the Remote Systems Explorer perspective.
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:
- Generate the deployment descriptor, which creates the WSDL file
and places it in the WebContent/WEB-INF/wsdl directory.
- Right-click the WSDL file, select , 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.
Creating external types and structured Record parts
- 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.
- Select .
- 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 , and follow the steps in the
wizard. Remember to place the Interface part in the Rich UI project.
- Click Next. The second "New EGL part" window
is displayed:
- 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.
- 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.
- In the EGL source file name field, specify
the file name.
- In the subsequent fields, specify the details for a given external
type. Make sure to specify whether the program is a service program:
- In the ExternalType Name field, specify
the name to create for the external type itself.
- In the Host Program Name field, specify
the name of the link-edited host program.
- In the Host Program Library field, specify
the library name for the link-edited host program.
- 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.
- 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.
- To overwrite same-named files for the external types, select Overwrite
existing files. To protect yourself against overwriting
existing files, clear the check box.
- Click Next.
Creating web (REST) services
If you are
creating web (REST) services, the New EGL REST Service window is displayed.
Do as follows, taking special care to indicate whether the IBM i program is stateful:
- If the Source folder field is available,
specify a web or general project, along with the source folder that
contains the deployment descriptor. The REST service is an output
that is created at deployment-descriptor generation time.
- If the EGL deployment descriptor file name field
is available, specify the name of the deployment descriptor.
- In the middle box, select enableGenerate for
each service to generate.
- If you already generated a REST 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.
- You can change the URI field, which identifies the low-level qualifier
for the address used to access the REST service.
- For a given service, ensure that the last entry reflects whether
the IBM i program is stateful
or not. To change the value of an entry, click the entry.
- To overwrite same-named REST-service entries in the deployment
descriptor, select Overwrite existing files.
To protect yourself against overwriting existing entries, clear the
check box.
- 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 “Protocol options for accessing non-web services.”
To return to the New EGL REST Service window, click Finish.
- Click Next to continue your work in the
wizard or, if possible, click Finish to complete
your work.
Creating 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.
- In the Source folder field, specify the
Rich UI project that receives the Interface part, along with the source
folder.
- 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.
- In the EGL source file name field, specify
the file name.
- In the subsequent fields, specify the details for a given Interface
part and the related Record parts:
- In the Interface Name field, specify the
name to create for the Interface part
- In the functions area, identify each IBM i
function that will be represented in the Interface part. The wizard
creates a non-structured Record parts for each parameter that is not
a primitive type.
- To overwrite existing files, select Overwrite existing
files. To protect yourself against overwriting existing
files, clear the check box.
Creating web (SOAP) services
If you are
creating web (SOAP) services, the New EGL Web Service window is displayed.
- 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.
- If the EGL deployment descriptor file name field
is available, specify the name of the deployment descriptor.
- 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.
- 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.
- 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.
- Click Finish to complete your work in the
wizard.