Introducing WebLogic Web Services

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Overview of WebLogic Web Services

The following sections provide an overview of WebLogic Web Services as implemented by WebLogic Server:

 


What Are Web Services?

A Web Service is a set of functions packaged into a single application that is available to other systems on a network. The network can be a corporate intranet or the Internet. Because Web Services rely on basic, standard technologies which most systems provide, they are an excellent means for connecting distributed systems together. They can be shared by and used as a component of distributed Web-based applications. Other systems, such as customer relationship management systems, order-processing systems, and other existing back-end applications, can call a Web Service function to request data or perform an operation.

Traditionally, software application architecture tended to fall into two categories: monolithic systems such as those that ran on mainframes or client-server applications running on desktops. Although these architectures worked well for the purpose the applications were built to address, they were closed and their functionality could not be incorporated easily into new applications.

As a result, the software industry has evolved toward loosely coupled service-oriented applications that interact dynamically over the Web. The applications break down the larger software system into smaller modular components, or shared services. These services can reside on different computers and can be implemented by vastly different technologies, but they are packaged and accessible using standard Web protocols, such as XML and HTTP, thus making them easily accessible by any user on the Web.

This concept of services is not new—RMI, COM, and CORBA are all service-oriented technologies. However, applications based on these technologies required them to use that particular technology, often from a particular vendor. This requirement typically hinders widespread integration of the application’s functionality into other services on the network. To solve this problem, Web Services are defined to share the following properties that make them easily accessible from heterogeneous environments:

 


Why Use Web Services?

Major benefits of Web Services include:

Because you access Web Services using standard Web protocols such as XML and HTTP, the diverse and heterogeneous applications on the Web (which typically already understand XML and HTTP) can automatically access Web Services and communicate with each other.

These different systems can be Microsoft SOAP ToolKit clients, Java Platform, Enterprise Edition (Java EE) Version 5 applications, legacy applications, and so on. They are written in Java, C++, Perl, and other programming languages. Application interoperability is the goal of Web Services and depends upon the service provider's adherence to published industry standards.

 


Anatomy of a WebLogic Web Service

WebLogic Web Services are implemented according to the Web Services for Java EE 1.2 specification, which defines the standard Java EE runtime architecture for implementing Web Services in Java. The specification also describes a standard Java EE Web Service packaging format, deployment model, and runtime services, all of which are implemented by WebLogic Web Services.

The following sections describe:

The Programming Model—Metadata Annotations

The Web Services for Java EE 1.2 specification describes that a Java EE Web Service is implemented by one of the following components:

The code in the Java class or EJB implements the business logic of your Web Service. Oracle recommends that, instead of coding the raw Java class or EJB directly, you use the JWS annotations programming model, which makes programming a WebLogic Web Service much easier.

This programing model takes advantage of the new JDK 5.0 metadata annotations feature in which you create an annotated Java file and then use Ant tasks to compile the file into a Java class and generate all the associated artifacts. The Java Web Service (JWS) annotated file is the core of your Web Service. It contains the Java code that determines how your Web Service behaves. A JWS file is an ordinary Java class file that uses annotations to specify the shape and characteristics of the Web Service. The JWS annotations you can use in a JWS file include the standard ones defined by the Web Services Metadata for the Java Platform specification as well as a set of other standard or WebLogic-specific annotations, depending on the type of Web Service you are creating.

This release of WebLogic Server supports both Java API for XML-Based Web Services 2.1 (JAX-WS) and Java API for XML-Based RPC 1.1 (JAX-RPC) Web Services. JAX-RPC, an older specification, defined APIs and conventions for supporting XML Web Services in the Java Platform as well support for the WS-I Basic Profile 1.0 to improve interoperability between JAX-RPC implementations. JAX-WS is a follow up to JAX-RPC 1.1. For more information, see How Do I Choose Between JAX-WS and JAX-RPC?.

Once you have coded the basic WebLogic Web Service, you can program and configure additional advanced features. For example, you can specify that the SOAP messages be digitally signed and encrypted (as specified by the WS-Security specification). You configure these more advanced features of WebLogic Web Services using WS-Policy files, which is an XML file that adheres to the WS-Policy specification and contains security- or Web Service reliable messaging-specific XML elements that describe the security and reliable-messaging configuration, respectively. For information about the WS-Policy specification, see Web Services Policy Framework (WS-Policy) 1.2.

The Compilation Model—jwsc Ant Task

After you create the JWS file, you use the jwsc WebLogic Web Service Ant task to compile the JWS file, as described by the Web Services for Java EE 1.2 specification, described in Web Services for Java EE 1.2. The jwsc Ant task always compiles the JWS file into a plain Java class; the only time it implements a stateless session EJB is if you implement a stateless session EJB in your JWS file. The jwsc Ant task also generates all the supporting artifacts for the Web Service, packages everything into an archive file, and creates an Enterprise Application that you can then deploy to WebLogic Server.

By default, the jwsc Ant task packages the Web service in a standard Web application WAR file with all the standard WAR artifacts. The WAR file, however, contains additional artifacts to indicate that it is also a Web Service; these additional artifacts include deployment descriptor files, the WSDL file that describes the public contract of the Web Service, and so on. If you execute jwsc against more than one JWS file, you can choose whether jwsc packages the Web Services in a single WAR file or each Web Service in a separate WAR file. In either case, jwsc generates a single Enterprise Application.

If you implement a stateless session EJB in your JWS file, then the jwsc Ant task packages the Web Service in a standard EJB JAR file with all the usual artifacts, such as the ejb-jar.xml and weblogic-ejb.jar.xml deployment descriptor files. The EJB JAR file also contains additional Web Service-specific artifacts, as described in the preceding paragraph, to indicate that it is a Web Service. Similarly, you can choose whether multiple JWS files are packaged in a single or multiple EJB JAR files.

 


How Do I Choose Between JAX-WS and JAX-RPC?

As noted previously, this release of WebLogic Server supports the following Web Services:

Because JAX-WS is the successor to the JAX-RPC and it implements many of the new features in Java EE 5, Oracle recommends that you develop Web Services with JAX-WS. JAX-RPC is considered legacy and the specification is no longer evolving.

The following table summarizes the benefits of choosing JAX-WS over JAX-RPC. There may be reasons to continue developing JAX-RPC Web Services, which you can weigh against the benefits listed below. For additional documentation and examples about programming the features described in the following sections in a JAX-WS Web Service, see the JAX-WS documentation available at https://jax-ws.dev.java.net.

Note: JAX-WS Web Services do not support context propagation, as described in “Programming Context Propagation” in Developing Applications With WebLogic Server.

Table 1-1 Benefits of JAX-WS 
Benefit
Description
SOAP 1.2 Support
JAX-WS supports SOAP 1.2 and 1.1. JAX-RPC supports SOAP 1.1 only.
Data Binding Using JAXB 2.1
JAX-WS 2.1 fully supports the Java Architecture for XML Binding (JAXB) 2.1 specification and provides full XML Schema support. JAXB provides a convenient way to bind an XML schema to a representation in Java code. This makes it easy for you to incorporate XML data and processing functions in applications based on Java technology without having to know much about XML itself. For more information, see “Using JAXB Data Binding”in Getting Started With WebLogic Web Services Using JAX-WS.
By contrast, the built-in and user-defined data types you can use in a JAX-RPC-style Web Service, although extensive, is limited to those described in “Using JAXB Data Binding” in Getting Started With WebLogic Web Services Using JAX-RPC.
Document Attachments Using MTOM
JAX-WS 2.1 supports MTOM (Message Transmission and Optimization Mechanism). MTOM, together with XOP (XML Binary Optimized Packaging) defines how an XML binary data such as xs:base64Binary or xs:hexBinary can be optimally transmitted over the wire.

Note: In this release of WebLogic Server, MTOM is also supported for JAX-RPC 1.1 style Web Services.

Web Service Annotations
The JAX-WS 2.1 programming model is very similar to JAX-RPC 1.1 Web Services in that it uses metadata annotations described in the Web Services Metadata for the Java Platform (JSR 181) specification and then Ant tasks to compile the annotated Java file into a deployable enterprise application (EAR) file. However, the JAX-WS 2.1 programming model is more robust because it defines additional annotations, listed in the JAX-WS 2.1 specification, that you can use to customize the mapping from Java to XML schema/WSDL and to map Web Service operation parameter names to meaningful part/element names in the WSDL file.
For a comparison of the Web Service annotation support for JAX-WS and JAX-RPC, see “Web Service Annotation Support” in WebLogic Web Services Reference.
XML-based Customizations
The JAX-WS 2.1 specification defines standard and portable XML-based customizations. These customizations, or binding declarations, can customize almost all WSDL components that can be mapped to Java, such as the service endpoint interface class, method name, parameter name, exception class, etc. Using binding declarations you can also control certain features, such as asynchrony, provider, wrapper style, and additional headers.
Logical and Protocol Handlers
JAX-WS 2.1 defines two types of handlers: logical and protocol handlers. While protocol handlers have access to an entire message such as a SOAP message, logical handlers deal only with the payload of a message and are independent of the protocol being used. Handler chains can now be configured on a per-port, per-protocol, or per-service basis. A new framework of context objects has been added to allow client code to share information easily with handlers.
EJB 3.0 Support
JAX-WS supports EJB 3.0. JAX-RPC supports EJB 2.1 only.

 


Roadmap for Implementing WebLogic Web Services

The following table provides a roadmap of common tasks for creating, deploying, and invoking WebLogic Web Services.

Table 1-2 Roadmap for Implementing WebLogic Web Services 
Major Task
Subtasks and Additional Information
Review Supported Standards
Run Samples
Develop Web Services using JAX-WS
Develop Web Services using JAX-RPC
Secure the Web Service
Upgrade
JAX-WS: No steps are required to upgrade JAX-WS to 10.3.

 


New and Changed Features in this Release

For a comprehensive listing of the new WebLogic Server Web Service features introduced in this release, see “Web Services” in “What’s New in WebLogic Server” in Release Notes.


  Back to Top       Previous  Next