Creating an IBM i program Web service

You can create a Web service from ILE RPG or COBOL source or from PCML files using the Web Service wizard.

Before you begin

Start the application server before running the Web Service wizard.

From the Servers view (Window > Show View > Other > Server > Servers), right-click on a server in the list and select Start.

You may experience errors if this step is not completed and it may take several minutes for the server to start.

About this task

This tool set offers two basic approaches to creating an IBM® i program Web service:
  • For ILE RPG and COBOL source, or PCML files, you can use the Web Service wizard directly.
  • For other IBM i source (like ILE C) you can use the Program Call wizard to produce a Java™ bean that can then be used by the Web Service wizard.
This task describes the process for ILE RPG and COBOL programs.

The IBM i program Web Service can be used to create an Enterprise Service Component in a WebSphere® Integration Developer business integration application.

From the Remote System Explorer perspective, the IBM i Projects perspective, or a dynamic Web project, you can create Web services from ILE RPG or COBOL source, or from a PCML file.

If you start from Remote System Explorer or IBM i Projects, or if you use the Browse for File dialog, any connection information you have already defined is used by the Web Service wizard.

Procedure

  1. Right-click the ILE RPG, COBOL, or PCML source object and select Web Services > Create Web Service.

    If the library containing your source object is not in the library list, expand Objects, right-click Library list, select Add Library List Entry, and enter the name of your library in the Additional library field.

    The Web Service wizard opens and is populated with data from the source object that you selected.
  2. In the Web service type field, Bottom up IBM i Program Web Service should be highlighted. If not, select it from the drop-down list.
  3. Click Browse to open the Select Service Implementation window.
  4. Ensure that the Program type is correct, especially if you are creating a Web Service from an ILE RPG or COBOL source file. Program type defaults to *SRVPGM, which may not be correct for your source file.
  5. Click Browse next to the Runtime configuration field to find authentication and runtime configuration values, or click Edit to set them. See Configuring your IBM i Web Service runtime environment for further information about setting authentication and runtime configuration values.
  6. When you return to the Select Service Implementation window, click OK to set the values and to return to the first page of the Web Service wizard.
  7. Select the stages of the Web services development that you want to complete using the slider:
    • Develop: this develops the WSDL definition and implementation of the Web Service. It includes such tasks as creating modules, which will contain the generated code, WSDL files, deployment descriptors, and Java files when appropriate.
    • Assemble: this ensures that the project that hosts the Web Service or client is associated to an EAR when required by the target application server.
    • Deploy: this creates the deployment code for the service.
    • Install: this installs and configures the Web module and EARs on the target server.
    • Start: this starts the server once the service has been installed on it. The server-config-wsdd file is generated.
    • Test: this provides various options for testing the service, such as using the Web Service Explorer or sample JSP files.
  8. The Server option displays the default server. To deploy your service to a different server, click Server and specify the server that you want to use.
  9. The Web service runtime displays the default runtime. To deploy your service to a different runtime, click Web service runtime and specify the runtime that you want to use.
  10. The Service project option displays the project containing the project selected in your workspace. To specify a different project and EAR file, click the Service project link. Ensure that the project selected as the Client Web Project is different than the Service Web Project, or the service will be overwritten by the client's generated artifacts.
  11. If you want to create a client, select the type of proxy to be generated from the Client type list, and repeat the above slider steps for the client.
  12. Select the Publish the Web service check box if you want to launch the Web Services Explorer to publish your Web service to a UDDI registry.
  13. Select the Monitor the Web service check box to send the Web service traffic through the TCP/IP monitor, which allows you to watch the SOAP traffic generated by the Web service, and to test this traffic for WS-I compliance of the specified Service project. As an alternative, you can manually set up a TCP/IP monitor.
  14. Either click Finish to create the Web service or click Next to configure advanced options.

    The Web service wizard generates at least three classes - YourBeanNameServices.java, YourBeanNameInput.java, and YourBeanNameResult.java. The YourBeanNameInput.java and YourBeanNameResult.java classes are required by the YourBeanNameServices.java class and are used for program input and output parameters.

    For every program that is defined in the Web service wizard, two web service operations are generated. You can use either one of the operations to get the data returned from the remote program call.

    The first operation returns the output data in XML format. The Web services client can retrieve the data by parsing the XML string. The second operation returns the output data in the YourBeanNameResult.java class. The Web services client can retrieve data using the getter methods from the class.


Feedback