This is fifth in a series demonstrating programmatic access to Metapedia Terms through the web services API available in SAP Information Steward. See the first post, Creating a Custom Interface to SAP Information Steward’s Metapedia using Web Services, for an introduction. Earlier we extracted Metapedia content through the web service API using SoapUI, and we set up a development environment on our workstation in the previous post: Metapedia Custom Interface – Create the JSP Web Application. Today we will leverage Axis2, one of the applications we installed in Metapedia Custom Interface – Setting Up the Development Environment, to do much of the work for us to generate interface classes.
An introduction to Axis2
Axis2 is a powerful open-source library that facilitates web service development. Among its many features is wsdl2java, a utility that dynamically generates java classes for a specified web service interface. The classes, together with Axis2 libraries, handle all aspects of communication with the web service so we can interact programmically with SAP Information Steward through local objects. Technically it would be possible to use the SAP Information Steward API without Axis2, but it would require that we construct and parse blocks of XML text meeting the exact format requirements of the web services. Even calling the ping function would be messy.
In order to generate code for our specific web services, we must provide Axis2 with a WSDL. The wsdl2java utility accepts either a URL or local files as input; we will use a URL. Identify the WSDL URL (as we did in Metapedia Custom Interface – Querying Web Services with SoapUI for SoapUI):
- In a web browser, navigate to:
- where <InfoStewardServer> and <Port> reflect your Information Steward server name and port number respectively.
- Copy the returned URL
Now let’s invoke the wsdl2java utility:
- Create a working folder for this project; mine is named C:\MetapediaWS and I’ll be referring to it throughout the tutorial
- Open a command prompt
- Navigate to C:\MetapediaWS
- Execute the following command, substituting your URL for <WSDL_URL>:
"C:\Program Files\axis2-1.6.2\bin\wsdl2java.bat" -uri <WSDL_URL> -d adb –s
Your screen may look something like this:
If successful, wsdl2java will create a deep folder structure in C:\MetapediaWS, at the bottoms of which are java files. This will be our interface to the ISCommon interface which exposes logon and logout functions. The Metapedia specific web services are contained in another interface named MetapediaService so we must generate classes for it as well. To do so, simply repeat the command above, but substitute the term “MetapediaService” for “ISCommon” within the <WSDL_URL> value. The resulting folder structure should resemble the following:
Tune in to the next post in the series:
We'll expand the simple "hello world" web app which we created earlier, adding these Axis2 generated classes and code in our JSP that uses them.