Web Services

 < Free Open Study > 



Organizations often need to share and exchange computing resources. For example:

  • A portfolio management application would need to periodically check the prices of the stocks and bonds

  • An automated store restocking system would need to be able to place orders with manufacturers and wholesalers

  • A doctor would need to be able to exchange patient information with insurance companies and other physicians

In the past, the problem of implementing these connections have been solved on a case-by-case basis. Some solutions used technologies such as CORBA and COM, others provided custom file or record exchange schemes, some even required manual re-entry of the information.

In each of these cases, we are essentially trying to solve the same problem: how to share resources, functionality, and information between different computing systems. Web services represent a new approach to addressing this challenge.

start sidebar

A web service is an application component that is accessible via standard web protocols.

end sidebar

Web services expose components for remote execution using the technology and infrastructure of the Web. A remote procedure call (RPC) is executed by passing arguments through some type of connection (such as an HTTP connection) to a function, which then executes using those arguments and returns its results back to the requesting agent.

start sidebar

Servlets provide a natural mechanism for delivery of web services because they are designed to process requests and responses over the Web.

end sidebar

Web services are easy for most programmers to understand and implement, and it is easy for a company to integrate existing computing resources through web services because they are built using the same web and application servers that companies are already using. There's no need to go out and purchase new or expensive tools to use or to create web services.

In addition, web services are interoperable. They can be implemented using any number of language on any platform, and can use different technologies behind the scenes. A web service written as a servlet for the J2EE platform using RMI and JDBC could call another web service on the .NET platform that is implemented in C#. Consequently, web services present low barriers to entry and as a web service request travels over the same infrastructure as if it were a web browser generated HTTP request it will not be hindered by firewalls.

Crucially, web services have broad industry support. The world's largest software companies, including Microsoft, IBM, and Sun Microsystems have worked together to establish standards for web services to ensure their interoperability.

How Web Services Work

Web services work as follows:

  • A client (also known as the user agent) invokes a web service by generating an HTTP request - just as a browser requests a web page. The HTTP request identifies the component that will be invoked and provides the parameters or arguments needed to run the component - just as we request a CGI program or servlet.

  • The server converts the arguments as required and sends the request to the appropriate component, which performs its calculations (retrieving information from other systems and databases as needed) and returns its results.

  • The results are then formatted so as to be compatible with the HTTP response that will be interpreted by the client.

  • The HTTP response is then returned to the requesting client.

This is illustrated in the following diagram:

click to expand

In order for this to work, both the client and the server must agree on:

  • How a specific component is accessed or selected from other available components

  • How arguments are passed in

  • How results are returned

  • How errors are handled

For most web services developed today, this is done using the Simple Object Access Protocol (SOAP).

Simple Object Access Protocol

The Simple Object Access Protocol (SOAP) is an XML-based protocol that allows the exchange of information in a decentralized, distributed environment. SOAP consists of three parts:

  • An envelope that provides a framework for describing what is in a SOAP message and how it is to be processed

  • A set of encoding rules that define how parameters and return values are encoded

  • A convention for implementing remote procedure calls (RPC)

SOAP is a one-way messaging system. This means that when SOAP is used in a request-response pattern, separate messages are sent in each direction. SOAP also provides the ability for messages to be broadcast to a large number of target systems or for messages to be forwarded to multiple systems, with each system processing part of the SOAP message.

SOAP is rapidly becoming a major industry standard. It offers independence from the underlying implementation technology and can be implemented in many languages, on many platforms using different component technologies.

More information on SOAP can be found in Professional Java SOAP (ISBN: 1-861006-10-1).



 < Free Open Study > 



Professional Java Servlets 2.3
Professional Java Servlets 2.3
ISBN: 186100561X
EAN: 2147483647
Year: 2006
Pages: 130

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net