Troubleshooting
Problem
This document depicts an example of creating a Web service from an RPGLE service program using the IWS Web Service Wizard.
Resolving The Problem
This document depicts an example of creating a Web service from an RPGLE service program using the IWS Web Service Wizard.
Here is the RPGLE service program that will be used for this example. You should store it in the library WEBTEST1 and the source physical file QRPGLESRC. Also, you should create the directory /home/WebTest1/Converts in the IFS.
First, the service program must be compiled and the PCML must be generated. For the purpose of this document, the PCML has been generated to an external file in the IFS. You should compile the source using the following commands:
CRTRPGMOD MODULE(WEBTEST1/CONVERTS) PGMINFO(*PCML) INFOSTMF('/home/WebTest1/Converts/converts.pcml')
CRTSRVPGM SRVPGM(WEBTEST1/CONVERTS) EXPORT(*ALL)
You begin by loading IBM Web Administration for i. In a Web browser, go to http://<system name>:2001/HTTPAdmin. On the All Servers tab under Manage, select Create Web Services Server.

This will take you through an eight-step process that will create the Web service from the RPGLE service program.
For the first step, it will ask for the user ID that the server's jobs will run under. The default user ID is fine here. Select Use default user ID, and click Next.

For the second step, it confirms that you would like to deploy a new service to externalize an IBM i program. Make sure the checkbox is checked and click Next.

For the third step, it asks for the library and object names. Enter the library WEBTEST1 and the object CONVERTS. Because it is a service program, select the *SRVPGM and click Next.

If the program object does not have the PCML stored in it, you will need to specify the location of the PCML file. We compiled with the PCML file being output to the IFS, so we will specify that location here. Enter the path and name of the pcml file, which is /home/WebTest1/Converts/converts.pcml. You can also browse to find this file. Click Next.

The fourth step asks for the name that you would like to give the service. You can also give it a description here. For the purpose of this example. we will name the service CONVERTS.

In the fifth step, it lists the procedures and parameters that will be externalized as Web services. Select both centstodollars and feettoinches. In the Usage column, make sure that CENTS and FEET are set to be input parameters and DOLLARS and INCHES are set to be output parameters. Click Next.

For Step 6, it will ask for the user ID that will execute the RPG functions. You may specify the server ID or an existing ID. Click Next.

In Step 7, the wizard sets up the library list for the Web service. Make sure WEBTEST1 is added to this list. Click Next.

Step 8 is a summary page. Once you have reviewed this page, click Finish. This will complete the wizard and create the Web services server and the service that will run on it.

Once the server and service are created, they will be available for use. You can check on their status in IBM Web Administration for i.

To test the Web service, you can select Manage Web Services Server. This will show the deployed Web services on this server.

By selecting Manage Deployed Services, you can see the full list of services on the server. Here, you can start, stop, deploy, and uninstall the Web services on this server. We can also test a Web service here using a generated test client. Choose CONVERTS and click Test Service.

This will bring up a test client screen. Here, you can add parameters, enter data, and test the different functions of the service.

The service is now ready to be accessed by an external Web service client.
[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.1.0"}]
Historical Number
538435538
Was this topic helpful?
Document Information
Modified date:
18 December 2019
UID
nas8N1012707
Manage My Notification Subscriptions