Sun Logo


Building Web Services

Suntrademark ONE Studio 5 Programming Series

817-2324-10



Contents

Before You Begin

1. Web Services: A Conceptual Overview

What Are Web Services?

Industry Problems

Applications Within an Enterprise

Applications Shared Across Enterprises

A Standardized Solution

Web Services Standards

SOAP

WSDL

UDDI

Web Services Interoperability Organization

Publishing and Using a Web Service

Sun ONE Studio 5, Standard Edition Web Services

Web Services Architectures

Multitier Architecture

Web-centric Architecture

Deployment Architecture

Software Versions

XML Operations (Deprecated)

2. Building a Web Service

Web Service Development Tasks

Creating a JAX-RPC Web Service From Java Methods

Developing XML Operations (Deprecated)

Adding Operations to a Web Service

Deleting Operations From a Web Service

Resolving References to Runtime Objects

Adding Environment Entries

Creating a JAX-RPC Web Service From WSDL Source

Generating Runtime Classes

Assembling and Deploying a Web Service

A Web-centric Application

Assembling the J2EE Application

Deploying the J2EE Application

Testing a Web Service

Setting a Default Test Client for a Web Service

Testing a Web Service

Creating a Stateful Web Service

Setting Up the Business Component

Setting Up the Web Service and Test Client

Testing a Stateful Web Service

Working With UDDI Registries

Generating WSDL

Managing UDDI Registry Options

Setting Default Publish Categories and Identifiers

Editing Registries Information in the IDE

Gaining Access to an External UDDI Registry

Publishing Your Web Service to a UDDI Registry

Publication Tasks and Terminology

Publication Procedure

Using the Internal UDDI Registry

Starting and Stopping the Internal UDDI Registry Server

Using the Sample Registry Browser

Using Arrays and Collections

Arrays

Collections

Attachments

SOAP Message Handlers

Security

Deployment Descriptors

3. Creating a Web Service Client

Creating a Client From a Local Web Service

Creating the Client

Setting the Client Type: JAXRPC or kSoap

Generating a JAX-RPC Client

The Generated Files

The JSP Custom Tags

The Client HTML and JSP Pages

The Client Proxy Classes

Using Your Own Front-End Client Components

Validation During Client Generation

Refreshing a Client From Its Web Service

The Service Endpoint URL

Deploying a JAX-RPC Client

Executing a JAX-RPC Client

Firewalls

Distributed Applications

Generating a kSOAP Client

Executing a kSOAP Client

Creating a Client From a WSDL File

Creating a Client From a UDDI Registry

Creating a Client--Planning and Work Flow

Creating a Client--Procedure

Attachments

Attachments Example

The DataHandler Property

Stateful Web Services and Clients

SOAP Message Handlers

Security

4. Using Message Handlers

SOAP Message Handlers

SOAP Message Headers and Header Blocks

Request Handlers and Response Handlers

Handler chains

SOAP Actor Roles

Handler Properties.

Getting Header Blocks at Handler Initialization

Adding a Header Block to a SOAP Message

Using Handlers In the IDE

Adding Handlers To a Web Service or Client

Adding a Handler Property

Adding a SOAP Header Block To a Handler

Setting a SOAP Actor Role For a Handler Chain

Enforcing the Processing of Header Blocks

Sample Handler Code

5. Developing XML Operations (Deprecated)

Overview of XML Operations

What Is an XML Operation?

Request-Response Mechanism

Overview of Tools

The Data Source Pane

Input Document Elements Node

Methods Node

Executing Methods and Returning Data

Providing Parameter Values

Retrieving More or Less Data

Trimming the Data Returned to the Client

Development Work Flow

Creating XML Operations

Creating an XML Operation

Generating XML Operations From an Enterprise Bean

Editing an XML Operation

Adding a Method to an XML Operation

Adding an Input Document Element

Renaming an Input Document Element

Renaming an Output Document Element

Giving an Input Document Element a Default Value

Making an Input Document Element Permanent

Reordering a Method or Input Document Element

Deleting a Method or Input Document Element

Mapping a Method Parameter to a Source

Casting a Method Return Value

Displaying and Selecting Inherited Methods

Excluding an Element From the XML Output

Including an Element in the XML Output

Expanding a Class

Collapsing a Class

System Shared Objects

Static Utility Methods

Organizing Static Utility Methods

Using Static Utility Methods

Instantiating Objects and Resolving References

Specifying the Target of an Object Reference

Defining a New Target Object

Editing a Target Object Definition

A. Securing a Web Service

Security Overview

HTTP Basic Authentication

HTTPS/SSL Authentication and Encryption

Public Key Encryption

Public Key Certificates

SSL Handshaking

Using HTTP Basic Authentication

Mapping Roles to Users and Groups

Mapping Roles at the Level of the Web Service

Mapping Roles at the Level of the J2EE Application

Use Case for Multiple Roles

Mapping Roles: Order of Priority

Mapping Roles In the Application Server

Redirecting Role Names

Testing Security: HTTP Basic Authentication

Basic Authentication and WSDL

Basic Authentication and UDDI Publication

Using HTTPS/SSL Authentication and Encryption

Setting Properties for the Web Service and Test Client

Setting Up the Test Client Trust Store

Creating the Trust Store

Setting the IDE's Global Trust Store Option

Importing the Server's Certificate Into the Test Client Trust Store

Setting up the Server

Testing Security: HTTPS/SSL Authentication and Encryption

B. Deployment Descriptors

Fields Propagated to Deployment Descriptors

Fields Propagated to the EJB Module Deployment Descriptor

Viewing a Deployment Descriptor

Editing a Deployment Descriptor

Index