Table of Contents
Sharing data through SAP Java code web service programs
Communicating in SAP Web Services through XML markup tags and SAP SOAP
Getting started with Apache SAP web services
Addressing SAP Web Services security issues
The first two articles in this series have described what Web services are, how they relate to SAP, and a first look at some of the technologies needed to create Web services. One of Web services greatest assets is that it is reusable by both internal and external applications and business partners. It achieves this by using marked up text or XML. However, XML by itself does not solve every communication problem nor does it provide a vocabulary for exchanging information. It is merely a foundation on which to build vocabularies.
The need for a common vocabulary
XML provides markup tags to signify the meaning or the context of the contained data. However, parties interested in communicating by exchanging XML have to agree on which tags to use and what their meanings are. Our Web service clients will send XML to us indicating the name of the Web service and parameters to pass to that Web service. They expect to receive a XML response containing the result of the Web service.
The name and syntax of the markup tags that enclose the name of the Web service, parameters, and the result of the Web service need to be universal so that clients can access our Web service regardless of the hardware, operating system, and applications they are currently running.
Agreeing on communication standards is usually a political catastrophe but the computing industry has just experienced one of the greatest exceptions to this rule. SOAP (Simple Object Access Protocol) is a lightweight distributed computing protocol that has received industry backing by every major software and hardware vendor. SOAP is build on top of XML and dictates how Web service clients and servers exchange information through the use of XML tags.
Because SOAP is a published standard, SOAP messages must have a specific structure. A SOAP message consists of an envelope, an optional header and a mandatory body. The envelope describes the contents of the message and how to handle the information. The body contains the name of the Web service, parameters, and responses from Web services. Here is an example SOAP message:
<gamma:getCompanyList xmlns: gamma="urn:CompanyListService">
This SOAP message has an envelope and a body. There is a Web service named CompanyListService with a function (or method) named getCompanyList. This method takes one parameter, a state abbreviation. In this case we are passing in California. The rest of the information has to do with the syntax and definition of SOAP itself.
Can someone help with the heavy lifting?
So, in order to create Web service servers and clients, we need to create and process SOAP messages. This involves a lot of code that has nothing to do with our actual business logic. All we are doing here is taking a client request and creating a SOAP message from it. Thankfully, there are toolkits that automate this process.
One such toolkit is Apache SOAP and comes from The Apache XML Project. One of the great things about Apache SOAP is that it is open-source, or in economic terms, free. If you remember from our architecture diagram, we are going to need a J2EE Application Server Apache to communicate with SAP through JCo and to service our clients. Apache SOAP is able to run on most J2EE Application Servers. In our case, we are going to use an open-source Application Server named Tomcat. Tomcat is a product of The Jakarta Project. With this in mind, let's update our architecture diagram.
In the next article, we will discuss how to set up Tomcat and Apache SOAP. In the meantime, for more information please look at http://xml.apache.org/soap/index.html for more information on Apache SOAP and http://jakarta.apache.org/tomcat/index.html for more information on Tomcat.