|
Comments
|
Today's Top SOA Links
Web Services Web Services Standards
Web Services Standards
By: Andre Tost; Denise Gabardo
Mar. 21, 2003 12:00 AM
If you follow the latest trends in the software industry, you will have noticed that Web services technology is getting a lot of attention. While it is not a completely new thing anymore, more companies are getting serious about Web services today and putting solutions into production that provide and/or consume Web services interfaces. One crucial aspect of this is standardization. The promise of Web services technology is to allow you to connect applications that were developed on different platforms and in different programming languages. This can only work if vendors can agree on common standards. And a lot of standardization has taken place in the XML space with the creation of specifications such as SOAP, WSDL, and UDDI. However, until recently there was no common approach to implementing Web services technology in Java. This has changed with the advent of two new standard API definitions that will go into the next J2EE specification. Both were handled in the Java Community Process as JSRs (Java Specification Requests), namely JSR-101 (JAX-RPC) and JSR-109 (Enterprise Web Services). In short, JSR-101 defines the mapping of WSDL to Java and vice versa. It also defines a client API to invoke a remote Web service and a runtime environment on the server to host a Web service. JSR-109 conceptually enhances JSR-101 by defining the packaging of Web services into standard J2EE modules, including a new deployment descriptor. It also defines Web services that are implemented as Enterprise JavaBeans. IBM provides an early implementation for both JSR-101 and JSR-109 in the Web Services Technology Preview for WebSphere Application Server 5, giving you a head start on using the new APIs. We will cover this technology preview in detail in a later article. In this article, we will describe the key concepts of the new standards. This will help you understand how you can integrate Web services technology into your J2EE-based application development efforts, and which new APIs and deployment descriptor formats are defined. We will assume that you are familiar with the basic Web services technologies such as SOAP and WSDL. (See the Resources section at the end for pointers to more material on those topics.)
JAX-RPC (JSR-101)
WSDL/Java Mapping -Basic Java types are mapped to basic XML Schema types. For example, a java.lang. String is mapped to an xsd:string type. -Nonbasic Java types (i.e., regular Java classes) must implement java.io.Serializable. They are mapped to XML structures described in the form of XML Schema complex types. The process of turning a Java object into an XML document, and vice versa, is handled by serializers and deserializers. -Support for XML attributes is optional; enumerations are mapped to a new Java class in a particular way; and arrays are handled as described in the SOAP 1.1 specification. It is beyond the scope of this article to describe all of this in detail. The second article in this series will describe tools offered by the WAS 5 Web Services Technology Preview that can generate the Java interface from an existing WSDL file, and generate WSDL from an existing Java interface - so you don't need to be an expert on all of these rules.
Client-Side Service Invocation
Server-Side Runtime Model The model for EJBs is defined in JSR-109, which we will explain a little further on. In case you are wondering now about the supported protocols for the actual communication between a service requester and a service provider, JAX-RPC is meant to be protocol-neutral but requires support for SOAP over HTTP. In other words, transport of SOAP messages over JMS is not (yet) defined. By the way, the JAX-RPC specification requires that an implementation support both RPC-style invocations with encoded SOAP messages, and document-style invocations with literal encoding. Other combinations are optional. The Web Services Interoperability Organization (www.WS-I.org) currently leans toward the use of literal encoding (some may describe this as no encoding at all), so you can expect literal encoding to become dominant (plus, it was recently decided that the WS-I Basic Profile will become part of the J2EE 1.4 specification).
JSR-109 (Enterprise Web Services)
Client Service Invocation The specification also defines a client Web services deployment descriptor, Webservicesclient.xml, for this purpose. It consists mainly of a service reference that contains the name and location of the WSDL file for the invoked service, its service endpoint interface, and the name under which the service can be found in JNDI. And like many of the other artifacts that the JSR-101 and JSR-109 specifications define, it is normally generated by tools, so you don't have to deal with creating it manually.
Server Service Deployment The application server must ensure during deployment that an incoming SOAP over HTTP request is routed to the appropriate EJB. If the service implementation is a JavaBean, it must also make sure that incoming requests are handled properly. To create the needed artifacts for this, a Web service deployment descriptor is defined that contains information about the service and how it should be deployed. But before we take a closer look at the deployment descriptor, let us focus for a moment on the packaging. Web services are packaged in their respective J2EE modules, i.e., an EJB goes into an EJB module, and a JavaBean goes into a Web module (or a dependent Java JAR file). Both are packaged into an enterprise archive (EAR) file for deployment into the application server. The Web services deployment descriptor, webservices.xml, goes into either the META-INF directory of the EJB module, or the WEB-INF directory of the Web module. This deployment descriptor contains a description of each service that is to be deployed. It contains a pointer to the WSDL document for the service, as well as a pointer to a particular <port> within this document. Finally, it defines the service endpoint interface and has a link to the element (EJB or JavaBean) that implements the actual service. This is done via a link to either the web.xml deployment descriptor (in case the service is implemented as a bean) or the ejb-jar.xml deployment descriptor (in case it is a stateless session EJB). When the application that includes the service is installed on the application server, the server generates all of the items necessary to make the service accessible for clients. One important aspect is that it updates the address of the service in the WSDL file (contained in the <port> element) to the actual endpoint where the service resides. The resulting updated WSDL document can then be published to a file location or even to a UDDI registry.
Outlook
Summary
Resources Reader Feedback: Page 1 of 1
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
|
SYS-CON Featured Whitepapers
Most Read This Week |
|||||||||||||||||||||||||||