AS/400 Links Partner with Rochester Institute Contact Us
Training Catalog Free Downloads Free Downloads iSeries Career Center Privacy / Usage


Streamlining Core Business Processes with XML / RPG

HOME >> Streamlining Core Business Processes with XML / RPG

Streamlining Core Business Processes with XML / RPG
by Aaron Bartell

 
XML is now the standard for cross-platform communication. IBM, Sun, Microsoft, and many other large technology players are all using XML web services. More importantly, businesses around the globe are requiring many new communication processes be implemented completely in XML and web services. This means everyone is impacted by the need to understand and process XML to continue in business.

The following is a list of areas where real RPG programmers in real companies use XML and RPG to streamline core business processes.
 
  1. Business Intelligence
    Offer an XML web service from your IBM i machine so your PC programmers can gain real-time access to RPG business logic and DB2 data. For example, you may have your front end web presence on a Wintel server. You could have that web application make requests back to your IBM i behind the firewall for data validation purposes in an effort to save on duplicating databases from the IBM i to MSSQL or MySQL.



  2. Shipping/Logistics
    Use FedEx's Address Verification XML web service. This would allow a customer service rep to remain in your home grown application and with the stroke of a key validate an address against the FedEx database to ensure the package can be delivered with that carrier. This is in contrast to needing to open a browser application and navigating to a website, then copy/paste information into the page manually. UPS and other carriers offer similar services, all of which use XML. An example of the finished FedEx application can be watched here: http://xml4rpg.com/videos/FedEx_AdrVer/FedEx_AdrVer.html


  3. Insurance
    For insurance companies you can get real-time credit scores by invoking a web service provided by companies like Equifax, TransUnion, etc. You simply submit a prospect's information over HTTP/SSL and receive credit scores back in seconds - all with XML and all in RPG!


  4. Payment Solutions
    Interface with a third party credit card processor to authorize and capture payments (i.e. www.tpisoft.com).

  5. Customer Resource Management
    Utilize "customer loyalty" style web services (i.e. http://loyaltylab.com).


  6. Government
    Municipal governments are also hopping on the bandwagon. In Minnesota you can get real-time feeds of traffic information which could be great for a variety of purposes including being useful for a taxi/choufer service. In Alabama you can use their Title Inquiry XML web service to learn about vehicle registration statuses.


  7. Web Design
    Use XML to feed Adobe Flex/Flash and create aesthetically pleasing pages (i.e. http://red.rpg-xml.com/flex/flexdash.html). Note that once experienced with RPG and XML you can create something like this in as little as an afternoon. To create that pie chart I simply copied an example I found online and changed the XML data source to point at my IBM i which is serving up an RPG XML Web Service.


  8. Office Documents
    You can even use XML to compose Microsoft Word and Excel documents! (requires Microsoft Office 2003 or greater).
 
As you can see the possibilities of XML are ever increasing, and this is because it has gained acceptance as a preferred technology regardless of any downsides it has (i.e. it is very verbose in nature and takes up more bandwidth than other technologies, but in the same breath it is VERY flexible and can be utilized from most any language and or platform).

While XML can be used for things like creating Microsoft Word and Excel documents, it is primarily used for Web Services which I like to describe in this way: Web Services are nothing more than one RPG program calling another. The difference is that Web Services use XML to carry data vs. RPG variables or data structures, and it uses HTTP to send the information from one program to another vs. using OS400 to relay information.

To get an idea of how all the XML and Web Service technologies fit together it might be good to look at the history of how they came to be and what need they are addressing.

Over the years, IT departments have built “technology silos” based on business needs. Think of a silo as a single server with a specific application on it (i.e. a windows server running your CRM and your IBM i running the core business). Until just a few years ago it was deemed OK for these systems to not talk to each other, but because of business industry competition, and the need to find more efficient ways of doing things, a group of IT vendors got together and started thinking about how to “bridge the gap”. They began to theorize what technologies would best suit the ever changing technology sector. There were many failed attempts preceding this initiative so they had an idea of what WOULD NOT work (i.e. proprietary and closed specifications from Sun, Microsoft and IBM). They needed to leverage existing popular technologies and introduce flexible new technologies which brings us to the two most prominent technologies in Web Services - HTTP and XML.

If you think about it, HTTP had already become well established with the program call concept by allowing communication from the browser to a remote server. And for program to program communication to happen you need data to be passed both ways - HTTP provides that. After selecting HTTP it was necessary to decide on what technology would be used to transmit information. It was obvious to them that fixed length structures (like EDI formats) would cause problems so XML was brought in to very flexible way of describing data. Think of XML as RPG data structures on steroids. Figure 1 shows an RPG data structure and how it can hold data, and Figure 2 shows an example of the equivalent in XML.

Figure 1 - RPG data structure

Figure 1 RPG Data Structure

Figure 2 - XML holding data

Figure 2 XML Holding Data

The important difference to note is that XML describes itself outside of a programming language and is human readable. Figure 3 shows what RPG data looks like in memory and Figure 4 shows what XML looks like in memory. By including the name of the data with the data itself it makes XML much easier to parse, and there is no guessing when one piece of data starts and ends as there are beginning and ending element delimiters ( i.e. <name> and </name> ).

Figure 3 - RPG data in memory

Figure 3 RPG Data in Memory

Figure 4 - XML data in memory

Figure 4 Data in Memory

Going back to Figure 2 it is important to declare that XML has two basic mechanisms for holding business data and they are called elements and attributes. An example of an element is <name>Aaron Bartell</name> and an example of an attribute is dropShip=”false”. As you can see, elements can be within another element to create a formidable relationship between pieces of data. This allows us to group “like” pieces of data together to come up with an organized XML document. Oh, and before I forget to mention it, you can name your XML elements whatever you want as long as they will make sense to the other party you will be sending data to. Click here to learn more.

Note From the Author

This white paper is just a short example of the training you will receive with the XML Web Services for RPG Programmers course. My aim is to provide benefit for the RPG programmers who have better things to do than wade through web site after web site, trying to find a tangible definition of how this XML web service paradigm operates. For the RPG programmer who doesn't have time to start from ground zero but instead needs a working solution this week! This training course isn't just meant to introduce technology, but take you from beginning to end concerning what's needed to do XML web services on the System i5 - entirely in RPG! That's right, you don't have to learn Java or install WebSphere Application Server on your System i5 to be successful with XML web services! With this course you will get up and running very quickly. I cover everything from how to compose, parse, and transmit XML to setting up Apache, to setting up SSL, to must-have debugging techniques; all the while giving insight to the most common XML web service pitfalls so you can save days of frustration!
Some things just can't be expressed well in text, and if a picture is worth one thousand words then a video tutorial is a book in itself - which is why we have included a number of author guided video tutorials to more easily convey certain topics.

Click Here to Learn More