Skip navigation.

Programming WebLogic Web Services

  Previous Next vertical dots separating previous/next from contents/index/pdf Contents View as PDF   Get Adobe Reader

Introduction to WebLogic Web Services

The following sections provide an overview of Web Services, and briefly describe how they are implemented in WebLogic Server:


Overview of Web Services

Web Services are a special type of service that can be shared by and used as components of distributed Web-based applications. They commonly interface with existing back-end applications, such as customer relationship management systems, order-processing systems, and so on.

Traditionally, software application architecture tended to fall into two categories: huge monolithic systems running on mainframes or client-server applications running on desktops. Although these architectures work well for the purpose the applications were built to address, they are closed and can not be easily accessed by the diverse users of the Web.

Thus 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 transported 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 require them to be written using that particular technology, often from a particular vendor. This requirement typically hinders widespread acceptance of an application on the Web. 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 thus communicate with each other.

These different systems can be Microsoft SOAP ToolKit clients, J2EE 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.


Web Service Standards

A Web Service requires the following standard implementations:

BEA Implementation of Web Service Specifications

Many of the specifications that define Web Service standards have been written in an intentionally vague way to allow for broad use of the specification throughout the industry. Because of this vagueness, BEA's implementation of a particular specification might not cover all possible usage scenarios covered by the specification.

BEA considers interoperability of Web Services platforms to be more important than providing support for all possible edge cases of the Web Services specifications. For this reason, BEA fully supports the Basic Profile 1.0 specification from the Web Services Interoperability Organization and considers it to be the baseline for Web Services interoperability. BEA implements all requirements of the Basic Profile 1.0, although this guide does not necessarily document all of these requirements. This guide does, however, document features that are beyond the requirements of the Basic Profile 1.0."


SOAP (Simple Object Access Protocol) is a lightweight XML-based protocol used to exchange information in a decentralized, distributed environment. WebLogic Server includes its own implementation of SOAP 1.1, SOAP 1.2, and SOAP With Attachments (SAAJ) specifications. The protocol consists of:

This information is embedded in a Multipurpose Internet Mail Extensions (MIME)-encoded package that can be transmitted over HTTP or other Web protocols. MIME is a specification for formatting non-ASCII messages so that they can be sent over the Internet.

The following example shows a SOAP request for stock trading information embedded inside an HTTP request:

POST /StockQuote HTTP/1.1
Content-Type: text/xml; charset="utf-8"
Content-Length: nnnn
SOAPAction: "Some-URI"
<m:GetLastStockQuote xmlns:m="Some-URI">

For more information, see SOAP 1.1 and SOAP With Attachments API for Java (SAAJ) 1.1 .

WSDL 1.1

Web Services Description Language (WSDL) is an XML-based specification that describes a Web Service. A WSDL document describes Web Service operations, input and output parameters, and how a client application connects to the Web Service.

Developers of WebLogic Web Services do not need to create the WSDL files; you generate these files automatically as part of the WebLogic Web Services development process.

The following example, for informational purposes only, shows a WSDL file that describes the stock trading Web Service StockQuoteService that contains the method GetLastStockQuote:

<?xml version="1.0"?>
<definitions name="StockQuote"
<message name="GetStockPriceInput">
<part name="symbol" element="xsd:string"/>
<message name="GetStockPriceOutput">
<part name="result" type="xsd:float"/>
<portType name="StockQuotePortType">
<operation name="GetLastStockQuote">
<input message="tns:GetStockPriceInput"/>
<output message="tns:GetStockPriceOutput"/>
<binding name="StockQuoteSoapBinding" type="tns:StockQuotePortType">
<soap:binding style="rpc"
<operation name="GetLastStockQuote">
<soap:operation soapAction=""/>
<soap:body use="encoded" namespace=""
<soap:body use="encoded" namespace=""
<service name="StockQuoteService">
<documentation>My first service</documentation>
<port name="StockQuotePort" binding="tns:StockQuoteSoapBinding">
<soap:address location=""/>

For more information, see Web Services Description Language (WSDL) 1.1.


The Java API for XML-based RPC (JAX-RPC) 1.0is a Sun Microsystems specification that defines the Web Services APIs.

WebLogic Server implements all required features of the JAX-RPC Version 1.0 specification. Additionally, WebLogic Server implements optional data type support, as specified in:

WebLogic Server does not implement optional features of the JAX-RPC specification, other than what is described in these sections.

The following table briefly describes the core JAX-RPC interfaces and classes.

Table 1-1 JAX-RPC Interfaces and Classes

javax.xml.rpc Interface or Class



Main client interface. Used for both static and dynamic invocations.


Factory class for creating Service instances.


Represents the client proxy for invoking the operations of a Web Service. Typically used for static invocation of a Web Service.


Used to invoke a Web Service dynamically.


Exception thrown if an error occurs while invoking a Web Service.

For detailed information on JAX-RPC, see

For a tutorial that describes how to use JAX-RPC to invoke Web Services, see

Web Services Security (WS-Security)

The following description of Web Services Security is taken directly from the OASIS standard 1.0 specification, titled Web Services Security: SOAP Message Security, dated April 6, 2004:

This specification proposes a standard set of SOAP extensions that can be used when building secure Web services to implement integrity and confidentiality. We refer to this set of extensions as the Web Services Security Language or WS-Security.

WS-Security is flexible and is designed to be used as the basis for the construction of a wide variety of security models including PKI, Kerberos, and SSL. Specifically WS-Security provides support for multiple security tokens, multiple trust domains, multiple signature formats, and multiple encryption technologies.

This specification provides three main mechanisms: security token propagation, message integrity, and message confidentiality. These mechanisms by themselves do not provide a complete security solution. Instead, WS-Security is a building block that can be used in conjunction with other Web service extensions and higher-level application-specific protocols to accommodate a wide variety of security models and encryption technologies.

These mechanisms can be used independently (for example, to pass a security token) or in a tightly integrated manner (for example, signing and encrypting a message and providing a security token hierarchy associated with the keys used for signing and encryption).

For more information, see the OASIS Web Service Security Web page.

UDDI 2.0

The Universal Description, Discovery and Integration (UDDI) specification defines a standard for describing a Web Service; registering a Web Service in a well-known registry; and discovering other registered Web Services.

For more information, see

Additional Specifications Supported by WebLogic Web Services


WebLogic Web Service Features

The WebLogic Web Services subsystem has the following features (new features in Version 8.1 of WebLogic Server are listed first):


Unsupported Features

The following list describes the features that are not supported in this release of WebLogic Web Services:


Examples of Creating and Invoking a Web Service

WebLogic Server includes the following examples of creating and invoking WebLogic Web Services in the WL_HOME/samples/server/examples/src/examples/webservices directory, where WL_HOME refers to the main WebLogic Platform directory:

For detailed instructions on how to build and run the examples, open the following Web page in your browser:



Creating WebLogic Web Services: Main Steps

The following procedure describes the high-level steps to create a WebLogic Web Service. Most steps are described in detail in later chapters. Creating a WebLogic Web Service: A Simple Example, briefly describes an example of creating a Web Service.

  1. Design the WebLogic Web Service.
  2. Decide on an RPC- or document-oriented Web Service; a synchronous or asynchronous Web Service; the type of back-end components that implement the service; whether your service uses only built-in data types or custom data types; whether you need to intercept the incoming or outgoing SOAP message; and so on.

    See Designing WebLogic Web Services.

  3. Implement the basic WebLogic Web Service.
  4. Write and compile the Java code of the back-end components that make up the Web Service; optionally create SOAP message handlers that intercept the SOAP messages; optionally create your own serialization class to convert data between XML and Java; and so on.

    See Implementing WebLogic Web Services.

  5. Assemble and package the WebLogic Web Service.
  6. Gather all the implementation class files into an appropriate directory structure; create the Web Service deployment descriptor file; create the supporting parts of the service (such as client JAR file); and package everything into a deployable unit (either an EAR file or in exploded directory format).

    If your Web Service is fairly simple, use the servicegen Ant task, which performs all the assembly steps for you. If your Web Service is more complicated, use individual Ant tasks.

    See Assembling WebLogic Web Services Using Ant Tasks.

  7. Deploy the basic WebLogic Web Service for testing purposes.
  8. Make the service available to remote clients. Because WebLogic Web Services are packaged as standard J2EE Enterprise Applications, deploying a Web Service is the same as deploying an Enterprise Application.

    See Deploying WebLogic Server Applications.

  9. Create a client that accesses the Web Service to test that your Web Service is working as you expect. You can also use the Web Service Home Page to test your Web Service.
  10. See Invoking Web Services from Client Applications and WebLogic Server.

  11. Configure additional WebLogic Web Service features, such as security, reliable SOAP messaging, JMS transport, internationalization, and so on. See:
  12. Test the WebLogic Web Service after you add features.
  13. See Deploying and Testing WebLogic Web Services.

  14. Deploy the WebLogic Web Service for production.
  15. See Deploying WebLogic Server Applications.

  16. Optionally publish your Web Service in a UDDI registry. See Publishing and Finding Web Services Using UDDI.


Roadmap to Common Tasks for Creating Web Services

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


Table 1-2 Web Services Tasks

Major Task

Subtasks and Additional Information

Create (implement) the Web Service back-end components.

Overview of Implementing a WebLogic Web Service

Writing the Java Code for the Components

Generating a Partial Implementation From a WSDL File

Creating SOAP Message Handlers to Intercept the SOAP Message

Using SOAP Attachments

Using Built-In and Non-Built-In Data Types

Implementing Non-Built-In Data Types

Supported Built-In Data Types

Non-Built-In Data Types Supported by servicegen and autotype Ant Tasks

Throwing SOAP Fault Exceptions

Using the WebLogic Web Services APIs

Assemble the Web Service into a deployable unit.

Overview of Assembling WebLogic Web Services Using Ant Tasks

Assembling WebLogic Web Services Using the servicegen Ant Task

Assembling WebLogic Web Services Using Individual Ant Tasks

Assembling a Web Service Starting with Java

Assembling a Web Service Starting with an XML Schema

Deploy and test the Web Service.

Deploying and Testing WebLogic Web Services

WebLogic Web Services Home Page and WSDL URLs

Invoke the Web Service.

Overview of Invoking Web Services

Creating Java Client Applications to Invoke Web Services: Main Steps

Writing an Asynchronous Client Application

Invoking Web Services from WebLogic Server

Secure the Web Service.

Overview of Web Services Security

Configuring Message-Level Security: Main Steps

Configuring Transport-Level Security (SSL): Main Steps

Configuring Access Control Security: Main Steps

Add advanced features.

Using Reliable SOAP Messaging


Upgrade a 6.1 or 7.0 WebLogic Web Service.

Upgrading a 7.0 WebLogic Web Service to 8.1

Upgrading a 6.1 WebLogic Web Service to 8.1

Troubleshoot problems.

Using the Web Service Home Page to Test Your Web Service

Viewing SOAP Messages

Posting the HTTP SOAP Message

Debugging Problems with WSDL

Verifying a WSDL File

Verifying an XML Schema

Debugging Data Type Generation (Autotyping) Problems


Editing XML Files

When creating or invoking WebLogic Web Services, you might need to edit XML files, such as the web-services.xml Web Services deployment descriptor file, the EJB deployment descriptors, the Java Ant build files, and so on. You edit these files with the BEA XML Editor.

Note: This guide describes how to create or update the web-services.xml deployment descriptor manually so that programmers get a better understanding of the file and how the elements describe a Web Service. You can also use the BEA XML Editor to update the file.

The BEA XML Editor is a simple, user-friendly Java-based tool for creating and editing XML files. It displays XML file contents both as a hierarchical XML tree structure and as raw XML code. This dual presentation of the document gives you two options for editing the XML document:

The BEA XML Editor can validate XML code according to a specified DTD or XML schema.

For detailed information about using the BEA XML Editor, see its online help.

You can download the BEA XML Editor from dev2dev Online.


Skip navigation bar  Back to Top Previous Next