Since the program is running on a remote server, you can't call it directly from RPG. Given that it's a web service, I would create a Java program to run on the iSeries and call that Java program from within RPG. Nowaday's, RPG can interface directly with Java. You have to create some D-specs to declare the class and prototype out the method calls. In the following example, assume a Java class exists called ServiceCaller in the package 'tools'. It has a single method called getServiceReply which accepts three character fields and returns an integer.
*Define the Java class locally.
DServiceCaller S O CLASS(*JAVA:'tools.ServiceCaller')
*Class constructor. No parameters.
DnewServiceCaller PR O EXTPROC(*JAVA:
D 'tools.ServiceCaller':
D *CONSTRUCTOR)
D CLASS(*JAVA:'tools.ServiceCaller')
*GetServiceReply.
*public int getServiceReply(byte[] parm1, byte[] parm2, byte[] parm3)
DgetServiceReply PR 10I 0 EXTPROC(*JAVA:
D 'tools.ServiceCaller':
D 'getServiceReply')
D Parm1 400A CONST
D Parm2 400A CONST
D Parm3 400A CONST
Your RPG calc specs will look something like this free-form example:
/free
ServiceCaller = newServiceCaller();
iReply = getServiceReply(ServiceCaller:'Parm1':'Parm2':'Parm3');
/end-free
Inside the java code, within the getServiceReply method, convert those byte arrays to strings like this:
sParm1 = new String(parm1);
sParm2 = new String(parm2);
sParm3 = new String(parm3);
Granted, this is an oversimplified example and your application needs will be slightly different. You will want to add error handling code in case the web service doesn't reply. You may also want to use getters and setters in your class. It all depends on your application needs and the requirements of the remote web service.
Some notes on RPG types to Java types:
RPG Type Java Type
10I 0 int
3I 0 byte
5I 0 short
20I 0 long
N boolean
A byte[]
If you are feeling particularly ambitious, you can call the native Java HTTP classes from within your RPG. But I've found that a custom Java program to act as an in-between that is written specifically to talk to RPG is an easier way to go. Although RPG can talk to Java, it's not as pretty as Java talking to Java.
Additional information on calling Java from RPG can be found in the ILE RPG Programmer's guide. The V5R4 version can be found here: http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/books/sc092507.pdf