T320 Ebusiness Technologies: Foundations and Practice
Web Service Development Tutorials
Dr Neil Simpkins Department of Communication and Systems, Open University Email: firstname.lastname@example.org
IntroductionThis series of tutorials are adapted from those created as a part of a third level (year) course at the Open University. The course, "E-business Technologies: Foundations and Practice", encompasses a wide range of E-business aspects and related technology. The course consists of four blocks and a substantial project. These tutorials are adapted from just one block. As an academic course there is a focus on learning and understanding of concepts and processes as well as acquiring skill in research and analysis. You can ignore all the references to other 'Block 3' components and other 'blocks' of the course. In the full course the tutorials are linked together by a course text which describes and discusses aspects of 'Service Orientated Architecture' (SOA). This brief web page will hopefully provide sufficient background for the activities to be usable. Here I will give a very much shortened account to tie the tutorials together.
Service Orientated ArchitectureThe tutorials are based around the concept of 'Service Orientated Architecture' (SOA).
Figure 1 Outline of Service Orientated Architecture The standard SOA model (Figure 1) introduces three key actors:
- a web service 'provider' which makes services available and is also responsible for publishing a description of the service in one or more service directories.
- a web service 'broker', who maintains a searchable directory of service descriptions.
- a service 'requestor' or 'client' who wishes to find and use a service.
Figure 2 Outline of Web Service Operation These models can be realised as a Web Service by instantiating each of the actors with a specific software component and adopting specific protocols.
Figure 3 Web service operation: component and protocol instances We have adopted a set of components (Figure 3) to provide the three actors as follows:
- 'provider' is realised by Axis2 server side software (http://ws.apache.org/axis2/). This software is a web application which can be run on Tomcat, for example, and which provides services to manage and expose web services over HTTP. It handles SOAP messages (requests and responses) and also provides some support for alternative REST based communication with web services. There are guides to installing Tomcat under 'Documentation' on the Apache site and also a guide to installing Axis2 on the Axis2 website.
- 'broker' is provided by an implementation of 'Universal Description, Discovery, and Integration' (UDDI). We selected 'jUDDI' (http://ws.apache.org/juddi). This web application has its own interface for publishing and managing web service descriptions. It also provides a standard API which can be accessed by Eclipse WTP which provides a nice interface for this. Note that running jUDDI requires a database to be installed and configured to store descriptions. SQL scripts are provide with the software to set up tables etc for a range of databases, including MySQL http://www.mysql.com/. A guide to installing jUDDI and connecting to MySQL comes with the software download.
- 'client' is provided by Eclipse and WTP. Eclipse is able to automatically construct web pages which have suitable input fields to pass data to a service and to construct an appropriate SOAP request message. It can also handle the SOAP response from a service and display any information that is returned.
- we have produced an installation wizard on a DVD which sets up Eclipse with plugins and Tomcat ready to be used. To follow the tutorials you will need to install this software yourself by hand.
- we have installed the Axis2 and jUDDI software on servers at the OU with accounts ready for students to use (manage web services and publishing descriptions). To follow the tutorials this software also has to be installed by hand.
Eclipse pluginsThe first tutorial outlines the plugins we have used. Here I will provide more leads to acquiring the software. We used Eclipse 3.3 but I believe there are no problems using other versions. We did encounter problems with running Eclipse on older Java versions (from memory I think Java 1.4 caused minor problems).
Web Tools PlatformThe Web Tools Platform (WTP) provides a range of facilities for implementing, deploying, running and texting services. I don't pretend to be an expert on WTP but we have used its facilities extensively in what follows. WTP also provides facilities for handling XML for example, which are covered earlier in the OU's T320 course. The WTP can be added to Eclipse either as a download which you put into the correct directories by hand or by using Eclipse's software management tool (use the 'Find and install' option on the 'Help > Software updates' menu). Personally, I found the update approach to be more reliable but during this process it could be tricky to identify just the pre-requisite software required for WTP. If the process has not improved in recent versions I may produce a guide to this later (it would be useful to receive feedback on installing WTP generally). For further information on WTP, see: http://www.eclipse.org/webtools/
For WTP updates see: http://download.eclipse.org/webtools/updates/
For WTP downloads see: http://download.eclipse.org/webtools/downloads/
Axis2 pluginThe Axis2 service maker is employed later in the tutorials. This tool simply wraps up a web service as an Axis archive file (.aar) suitable for uploading to the Axis2 server software which manages services. An Axis archive is very similar to a '.war' or '.zip' file in pulling together a number of resources or files into a single item which is easy to handle. For further information see: http://ws.apache.org/axis2/tools/1_4_1/eclipse/servicearchiver-plugin.html.
soapUI pluginThe soapUI plugin for Eclipse is used in the tutorials to test a service for compliance to the basic WS-I profile (http://www.ws-i.org/) for interoperability. The potential a web service has for inter-operating with other services is of course extremely important. For further information see: http://www.soapui.org/eclipse/index.html
TutorialsThe tutorials are all PDF format documents. If you need a reader for PDFs then visit the Adobe site and download the free Adobe Reader. The tutorials are:
- Implementing a toy "Hello there" web service . This guide refers to a supporting guide " Configuring an Application Server in Eclipse". This tutorial starts out by using Eclipse and a local Tomcat application server. Based on a very simple piece of Java code which provides the service's 'business logic' a service is implemented and then deployed to Tomcat by Eclipse. Eclipse is then used to create a simple client and to test the service.
- Generating a client from a WSDL document. This tutorial demonstrates how to use Eclipse to generate a client set of web pages and call a web service based on its Web Services Description Language (WSDL) document. It uses some simple demonstration toy web services hosted at the OU but if these are not available you can employ a service running locally or use another public site, such as XMethods.
- Editing the 'Hello' web service WSDL. This tutorial examines the "Hello there" WSDL document using the Eclipse WTP WSDL editor. The graphical view is shown to be very useful in understanding WSDL and making any alterations, such as adjusting the location of the service in the description when a service is deployed to a new location.
- Deploying a web service. This tutorial demonstrates how to wrap up and deploy a web service using Eclipse and the Axis2 archiving plugin. It also illustrates how to deploy the archive to Axis2 running on a Tomcat server and then test the web service.
- Publishing and accessing UDDI. This tutorial illustrates how you can access UDDI using Eclipse and both publish your own service descriptions and search for useful services. The tutorial refers to a UDDI service hosted at the OU which should usually be available but if not there are others on the web, such as the Global Biodiversity Information Facility UDDI Registry You will not have permissions to publish to the OU UDDI but can publish to your own UDDI if you have installed jUDDI.
Axis2 and REST
This very brief guide demonstrates Representational State Transfer (REST) type access to a
web service which is hosted on Axis2.
REST is a term coined by Roy Fielding in his PhD dissertation to describe an architectural
style of systems networking that does not require additional mechanisms or protocols
over or above existing Internet protocols. In Fielding's own words (2000, Section 6.1):
"The name 'Representational State Transfer' is intended to evoke an image of how a well-designed Web application behaves: a network of web pages (a virtual state-machine), where the user progresses through the application by selecting links (state transitions), resulting in the next page (representing the next state of the application) being transferred to the user and rendered for their use."
- Testing a web service for WS-I conformance. In this tutorial I test the conformance of a simple web service against the WS-I basic profile. The soapUI plugin is used to generate a report of the results of testing the service against each of the profile's criteria.
- Specifying WSDL style and encoding using Eclipse. The importance of WSDL style for aspects such as interoperability are discussed by Butek, see: Which style of WSDL should I use?