1 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:

  • Web Services are accessed using widely supported Web protocols such as HTTP.

  • Web Services describe themselves using an XML-based description language.

  • Web Services communicate with clients (both end-user applications or other Web Services) through simple XML messages that can be produced or parsed by virtually any programming environment or even by a person, if necessary.

Why Use Web Services?

Major benefits of Web Services include:

  • Interoperability among distributed applications that span diverse hardware and software platforms

  • Easy, widespread access to applications through firewalls using Web protocols

  • A cross-platform, cross-language data model (XML) that facilitates developing heterogeneous distributed applications

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 (http://www.jcp.org/en/jsr/detail?id=109), 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 (http://www.jcp.org/en/jsr/detail?id=109) describes that a Java EE Web Service is implemented by one of the following components:

  • A Java class running in the Web container.

  • A stateless session EJB running in the EJB container.

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 (described at http://java.sun.com/developer/technicalArticles/releases/j2se15/) 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 (http://www.jcp.org/en/jsr/detail?id=181) 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) Web Services, described at http://jcp.org/aboutJava/communityprocess/mrel/jsr224/index2.html, and Java API for XML-Based RPC 1.1 (JAX-RPC) Web Services, described at https://jax-rpc.dev.java.net/. 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 at http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=wss). 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.5 and 1.2.

The Development Model—Bottom-up and Top-down

There are two approaches to Web Service development: bottom-up and top-down. Each approach is described in the following sections.

Bottom-up Approach: Starting from Java

In the bottom-up approach, you develop your the JWS file from scratch. 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.

For more information about the bottom-up approach, see the following sections:

Top-down Approach: Starting from WSDL

In the top-down approach, you create the Web Service from a WSDL file. You can use the wsdlc Ant task to generate a partial implementation of the Web Service described by the WSDL file. The wsdlc Ant task generates he JWS service endpoint interface (SEI), the stubbed-out JWS class file, JavaBeans that represent the XML Schema data types, and so on, into output directories.

After running the wsdlc Ant task, (which typically you only do once) you update the generated JWS implementation file, for example, to add Java code to the methods so that they function as defined by your business requirements. The generated JWS implementation file does not initially contain any business logic because the wsdlc Ant task does not know how you want your Web Service to function, although it does know the shape of the Web Service, based on the WSDL file.

The wsdlc Ant task packages the JWS SEI and data binding artifacts together into a JAR file that you later specify to the jwsc Ant task. You never need to update this JAR file; the only file you update is the JWS implementation class.

For more information about the top-down approach, see the following sections:

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.

Table 1-1 Benefits of JAX-WS

Benefit Description

Data Binding Using JAXB 2.1

JAX-WS 2.1 fully supports the Java Architecture for XML Binding (JAXB) 2.1 specification (http://jcp.org/en/jsr/detail?id=222) 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 Oracle Fusion Middleware Getting Started With JAX-WS Web Services for Oracle WebLogic Server.

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 "Understanding Data Binding" in Oracle Fusion Middleware Getting Started With JAX-RPC Web Services for Oracle WebLogic Server.

Document Attachments Using Streaming MTOM

Using MTOM and the javax.activation.DataHandler and com.sun.xml.ws.developer.StreamingDataHandler APIs you can specify that a Web Service use a streaming API when reading inbound SOAP messages that include attachments, rather than the default behavior in which the service reads the entire message into memory. This feature increases the performance of Web Services whose SOAP messages are particular large. For more information, see "Streaming SOAP Attachments" in Oracle Fusion Middleware Programming Advanced Features of JAX-WS Web Services for Oracle WebLogic Server.

Operate on messages at the XML level

The JAX-WS javax.xml.ws.Provider and javax.xml.ws.Dispatch APIs enable the Web Service to operate at the XML message level, accessing the XML payloads directly

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 (http://jcp.org/en/jsr/detail?id=181) 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.


The JAX-WS implementation in Oracle WebLogic Server is extended from the JAX-WS Reference Implementation (RI) developed by the Glassfish Community (see https://jax-ws.dev.java.net/). All features defined in the JAX-WS specification (JSR-224) are fully supported by Oracle WebLogic Server.

The JAX-WS RI also contains a variety of extensions, provided by Glassfish contributors. Unless specifically documented, JAX-WS RI extensions are not supported for use in Oracle WebLogic Server.

Table 1-2 Roadmap for Implementing WebLogic Web Services

Major Task Subtasks and Additional Information

Review Supported Standards

Chapter 4, "Standards Supported by WebLogic Web Services"

Run Samples

Develop Web Services using JAX-WS

Develop Web Services using JAX-RPC

Secure the Web Service


Using Oracle IDEs to Build Web Services

The following Oracle IDE tools are available to build Web services:

  • Oracle JDeveloper—Oracle's full-featured Java IDE, can be used for end-to-end development of Web services. Developers can build Java classes or EJBs, expose them as Web Services, automatically deploy them to an instance of Oracle WebLogic Server, and immediately test the running Web Service. Alternatively, JDeveloper can be used to drive the creation of Web Services from WSDL descriptions. JDeveloper also is Ant-aware. You can use this tool to build and run Ant scripts for assembling the client and for assembling and deploying the service. For more information, see the Oracle JDeveloper online help. For information about installing JDeveloper, see Oracle Fusion Middleware Installation Guide for Oracle JDeveloper.

  • Oracle Enterprise Pack for Eclipse (OEPE)—Provides a collection of plug-ins to the Eclipse IDE platform that facilitate development of WebLogic Web services. For more information, see the Eclipse IDE platform online help.

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 Oracle WebLogic Server.