SOAP-Based Web Services
JADE provides a framework that enables you to build distributed JADE applications using the Extensible Markup Language (XML) Web Services architecture.
A Web service is a Uniform Resource Locator (URL) addressable set of functionality that is exposed over a network to serve as a building block for creating distributed applications.
You cannot run Unicode Web service applications.
In the first part of this chapter, the term Web service specifically refers to an XML‑based Web service. JADE supports the Web service provider and Web service consumer. For details, see "JADE Web Service Provider" and "JADE Web Service Consumer", respectively, in the following subsections.
Only the HTTP protocol is directly supported in this release. If you do not want to use the jadehttp communications module provided as part of the Web services framework, you can still invoke the Web service from your own code. (For more details, see "Using Communications Protocols Other than HTTP in your Web Service", later in this chapter.) For example, you could write your own Simple Mail Transfer Protocol (SMTP) handler to receive e‑mail and create a SOAP message from this e‑mail. You can then create an instance of the Web service class to which the SOAP message can be sent, which will invoke the appropriate method and return a SOAP message as a response. This SOAP message can then be sent back to the user or processed further.
The foundations for Web services are HyperText Transfer Protocol (HTTP), XML, and Simple Object Access Protocol (SOAP, a lightweight HTTP and XML‑based protocol that is used for information exchange), which are governed by the World Wide Web Consortium (W3C). As Web services encapsulate the implementation and provide an interface for communicating with the Web service, you can use them as building blocks for applications.
There is no restriction on the granularity of a Web service. It can range from simple components (for example, an order‑tracking component published by a shipping company) to large applications (for example, hosted financial applications). You can apply Web services at many different levels of a solution.
Web services can provide convenient access to a static set of information; for example, a Web service can allow a customer to request demographic information for a specified city. Alternatively, you could use Web services to implement highly interactive applications; for example, a travel Web site might make it possible to build an entire vacation itinerary online, by using multiple Web services. A user of that travel application could then use Web services to make hotel and rental car reservations, plan flight itineraries, book flights, and so on.
A Web service can aggregate other Web services to provide a sophisticated set of services; for example, a Web service for a real estate agency can make use of a Web service for a credit verification to facilitate approval of online loan applications. Web services provide:
-
Interoperability
As Web services are invoked by using SOAP, which is platform‑neutral, you do not have to determine how to build bridges between the Distributed Component Object Model (DCOM), the Common Object Request Broker Architecture (CORBA), and other disparate protocols. Any Web service can interoperate with any other Web service and because Web services communicate by using HTTP and XML, any network node that supports these technologies can both host and access Web services.
-
Multilanguage support
As you can write Web services in any language, you do not have to learn new languages or standardize on a single language to create or consume Web services.
-
Reuse of existing applications
It is easy to expose existing components and libraries as Web services. Many vendors provide tools to make the task of exposing components and libraries even easier. As most companies have a large number of existing components, libraries, and applications, it may be more cost‑effective to reuse the functionality in these resources than to reimplement them.
-
Use of industry‑supported standards
The support by all major vendors of technologies that are related to Web services (specifically, HTTP, XML, and SOAP) make it easy for heterogeneous systems to communicate. For example, a component written in JADE and exported as a Web service can easily be used by a Common Gateway Interface (CGI) application that is written in C++ if that application were to make a SOAP request and process the result appropriately.
JADE includes an XML parser, which is based on the Expat XML parser library. The JADE XML parser provides a Document Object Model (DOM) interface and a Simple API for XML (SAX) interface. For details about the XML parser and the RootSchema system classes that support this, see Chapter 12, "Processing XML Documents".
For details about generating a Web service consumer unit test class and stub methods, see "Generating a Web Service Consumer Unit Test Class and Stub Methods", in Chapter 17.