Inside Web Services

The following topic describes what a web service is, the basic technologies that underlie a web service, and how a web service build with WebLogic Workshop is really an enterprise level web application.

# Web Services and Networks

Essentially, a web service makes software application resources available over networks in a standardized fashion. Other technologies have done the same thing, such as Internet browsers, which make web pages available using standard Internet technologies such as HTTP and HTML. However, these technologies are generally used as a way for human users to view data on a web server and, on their own, are not well suited to enabling application to application communication and integration. What is new and exciting about web service technology is its ability to allow software applications to talk to one another and utilize each other's resource. Using web service technology, one application can call on another to perform simple or complex tasks, even if the two applications are running on different operating systems and are written in different languages. In other words, a web service makes its resources available in such a way that any client application, regardless of its internal implementation, can operate and draw on the resources provided by the web service.

# Basic Technologies

Web services are able to expose their resources in this generally accessible way because they adhere to the following communication standards:

1. A web service publicly describes its own functionality through a WSDL file.

2. A web service communicates with other applications via XML messages.

3. A web service uses a standard network protocol such as HTTP.

## WSDL

A Web Service Description Language (WSDL) file describes how the web service is operated and how other software applications can interface with the web service. Think of a WSDL file as the instruction manual for a web service explaining how a user can draw on the resources provided by the web service. WSDLs are generally publicly accessible and provide enough detail so that potential clients can figure out how to operate the service solely from reading the WSDL file. If a web service translates English sentences into French, the WSDL file will explain how the English sentences should be sent to the web service, and how the French translation will be returned to the requesting client. For more information on WSDL files see WSDL Files: Web Service Descriptions.

## XML and SOAP

Extensible Markup Language (XML) messages provide the common language by which different applications can talk to one another over a network. To operate a web service a user sends an XML message containing a request for the web service to perform some operation; in response the web service sends back another XML message containing the results of the operation. Typically these XML messages are formatted according to SOAP syntax.

Simple Object Access Protocol (SOAP) specifies a standard format for applications to call each other's methods and pass data to one another. Note that other non-SOAP forms of XML messages are possible, depending on the specific requirements of the web service. But, in any case, the sort of XML message and the specific syntax required can be found in the WSDL file, making the web service generally available to any client application capable of sending and receiving the appropriate XML messages. For more information about XML see Introduction to XML.

## HTTP

To make it accessible to other applications across networks, such as the Internet and in-house intranets, web services receive requests and send responses using widely used protocols such as HyperText Transfer Protocol (HTTP) and Java Message Service (JMS).

# Web Service Architecture

The following illustration shows the relationship between a web service (in the center), its client software applications (on the left), and the resources it uses, including databases, other web services, and so on (on the right). A web service communicates with clients and resources over standard protocols such as HTTP by exchanging XML messages. The WebLogic Server on which the web service is deployed is responsible for routing incoming XML messages to the web service code that you write. The web service exports a WSDL file to describe its interface, which other developers may use to write components to access the service.

#####

# Other Characteristics of Web Services

The following characteristics of web services make them well-suited for creating integrated systems on the Internet or intranets.

## Reusable

Just like other component technologies, once you have written code and exposed it as a web service, you or others may use that code again and again from various applications. Once you've written and tested your code, it’s easy to make use of it in new applications. Because web services use standard XML protocols, these components can be consumed by a much wider variety of users than with previous component based technologies.

## Flexible

Because web services communicate using extensible XML documents (instead of small pieces of data), they can more easily accommodate changing data and content over time. This also encourages packaging many activities into a single method call over the network. This greatly improves the efficiency of your applications, especially over high-latency networks such as the Internet or corporate Wide Area Networks (WANs).

## Standards-Based

Web services are built on standard technologies such as HTTP and XML. All web service messages are exchanged using a standard XML-messaging protocol known as SOAP, and web service interfaces are described using documents in the WSDL standard. These standards are all completely agnostic of the platform on which the web services were built.

# WebLogic Workshop and Enterprise Web Services

WebLogic Workshop provides a complete framework for easily building web services applications that automatically leverage the power, reliability and scalability of WebLogic Server. Moreover, Workshop isolates developers from the low-level details of communicating via XML messages, creating web services descriptions (WSDL files), and accessing enterprise level back end resources.

WebLogic Workshop also provides additional web service functionality in order to meet the requirements of using web services in the enterprise. In particular, WebLogic Workshop helps you build web services that are:

## Asynchronous

Many business processes take more than a few moments to complete; traditional architectures make it hard to handle long-running tasks efficiently. WebLogic Workshop helps you architect asynchronous web services easily by introducing the notion of conversations and callbacks. Conversations help manage the typical problems in asynchronous messaging, namely correlating messages and managing some information or state between message exchanges. WebLogic Workshop also allows a web service to notify a client when the results of the operation are ready using a callback. A callback is a web service message sent from your web service to the client. These two features help you implement long-running business processes efficiently and easily.

In addition, WebLogic Workshop supports the use of JMS queues as message buffers to ensure that web service messages are not lost regardless of server load. JMS can also be used by WebLogic Workshop web services to communicate with back end resources.

## Loosely-Coupled

Web services by their very nature are somewhat loosely coupled — information is exchanged using XML which isolates clients of a web service from the interior implementation of the web service. This lets a web service describe an interface or "public contract" which determines how users can interact with the web service. As long as the messages and interfaces described by this contract are maintained, the internal implementation of the web service (or the client) is free to change at will. Maintaining this contract requires a simple technology for changing how Java is mapped into XML (and vice versa) so that the public contract of your web service can be maintained with minimal work when the internal implementation changes.

## Reliable, Available, and Scalable

While the web services you create in WebLogic Workshop are simple to create, ultimately they are compiled to standard J2EE applications. This means your web services will have all the reliability, scalability, and availability you've come to expect from J2EE applications running on WebLogic—absolute requirements for web services deployed in the enterprise.

## Multiple Protocols

WebLogic Workshop helps you create web services that run not just over HTTP but also over JMS queues. This allows you to use web services to communicate easily with internal systems and intranet resources.

Related Topics

Building Web Services with WebLogic Workshop