IBM i IWS : Deploying an ILE program as a web service

You can deploy a web service by clicking the Deploy New Service link

Clicking the Deploy New Service link displays a wizard that allows you to install an ILE program object as a web service. We do not show all the windows of the wizard, but we show the ones where we need to make an important point. The first window that is shown is the window where you specify the program object to be deployed. In this example, we deploy a service program that is called NFS400_THR in library IWSRII

Specifying the ile program or service program to create as a web service

The next window that is shown allows you to specify the name of the web service. The default is the name of the program object. The next window lists all the procedures in the program object that contain corresponding PCML data (see Figure 5-15). The wizard determines whether the program object has any PCML data that is stored in it. If it finds none, it shows a prompt where you can specify a path to a PCML document that describes the program object.

List of procedures and pcml definitions

The wizard displays a list of exported procedures. For service programs (object type *SRVPGM), there might be one or more procedures. For programs (object type *PGM), there is only one procedure, which is the main entry point to the program. In our example, we select one procedure, FINDCUSTOMERS, to be externalized as a web service operation within the service program that contains many procedures.

Expanding the procedure row shows the parameters for the procedure and various parameter attributes. The parameter attributes are modifiable. In most cases, you want to modify the parameter attributes to control what data is to be sent by web-service clients and what data is to be returned in the responses to the client requests

The Count column indicates that the parameter is an array. If the count value is a number, the number identifies the number of entries in the array. If the count value references another parameter, which must be an integer type, then the referenced variable is used at run time to determine the number of elements in the array. There are performance ramifications to consider regarding parameters that are arrays. If the count value is a number, and the usage of the parameter is output or input/output, then all of the array elements are returned in the response to a client request, even if the valid elements in the array are fewer than the maximum. To improve the performance of web-service requests, it is a good idea for output arrays to have the count value reference another parameter that contains the actual number of elements in the array if you know the number of elements in the array is not constant. For nested arrays, such as arrays within structures, the count value cannot be set. To change the nested array's count value, a manually constructed PCML document must be provided.

When you have selected the procedure to expose as a web service operation, the wizard shows a window where you can specify the user profile in which the web service (that is, the ILE web service implementation program object) runs. The default is to run the web service under the server user profile.

The next window (Figure 5-16) allows you to specify any libraries that must be added to the library list when running the ILE web service implementation program object. In this example, we need to add the FLGHT400 library that contains all the database files that are used by the ILE program object.

Specifying library list for web services call

The next window enables you to indicate what HTTP transport information to pass to the ILE program object (done through environment variables). The last window allows you to set the properties of the generated WSDL file.

When you click Finish, you see the deployed services active

Managed web services showing the active service

The whole process takes less than five minutes. If the server is already created, deploying a web service takes less than two minutes.

Integrated web services server supports only SOAP-based web services.

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}