Table of Contents
Sharing data through SAP Java code web service programs
In my last article, I discussed how Web Services are very useful for creating an integration solution that can be repeated with many internal and external business partners and applications. The tip also contained an explanation of the fit between Web Services and SAP. The content was presented at a 50,000-foot level and did not go into any technical details. In article 2 of this series, we will explore the technologies that you can use to extend your SAP data to the outside world.
How do we communicate with SAP?
Although there are many ways of connecting SAP to the outside world, with SAP's endorsement of Java, J2EE and the Java Connector Architecture, these are the technologies we will be discussing here. I think a little background information will prove to be invaluable.
Java, first publicly available in 1996, is an Object Oriented Language that relies on a Java Virtual Machine (JVM) and a Java compiler. The Java compiler takes Java source code and spits out Java bytecode. The JVM is responsible for executing the instructions in the Java bytecode. JVMs are available for a multitude of Operating Systems and hardware platforms including all versions of Windows, many versions of Unix, and Macintosh. The key point here is that a developer creates Java source code, compiles it, and can then execute this code on virtually every major hardware platform and get the same results!
Originally, Java programs were targeted at desktop applications and within web pages in a form known as applets. Over time, more libraries or building blocks became available for Java developers and a standard for creating multiple tier web applications was created. This standard came to be known as the Java 2 Enterprise Edition or J2EE. Since this is a standard, vendors must build products that meet the J2EE specifications. These products are known as J2EE Application Servers and examples are SAP Web Application Server 6.2, BEA WebLogic Server and IBM WebSphere. Our solution will use a J2EE Application Server.
The J2EE encompasses many technologies including the Java Connector Architecture (JCA). JCA provides for a standard method of communication to legacy systems including Enterprise Resource Planners such as SAP and Peoplesoft and Customer Relationship Managers (CRM) such as Siebel. The JCA is a standard and it is up to vendors to implement the standard. SAP did this with JCo, the SAP Java Connector. JCo allows Java code to log into SAP and communicate with ABAP code. Therefore, our solution will use JCo.
How do we communicate with other applications and business partners? Web Services rely on the use of the Extended Markup Language (XML). A simplified view of XML is that it is simply standard text marked up with special tags. These tags explain what the context of the text is. As an example, here is unmarked up text: Abigale,Adams,1932,Brown,48. Here is the same text marked up with tags:
As you can see, the tags give context to the tag. These tags can also be referred to as metadata, that is, data about the actual data. Sending and receiving unmarked up data works when the number of participants is small, well known, compatible data formats are in place, and the order and pieces of information do not change often. As you can see, there are a lot of restrictions here. By packaging metadata with the data, XML can be a very useful technology for communication and this is why Web Services relies on XML.
Other applications and business partners will send us XML to initiate a business process such as querying us for pricing information. We will then have to parse this XML to pull out the data inside. This data will then be used to invoke ABAP code on SAP. The results of the BAPI or RFC will then be used to construct an XML response that will be sent back to the other application. Therefore, we will need XML libraries or building blocks to parse and construct XML.
The Architecture So Far So far, we have identified a J2EE Application Server, JCo, and XML libraries as technologies we are going to use. This enables us to draw a picture of the architecture.
In the next article, we will discuss what is necessary to take our existing architecture to build a complete end-to-end Web Service that relies on SAP. Until then, please explore Java, J2EE and JCo. Java and J2EE information can be found at http://java.sun.com and information about JCo is available at ftp://ftp.sap.com/pub/sapjco/ and downloading jco-docs-1.1.zip. Unzip this file and view the file JCOTutorial.pdf in the docs directory.