RPG, XML, SOAP, and REST: Web Services for IBM i
October 14, 2015 Dan Burger
Anyone following the evolution of Web services has seen the RESTful architecture gaining ground quickly on the traditional favorite SOAP architecture. Web development and particularly Web-based mobile development has welcomed REST. To keep up with demand, Krengel Technology has introduced version 3.2 of its RPG-XML Suite, which delivers new Web service capabilities to IBM i customers.
Krengel developed the RPG-XML Suite for RPG developers who, as the Krengel website notes, “have lived through creating Web services in RPG and Java without a well-packaged development toolset.”
RESTful services have increased in popularity, says Krengel lead developer Greg Bissey. “RESTful is becoming the go-to approach,” he says. “It’s simplified and more open than SOAP. Customers consuming Web services find them easier to work with. They generate less support, use less proprietary tooling, and are more accessible to a wider audience. I am seeing more shops switching from SOAP to RESTful services.”
The RPG-XML Suite continues to support SOAP services and other types of Web services. With the new version 3.2 release, Krengel added support for the following RESTful HTTP methods: PUT, DELETE, HEAD, OPTIONS and PATCH. In previous releases, the product only supported the SOAP methods POST and GET.
In addition to the RESTful HTTP methods, Krengel introduced the capability to parse data that’s directly in the URI (uniform resource identifier). This capability is typically found in robust Web services environments associated with SOAP-based environments. It’s one indicator that RESTful Web services are more robust than some believe, according to Bissey.
“Often times people associate complexity with functionality–the more complex it is, the assumption is that it is more robust,” Bissey says with a nod toward SOAP advocates. “One of the reasons RESTful is becoming popular is because it dispels that notion and shows that a simple approach can be a robust solution.”
Minimizing complexity is an oft-stated goal in the software business. In instances where it turns out to be true, it becomes the Midas touch. Of course, simplicity and its evil twin complexity depend on the project requirements.
Jeff Skistad, CEO of Krengel Technology, says that at least half the companies he comes in contact with prefer to have Web services done by Krengel’s professional services staff. Companies don’t have the internal resources to get Web services projects completed in a reasonable time frame.
“They realize it comes down to efficiency,” Skistad says. “Their internal task lists are already long. We have the expertise. And even if they have the resources, they still need to decide whether they can switch from what they are doing to this project.”
If they have the comfort level and understanding of tool set, they will take it on themselves, he says.
The basic description of the RPG-XML Suite is that it’s an RPG service program that aids in the composition, transmission, and parsing of XML. It’s used to provide as well as consume XML Web services.
An example noted on the Krengel Technology website is an RPG program that sends an XML invoice to a business partner to automate the billing process. In the opposite role, the server/client calls RPG-XML Suite by passing an XML request. The RPG Web service receives and parses the XML. The RPG Web service program presents the data from the XML document so other RPG business logic can be called or data can simply be stored in the DB2 for i database. The RPG web service program can then compose an XML response and return it to the caller (server/client).
Krengel supports two versions of the RPG-XML Suite: versions 2 and 3. Each has its own APIs. The version 3 releases require IBM i 6.1, 7.1 or 7.2. The version 2 release supports V5R2 through V5R4. New enhancements, naturally, go into the version 3 release.
Additional enhancements in the newly available 3.2 release that we’ve yet to talk about include increased performance of the XML compose engine, automatic compression of white space when composing from templates, and automatic omission of uncomposed template content. Users familiar with the RPG-XML templates will notice these changes, Bissey says.
There’s also support for larger stream files. Previously the limit was 16 MB on both the input and output. The limit ceiling now has been tested beyond 50 MB, according to Bissey. However, he advises that the limit depends on the application and its use of variables, the memory on the machine, and other factors. In theory, it could go higher than the 50 MB test result, he says.
The IBM i operating system, at the 6.1 release, introduced 60 MB variables (16 MB was the previous limit). The capability to handle the larger variables was included in the RPG-XML version 3 API.
Support for XML was built into RPG IV with the release of V5R4 in 2006. It’s fair to say that release did more to drive RPG programmers away than it did to draw them to XML. With time, IBM eventually corrected its mistakes, but first impressions are powerful and IBM has trouble learning this lesson. RPG support for XML is now praiseworthy and the word is spreading.
Krengel’s next enhancement, Skistad says, is support for JSON-based communications. “We are actively working on this,” he says. “Q1 2016 is our target for that with RPG-XML version 3.3.”