Published on System iNetwork (http://systeminetwork.com)
IBM's Integrated Web Services
By linda.harty@penton.com
Created Jun 11 2008 - 18:10

By:
Scott Klement [1]

Did you know that, as of a recent PTF level on V5R4 (or later), i5/OS comes with a built-in web services server? This tool is specifically designed to let you easily export your RPG or Cobol routines as web services. This new support does require that Java be installed on your machine, but it doesn't require WebSphere Application Server (WAS). The services are made available through the Apache HTTP server.

And it costs you nothing. It's built in to i5/OS!

IBM has set up a web page that explains what software you need installed, which PTF levels you have to have, and so on, in order to use this new support. IBM also provides a great step-by-step tutorial with screen shots explaining how to create your first web service.

To learn more, check out IBM's "Integrated Web Services for i" website:
ibm.com/systems/i/software/iws [2]

  • To see the system requirements, click the Support tab.
  • To see the tutorial, click the Getting Started tab, and then click Learn Web services server.

So far, I haven't tried using this tool for any production software, but I did set up a quick proof-of-concept program. I decided to write a simple RPG program that looks up the description of a particular item number. Here's the RPG code:

     FITMMAST   IF   E           K DISK    USROPN

     D TESTWS          PR                  ExtPgm('TESTWS')
     D   peItem                       5p 0 const
     D   peMsg                       80a
     D TESTWS          PI
     D   peItem                       5p 0 const
     D   peMsg                       80a
      /free
            *inlr = *on;

            open ITMMAST;

            chain peItem ITMMAST;
            if not %found;
               peMsg = 'Item ' + %editc(peItem:'X') + ' not found';
            else;
               peMsg = imDesc;
            endif;

            close *all;
            return;
      /end-free

As you can see, the program accepts parameters for the item number and description. This program can just as easily be called from another program. It could pass the item number and a variable for the description, and my RPG code would look up the item in the item master (ITMMAST) file and return the description.

I compiled this program with the following command:

   CRTBNDRPG PGM(TESTWS) +
             PGMINFO(*PCML) + 
             INFOSTMF('/home/klemscot/testws.pcml')

This command compiles my program, of course, but it also generates a Program Call Markup Language (PCML) document -- an XML document that describes my program's parameter list. The Web Services wizard uses that PCML document to determine how to call my program and how to generate the Web Services Description Language (WSDL) for it.

Now that I've created my program, I create a web service for it by going to the Integrated Web Services for i website and following the instructions in the Getting Started tutorial. After that's done, presto! I have a web service that returns my item description.

Copyright © Penton Media

Source URL: http://systeminetwork.com/article/ibms-integrated-web-services

Links:
[1] http://systeminetwork.com/author/scott-klement
[2] http://www.ibm.com/systems/i/software/iws