IBM i > DEVELOPER > RPG

Need a REST?

Building REST Web Services With RPG


This month’s article begins the process of answering one of the most common questions we’re asked lately: How do I create a Web service?

Our original answer was to suggest using the system’s built-in Web Services Wizard to deploy RPG (or COBOL, etc.) programs as Web services on the built-in Application Server. You can read about this feature in “Unlocking IBM Integrated Web Application Server.” While this is an excellent tool, it deploys your program as a SOAP¹ service and while SOAP is very popular, its complex structure and reliance on XML renders it overkill for many simple tasks.

Recognizing this, many people are now turning to RESTful Web services. Technically speaking, REST stands for REpresentational State Transfer—but that doesn’t really tell you anything. You may find as we did that the further you dig the more confused you get.

The confusion arises from the fact that the full definition of REST encompasses the capability to perform all of the tasks required of a conventional CRUD application (i.e., Create, Read, Update, Delete). This is all well and good, but most people we’ve talked to are just looking to build a Web service to permit information retrieval (i.e., the Read part). So for the purposes of this article, we’ll restrict ourselves to that area which in the formal definition of REST would be an HTTP GET.

  1. SOAP stands for Simple Object Access Protocol—not terribly helpful. And just as the “S” in XML SAX, it adds new meaning to the word “simple.” Rather than try to describe SOAP to you here, we’ll satisfy ourselves with simply referencing Wikipedia on the topic, which should provide enough links to keep the curious among you reading for hours.

  2. Scott Klement’s HTTPAPI is an excellent tool to let RPG programs consume both REST and SOAP Web services. His website provides links to the software and articles and presentations that describe its use.

Jon Paris is a technical editor with IBM Systems Magazine and co-owner of Partner400.

Susan Gantner is a technical editor with IBM Systems Magazine and co-owner of Partner400.



Advertisement

Advertisement

2017 Solutions Edition

A Comprehensive Online Buyer's Guide to Solutions, Services and Education.

New and Improved XML-INTO

Namespace support makes the opcode a viable option

Authenticating on the Web

The finer points of OpenRPGUI, Part 1

The Microphone is Open

Add your voice: Should IBM i include open-source RPG tools?

IBM Systems Magazine Subscribe Box Read Now Link Subscribe Now Link iPad App Google Play Store
IBMi News Sign Up Today! Past News Letters