IBM i > Developer > RPG

XML for Business


Bookmark and Share

XML has become increasingly more of a fixture in our business applications over the last decade. Because of its platform independence, XML acts as an excellent mediator between applications, whether on a single box or distributed between different servers and even different companies. In many industries, XML is replacing EDI as the document transmission protocol of choice. This is driving technology: the integration of XML with other tools such as DB2 is more effective and productive every year. And RPG is no exception; the introduction of the XML-INTO opcode and other XML related language constructs is a clear indicator of how important IBM considers XML. So in this series of articles, we’ll learn more about what XML does and how it does it, and then begin to look at how you can take advantage of XML in your RPG programs.

Getting Started With XML

Clearly the audience for XML is much larger than just the IBM i community; if you want to get a sense of just how big XML really is, see this standards survey, remembering that, as large as it is, the survey was written eight years ago. But XML is very important to integration of IBM i with the rest of your enterprise and beyond, and to that end many articles have been written about XML and its integration with IBM i. For example, Dan Darnell wrote a great article on XMLService and RPG, while Nick Lawrence wrote a tremendous two-part article on the new enhancements in DB2 to support native XML types. (See part 1 here and part 2 here.) This article is the start of a series that will take a slightly different tack, showing you a hypothetical full-cycle application of the technology.

We’ll use all free technologies on IBM i to build an application that makes an XML request to someone and then processes the response. During this initial phase, I’ll intentionally not focus on the transport mechanism to the external service. I’ll address some of those technologies in Part 3, but I want to emphasize that one of the primary benefits of XML is that you can write your entire application without having to actually invoke the service. With a little judicious design upfront, you can create your application so that it generates an XML document to the IFS and reads the response from the IFS. With this design in place, you can run the generation portion, review and validate the generated XML, then mock up a response and continue the application. You can test many scenarios this way and then once the application logic is finished you can then attach the communications layer. I’m in the midst of complex multiplatform XML project and I’m doing a lot of testing just this way; without it, I would be lost.

I said the technologies I’ll use are free; this is true. I’ll concentrate on CGIDEV2 as my XML creation vehicle and use the native XML parsing capabilities of ILE RPG to process the response. However, you’ll probably want a commercial XML editing tool in your arsenal. Think of it this way: you can use UPDDTA to maintain your files, but the productivity you gain from WRKDBF or DBU more than justifies the cost.

Deciding on an XML tool like choosing a database maintenance tool; a lot has to do with your preferences. I prefer oXygen, but you should research your best option.

Joe Pluta is the founder and chief architect of Pluta Brothers Design Inc. Joe can be reached at joepluta@plutabrothers.com.

Advertisement

Buyers Guide

Search our new 2013 Buyer's Guide.

Search Companies


Search Products


Advertisement

IBM Systems Magazine Subscribe Box Read Now Link Subscribe Now Link

Related Articles

New and Improved XML-INTO

E-Newsletter | Namespace support makes the opcode a viable option

Authenticating on the Web

E-Newsletter | The finer points of OpenRPGUI, Part 1