WSITTutorial
WSITTutorial
Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document. In particular, and without
limitation, these intellectual property rights may include one or more U.S. patents or pending patent applications in the U.S. and in other countries.
U.S. Government Rights – Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions
of the FAR and its supplements.
This distribution may include materials developed by third parties.
Parts of the product may be derived from Berkeley BSD systems, licensed from the University of California. UNIX is a registered trademark in the U.S. and other
countries, exclusively licensed through X/Open Company, Ltd.
Sun, Sun Microsystems, the Sun logo, the Solaris logo, the Java Coffee Cup logo, docs.sun.com, J2EE, JavaServer Pages, Enterprise JavaBeans, Java Naming and
Directory Interface, EJB, JSP, J2SE, Java, and Solaris are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC
trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. Products bearing
SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc.
Unless otherwise licensed, software code in all technical materials herein (including articles, FAQs, samples) is provided under this License
(http://developers.sun.com/berkeley_license.html).
The OPEN LOOK and SunTM Graphical User Interface was developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the pioneering efforts
of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry. Sun holds a non-exclusive license from Xerox to
the Xerox Graphical User Interface, which license also covers Sun's licensees who implement OPEN LOOK GUIs and otherwise comply with Sun's written license
agreements.
Products covered by and information contained in this publication are controlled by U.S. Export Control laws and may be subject to the export or import laws in
other countries. Nuclear, missile, chemical or biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited. Export
or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially
designated nationals lists is strictly prohibited.
DOCUMENTATION IS PROVIDED “AS IS” AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO
THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.
Copyright 2007 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A. Tous droits réservés.
Sun Microsystems, Inc. détient les droits de propriété intellectuelle relatifs à la technologie incorporée dans le produit qui est décrit dans ce document. En particulier,
et ce sans limitation, ces droits de propriété intellectuelle peuvent inclure un ou plusieurs brevets américains ou des applications de brevet en attente aux Etats-Unis
et dans d'autres pays.
Cette distribution peut comprendre des composants développés par des tierces personnes.
Certaines composants de ce produit peuvent être dérivées du logiciel Berkeley BSD, licenciés par l'Université de Californie. UNIX est une marque déposée aux
Etats-Unis et dans d'autres pays; elle est licenciée exclusivement par X/Open Company, Ltd.
Sun, Sun Microsystems, le logo Sun, le logo Solaris, le logo Java Coffee Cup, docs.sun.com, J2EE, JavaServer Pages, Enterprise JavaBeans, Java Naming and Directory
Interface, EJB, JSP, J2SE, Java et Solaris sont des marques de fabrique ou des marques déposées de Sun Microsystems, Inc. aux Etats-Unis et dans d'autres pays. Toutes
les marques SPARC sont utilisées sous licence et sont des marques de fabrique ou des marques déposées de SPARC International, Inc. aux Etats-Unis et dans d'autres
pays. Les produits portant les marques SPARC sont basés sur une architecture développée par Sun Microsystems, Inc.
A moins qu'autrement autorisé, le code de logiciel en tous les matériaux techniques dans le présent (articles y compris, FAQs, échantillons) est fourni sous ce permis
(http://developers.sun.com/berkeley_license.html).
L'interface d'utilisation graphique OPEN LOOK et Sun a été développée par Sun Microsystems, Inc. pour ses utilisateurs et licenciés. Sun reconnaît les efforts de
pionniers de Xerox pour la recherche et le développement du concept des interfaces d'utilisation visuelle ou graphique pour l'industrie de l'informatique. Sun détient
une licence non exclusive de Xerox sur l'interface d'utilisation graphique Xerox, cette licence couvrant également les licenciés de Sun qui mettent en place l'interface
d'utilisation graphique OPEN LOOK et qui, en outre, se conforment aux licences écrites de Sun.
Les produits qui font l'objet de cette publication et les informations qu'il contient sont régis par la legislation américaine en matière de contrôle des exportations et
peuvent être soumis au droit d'autres pays dans le domaine des exportations et importations. Les utilisations finales, ou utilisateurs finaux, pour des armes nucléaires,
des missiles, des armes chimiques ou biologiques ou pour le nucléaire maritime, directement ou indirectement, sont strictement interdites. Les exportations ou
réexportations vers des pays sous embargo des Etats-Unis, ou vers des entités figurant sur les listes d'exclusion d'exportation américaines, y compris, mais de manière
non exclusive, la liste de personnes qui font objet d'un ordre de ne pas participer, d'une façon directe ou indirecte, aux exportations des produits ou des services qui
sont régis par la legislation américaine en matière de contrôle des exportations et la liste de ressortissants spécifiquement designés, sont rigoureusement interdites.
LA DOCUMENTATION EST FOURNIE "EN L'ETAT" ET TOUTES AUTRES CONDITIONS, DECLARATIONS ET GARANTIES EXPRESSES OU TACITES
SONT FORMELLEMENT EXCLUES, DANS LA MESURE AUTORISEE PAR LA LOI APPLICABLE, Y COMPRIS NOTAMMENT TOUTE GARANTIE
IMPLICITE RELATIVE A LA QUALITE MARCHANDE, A L'APTITUDE A UNE UTILISATION PARTICULIERE OU A L'ABSENCE DE CONTREFACON.
080311@19860
Contents
Preface .....................................................................................................................................................9
3
Contents
5
Contents
7
Contents
This tutorial explains how to develop web applications using the Web Services Interoperability
Technologies (WSIT). The tutorial describes how, when, and why to use the WSIT technologies
and also describes the features and options that each technology supports.
WSIT, developed by Sun Microsystems, implements several new web services technologies
including WS-Security, WS-Trust, WS-SecureConversation, WS-ReliableMessaging,
WS-AtomicTransactions, Data Binding, and Optimization. WSIT was also tested in a joint
effort by Sun Microsystems, Inc. and Microsoft with the expressed goal of ensuring
interoperability between web services applications developed using either WSIT and the
Windows Communication Foundation (WCF) product.
This preface contains information about and conventions for the entire Sun JavaTM System
Application Server documentation set.
9
Preface
Providing Feedback
Please send comments, broken link reports, errors, suggestions, and questions about this
tutorial to the tutorial team at [email protected] .
Documentation Center Application Server documentation topics organized by task and subject.
Release Notes Late-breaking information about the software and the documentation. Includes a
comprehensive, table-based summary of the supported hardware, operating system, Java
Development Kit (JDKTM), and database drivers.
Quick Start Guide How to get started with the Application Server product.
Deployment Planning Guide Evaluating your system needs and enterprise to ensure that you deploy the Application Server
in a manner that best suits your site. General issues and concerns that you must be aware of
when deploying the server are also discussed.
Application Deployment Guide Deployment of applications and application components to the Application Server. Includes
information about deployment descriptors.
Developer’s Guide Creating and implementing Java Platform, Enterprise Edition (Java EE platform) applications
intended to run on the Application Server that follow the open Java standards model for Java
EE components and APIs. Includes information about developer tools, security, debugging,
and creating lifecycle modules.
Java EE 5 Tutorial Using Java EE 5 platform technologies and APIs to develop Java EE applications.
Java WSIT Tutorial Developing web applications using the Web Service Interoperability Technologies (WSIT).
Describes how, when, and why to use the WSIT technologies and the features and options
that each technology supports.
Administration Guide System administration for the Application Server, including configuration, monitoring,
security, resource management, and web services management.
High Availability Administration Post-installation configuration and administration instructions for the high-availability
Guide database.
11
Preface
Upgrade and Migration Guide Upgrading from an older version of Application Server or migrating Java EE applications
from competitive application servers. This guide also describes differences between adjacent
product releases and configuration options that can result in incompatibility with the product
specifications.
Reference Manual Utility commands available with the Application Server; written in man page style. Includes
the asadmin command line interface.
Related Documentation
Application Server can be purchased by itself or as a component of Sun Java Enterprise System
(Java ES), a software infrastructure that supports enterprise applications distributed across a
network or Internet environment. If you purchased Application Server as a component of
Java ES, you should be familiar with the system documentation at
http://docs.sun.com/coll/1286.3. The URL for all documentation about Java ES and its
components is http://docs.sun.com/prod/entsys.5.
For documentation about other stand-alone Sun Java System server products, go to the
following:
■ Message Queue documentation (http://docs.sun.com/coll/1343.4)
■ Directory Server documentation (http://docs.sun.com/coll/1224.1)
■ Web Server documentation (http://docs.sun.com/coll/1308.3)
A JavadocTM tool reference for packages provided with the Application Server is located at
http://glassfish.dev.java.net/nonav/javaee5/api/index.html. Additionally, the
following resources might be useful:
■ The Java EE 5 Specifications (http://java.sun.com/javaee/5/javatech.html)
■ The Java EE Blueprints (http://java.sun.com/reference/blueprints/index.html)
For information about the Java DB database included with the Application Server, see
http://developers.sun.com/javadb/.
The GlassFish Samples project is a collection of sample applications that demonstrate a broad
range of Java EE technologies. The GlassFish Samples are bundled with the Java EE Software
Development Kit (SDK), and are also available from the GlassFish Samples project page at
https://glassfish-samples.dev.java.net/.
tut-install Represents the base installation directory for None. Install the tutorial in a directory without spaces in the path.
the WSIT Tutorial.
java-home Represents the base installation directory for None. Same value as the JAVA_HOME environment variable.
the Java Platform, Standard Edition (Java SE
platform).
as-install Represents the base installation directory for Java ES installations on the SolarisTM operating system:
the Application Server or the Software
/opt/SUNWappserver/appserver
Development Kit (SDK) of which the
Application Server is a part. Java ES installations on the Linux operating system:
/opt/sun/appserver/
Other Solaris and Linux non-SDK installations, non-root user:
user’s-home-directory/SUNWappserver
Other Solaris and Linux non-SDK installations, root user:
/opt/SUNWappserver
Solaris and Linux SDK installations:
user’s-home-directory/SDK
Windows, all non-SDK installations:
SystemDrive:\Sun\AppServer
Windows, all SDK installations:
SystemDrive:\Sun\SDK
13
Preface
Typographic Conventions
The following table describes the typographic changes that are used in this book.
AaBbCc123 The names of commands, files, and Edit your .login file.
directories, and onscreen computer
Use ls -a to list all files.
output
machine_name% you have mail.
AaBbCc123 A placeholder to be replaced with a real The command to remove a file is rm filename.
name or value
AaBbCc123 Book titles, new terms, and terms to be Read Chapter 6 in the User's Guide.
emphasized (note that some emphasized
A cache is a copy that is stored locally.
items appear bold online)
Do not save the file.
Symbol Conventions
The following table explains symbols that might be used in this book.
{|} Contains a set of choices for a -d {y|n} The -d option requires that you use
required command option. either the y argument or the n
argument.
- Joins simultaneous multiple Control-A Press the Control key while you press
keystrokes. the A key.
+ Joins consecutive multiple Ctrl+A+N Press the Control key, release it, and
keystrokes. then press the subsequent keys.
→ Indicates menu item File → New → Templates From the File menu, choose New.
selection in a graphical user From the New submenu, choose
interface. Templates.
search-term site:docs.sun.com
broker site:docs.sun.com
15
Preface
To include other Sun web sites in your search (for example, java.sun.com, www.sun.com, and
developers.sun.com), use sun.com in place of docs.sun.com in the search field.
Note – Sun is not responsible for the availability of third-party web sites mentioned in this
document. Sun does not endorse and is not responsible or liable for any content, advertising,
products, or other materials that are available on or through such sites or resources. Sun will not
be responsible or liable for any actual or alleged damage or loss caused or alleged to be caused by
or in connection with use of or reliance on any such content, goods, or services that are available
on or through such sites or resources.
This chapter describes the software needed to install, build, and run the examples.
Required Software
To use this tutorial you must download and install the following software:
■ The latest Java SE 5.0 (Update 14) or JDK 6.0 (Update 4) with which the WSIT software has
been extensively tested
■ One of the following web containers:
■ Application Server 9.1 Update 1
■ GlassFish V2 Update 1
You can run the examples in this tutorial that use a web container without the NetBeans IDE
on either Application Server (or GlassFish) or Tomcat. However, for this edition of the
tutorial, you can only run the examples that use a web container and the NetBeans IDE with
Application Server (or GlassFish).
■ Metro Version 1.1 binary, which includes the WSIT Version 1.1 software that you install
into your Application Server 9.1 Update 1 (or Glassfish V2 Update 1) installation.
■ NetBeans IDE 6.0
To run the examples described in this tutorial, you must also download the WSIT samples kits.
Download the sample kits from the following locations:
■ https://wsit.dev.java.net/
source/browse/*checkout*/wsit/wsit/docs/howto/wsit-enabled-fromjava.zip
17
Required Software
■ https://wsit.dev.java.net/
source/browse/*checkout*/wsit/wsit/docs/howto/wsit-enabled-fromwsdl.zip
■ https://wsit.dev.java.net/
source/browse/*checkout*/wsit/wsit/docs/howto/client-enabled-fromjava.zip
■ https://wsit-docs.dev.java.net/releases/1.1/wsittutorial.zip
Introduction to WSIT
This tutorial describes how to use the Web Services Interoperability Technologies (WSIT), a
product of Sun Microsystems web services interoperability effort to develop Java clients and
service providers that interoperate with Microsoft .NET 3.0 clients and service providers.
What is WSIT?
Sun is working closely with Microsoft to ensure interoperability of web services enterprise
technologies such as message optimization, reliable messaging, and security. The initial release
of WSIT is a product of this joint effort. WSIT is an implementation of a number of open web
services specifications to support enterprise features. In addition to message optimization,
reliable messaging, and security, WSIT includes a bootstrapping and configuration technology.
Figure 2–1 shows the underlying services that were implemented for each technology.
19
What is WSIT?
Core XML
XML
XML Namespace
Optimization Reliability
XML Infoset
SOAP WS-ReliableMessaging
XML Schema
MTOM WS-Coordination
WS-Addressing WS-AtomicTransactions
Security
Bootstrapping
WS-Security Policy
WSDL
WS-Security
WS-Policy
WS-Trust
WS-MetadataExchange
WS-SecureConversation
Starting with the core XML support currently built into the Java platform, WSIT uses or extends
existing features and adds new support for interoperable web services. See the following
sections for an overview of each feature:
■ “Bootstrapping and Configuration” on page 20
■ “Message Optimization Technology” on page 22
■ “Reliable Messaging Technology” on page 22
■ “Security Technology” on page 23
Client
Application
Get URL
Web Service
Get URL Registry
MetadataExchange Request
wsimport
WSDL (Includes Policy)
Utility
Access and Consume the Web Service
Web Service
Web Service
Client
1. Client acquires the URL for a web service that it wants to access and consume. How you
acquire the URL is outside the scope of this tutorial. For example, you might look up the
URL in a Web Services registry.
2. The client uses the URL and the wsimport tool to send a MetadataExchangeRequest to
access the web service and retrieve the WSDL file. The WSDL file contains a description of
the web service endpoint, including WS-Policy assertions that describe the security and/or
reliability capabilities and requirements of the service. The description describes the
requirements that must be satisfied to access and consume the web service.
3. The client uses the WSDL file to create the web service client.
4. The web service client accesses and consumes the web service.
Chapter 4, “Bootstrapping and Configuration,” explains how to bootstrap and configure a web
service client and a web service endpoint that use the WSIT technologies.
One way to deal with this problem is to encode the binary objects so as to optimize both the
SOAP application processing time and the bandwidth required to transmit the SOAP message
over the network. In short, XML needs to be optimized for web services. This is the exactly what
the Message Optimization technology does. It ensures that web services messages are
transmitted over the Internet in the most efficient manner.
Sun recommends that you use message optimization if your web service client or web service
endpoint will be required to process binary encoded XML documents larger than 1KB.
For instructions on how to use the Message Optimization technology, see Chapter 5, “Message
Optimization.”
The reliable messaging technology ensures that messages in a given message sequence are
delivered at least once and not more than once and optionally in the correct order. When
messages in a given sequence are lost in transit or delivered out of order, this technology enables
systems to recover from such failures. If a message is lost in transit, the sending system
retransmits the message until its receipt is acknowledged by the receiving system. If messages
are received out of order, the receiving system may re-order the messages into the correct order.
The Reliable Messaging technology can also be used to implement session management. A
unique message sequence is created for each client-side proxy, and the lifetime of the sequence
identifier coincides with the lifetime of the proxy. Therefore, each message sequence can be
viewed as a session and can be used to implement session management.
You should consider using reliable messaging if the web service is experiencing the following
types of problems:
■ Communication failures are occurring that result in the network being unavailable or
connections being dropped
■ Application messages are being lost in transit
■ Application messages are arriving at their destination out of order and ordered delivery is a
requirement
To help decide whether or not to use reliable messaging, weigh the following advantages and
disadvantages:
■ Enabling reliable messaging ensures that messages are delivered exactly once from the
source to the destination and, if the ordered-delivery option is enabled, ensures that
messages are delivered in order.
■ Enabling reliable messaging causes a degradation of web service performance, especially if
the ordered delivery option is enabled.
■ Non-reliable messaging clients cannot interoperate with web services that have reliable
messaging enabled.
For instructions on how to use the Reliable Messaging technology, see Chapter 6, “Using
Reliable Messaging.”
Security Technology
Until now, web services have relied on transport-based security such as SSL to provide
point-to-point security. WSIT implements WS-Security so as to provide interoperable message
content integrity and confidentiality, even when messages pass through intermediary nodes
before reaching their destination endpoint. WS-Security as provided by WSIT is in addition to
existing transport-level security, which may still be used.
Further, WSIT implements two additional features to improve security in web services:
■ Web Services Security Policy: Enables web services to use security assertions to clearly
represent security preferences and requirements for web service endpoints.
■ Web Services Trust: Enables web service applications to use SOAP messages to request
security tokens that can then be used to establish trusted communications between a client
and a web service.
WSIT implements these features in such a way as to ensure that web service binding security
requirements, as defined in the WSDL file, can interoperate with and be consumed by WSIT
and WCF endpoints.
For instructions on how to use the WS-Security technology, see Chapter 7, “Using WSIT
Security.”
WSIT is the product of Sun’s web services interoperability initiative. Windows Communication
Foundation (WCF) is Microsoft’s unified programming model for building connected systems.
WCF, which is now available as part of the .NET Framework 3.0 product, includes application
programming interfaces (APIs) for building secure, reliable, transacted web services that
interoperate with non-Microsoft platforms.
In a joint effort, Sun Microsystems and Microsoft are testing WSIT against WCF to ensure that
Sun web service clients (consumers) and web services (producers) do in fact interoperate with
WCF web services applications and vice versa. The testing will ensure that the following
interoperability goals are realized:
■ WSIT web services clients can access and consume WCF web services.
■ WCF web services clients can access and consume WSIT web services.
Sun is building WSIT on the Java platform and Microsoft is building WCF on the .NET 3.0
platform. The sections that follow describe the web services specifications implemented by Sun
Microsystems in Web Services Interoperability Technologies (WSIT) and provide high-level
descriptions of how each WSIT technology works.
Note – Because WSIT-based clients and services are interoperable, you can gain the benefits of
WSIT without using WCF.
WSIT Specifications
The specifications for bootstrapping and configuration, message optimization, reliable
messaging, and security technologies are discussed in the following sections:
■ “Bootstrapping and Configuration Specifications” on page 25
■ “Message Optimization Specifications” on page 27
■ “Reliable Messaging Specifications” on page 28
■ “Security Specifications” on page 30
Technology Version
The same versions of these specifications are also implemented in WCF in .NET 3.0. Sun will
update to the standard versions of these specifications in a future release of WSIT. Those
versions will coincide with the versions used in WCF in .NET 3.5.
{
Web Services
Metadata Exchange
Bootstrapping
and
Configuration Web Services
Standards Policy
WSDL*
In addition to the Core XML specifications, bootstrapping and configuration was implemented
using the following specifications:
■ WSDL: The Web Services Description Language (WSDL) specification was previously
implemented in JAX-WS. WSDL is a standardized XML format for describing network
services. The description includes the name of the service, the location of the service, and
ways to communicate with the service, that is, what transport to use. WSDL descriptions can
be stored in service registries, published on the Internet, or both.
■ Web Services Policy: This specification provides a flexible and extensible grammar for
expressing the capabilities, requirements, and general characteristics of a web service. It
provides the mechanisms needed to enable web services applications to specify policy
information in a standardized way. However, this specification does not provide a protocol
that constitutes a negotiation or message exchange solution for web Services. Rather, it
specifies a building block that is used in conjunction with the WS-Metadata Exchange
protocol. When applied in the web services model, policy is used to convey conditions on
interactions between two web service endpoints. Typically, the provider of a web service
exposes a policy to convey conditions under which it provides the service. A requester might
use the policy to decide whether or not to use the service.
■ Web Services Metadata Exchange: This specification defines a protocol to enable a
consumer to obtain a web service’s metadata, that is, its WSDL and policies. It can be
thought of as a bootstrap mechanism for communication.
Figure 2–4 shows the specifications that were implemented to optimize communication
between two web service endpoints.
{
SOAP MTOM
Web Services
Addressing
In addition to the Core XML specifications, optimization was implemented using the following
specifications:
■ SOAP: JAX Web Services currently supports the SOAP wire protocol. With SOAP
implementations, client requests and web service responses are most often transmitted as
Simple Object Access Protocol (SOAP) messages over HTTP to enable a completely
interoperable exchange between clients and web services, all running on different platforms
and at various locations on the Internet. HTTP is a familiar request-and response standard
for sending messages over the Internet, and SOAP is an XML-based protocol that follows
the HTTP request-and-response model. In SOAP 1.1, the SOAP portion of a transported
message handles the following:
■ Defines an XML-based envelope to describe what is in the message and how to process
the message.
■ Includes XML-based encoding rules to express instances of application-defined data
types within the message.
■ Defines an XML-based convention for representing the request to the remote service
and the resulting response.
In SOAP 1.2 implementations, web service endpoint addresses can be included in the
XML-based SOAP envelope, rather than in the transport header (for example in the
HTTP transport header), thus enabling SOAP messages to be transport independent.
■ Web Services Addressing: The Java APIs for W3C Web Services Addressing were first
shipped with Java Web Services Developer’s Pack 2.0 (JWSDP 2.0). This specification
defines a set of abstract properties and an XML Infoset representation that can be bound to a
SOAP message so as to reference web services and to facilitate end-to-end addressing of
endpoints in messages. A web service endpoint is an entity, processor, or resource that can
be referenced and to which web services messages can be addressed. Endpoint references
convey the information needed to address a web service endpoint. The specification defines
two constructs: message addressing properties and endpoint references, that normalize the
information typically provided by transport protocols and messaging systems in a way that
is independent of any particular transport or messaging system. This is accomplished by
defining XML tags for including web service addresses in the SOAP message, instead of the
HTTP header. The implementation of these features enables messaging systems to support
message transmission in a transport-neutral manner through networks that include
processing nodes such as endpoint managers, firewalls, and gateways.
■ Web Services Secure Conversation: This specification provides better message-level
security and efficiency in multiple-message exchanges in a standardized way. It defines basic
mechanisms on top of which secure messaging semantics can be defined for
multiple-message exchanges and allows for contexts to be established and potentially more
efficient keys or new key material to be exchanged, thereby increasing the overall
performance and security of the subsequent exchanges.
■ SOAP MTOM: The SOAP Message Transmission Optimization Mechanism (MTOM),
paired with the XML-binary Optimized Packaging (XOP), provides standard mechanisms
for optimizing the transmission and/or wire format of SOAP messages by selectively
encoding portions of the SOAP message, while still presenting an XML Infoset to the SOAP
application. This mechanism enables the definition of a hop-by-hop contract between a
SOAP node and the next SOAP node in the SOAP message path so as to facilitate the
efficient pass-through of optimized data contained within headers or bodies of SOAP
messages that are relayed by an intermediary. Further, it enables message optimization to be
done in a binding independent way.
Supporting
Reliability
Standards
{
Web Services
Web Services
Reliable Messaging
Web Services
Web Services
Atomic Transactions
Web Services
Coordination
Web Services
Standards Security Policy Addressing
In addition to the Core XML specifications and supporting standards (Web Services Security
and Web Services Policy, which are required building blocks), the reliability feature is
implemented using the following specifications:
■ Web Services Reliable Messaging: This specification defines a standardized way to identify,
track, and manage the reliable delivery of messages between exactly two parties, a source
and a destination, so as to recover from failures caused by messages being lost or received
out of order. The specification is also extensible so it allows additional functionality, such as
security, to be tightly integrated. The implementation of this specification integrates with
and complements the Web Services Security, and the Web Services Policy implementations.
■ Web Services Coordination: This specification defines a framework for providing
protocols that coordinate the actions of distributed applications. This framework is used by
Web Services Atomic Transactions. The implementation of this specification enables the
following capabilities:
■ Enables an application service to create the context needed to propagate an activity to
other services and to register for coordination protocols.
■ Enables existing transaction processing, workflow, and other coordination systems to
hide their proprietary protocols and to operate in a heterogeneous environment.
■ Defines the structure of context and the requirements so that context can be propagated
between cooperating services.
■ Web Services Atomic Transactions: This specification defines a standardized way to
support two-phase commit semantics such that either all operations invoked within an
atomic transaction succeed or are all rolled back. Implementations of this specification
require the implementation of the Web Services Coordination specification.
Security Specifications
Figure 2–6 shows the specifications implemented to secure communication between two web
service endpoints and across intermediate endpoints.
In addition to the Core XML specifications, the security feature is implemented using the
following specifications:
■ Web Services Security: This specification defines a standard set of SOAP extensions that
can be used when building secure web services to implement message content integrity and
confidentiality. The implementation provides message content integrity and confidentiality
even when communication traverses intermediate nodes, thus overcoming a short coming
of SSL. The implementation can be used within a wide variety of security models including
PKI, Kerberos, and SSL and provides support for multiple security token formats, multiple
trust domains, multiple signature formats, and multiple encryption technologies.
■ Web Services Policy: This specification provides a flexible and extensible grammar for
expressing the capabilities, requirements, and general characteristics of a web service. It
provides a framework and a model for the expression of these properties as policies and is a
building block for Web Services Security policy.
■ Web Services Trust: This specification supports the following capabilities in a standardized
way:
■ Defines extensions to Web Services Security that provide methods for issuing, renewing,
and validating security tokens used by Web services security.
■ Establishes, assesses the presence of, and brokers trust relationships.
■ Web Services Secure Conversation: This specification defines a standardized way to
provide better message-level security and efficiency in multiple-message exchanges. The
WSIT implementation provides basic mechanisms on top of which secure messaging
semantics can be defined for multiple-message exchanges and allows for contexts to be
established along with more efficient keys or new key material. This approach increases the
overall performance and security of the subsequent exchanges. While the Web Services
Security specification, described above, focuses on the message authentication model, it
does leave openings for several forms of attacks. The Secure Conversation authentication
specification defines a standardized way to authenticate a series of messages, thereby
addressing the short comings of Web Services Security. With the Web Services Security
Conversation model, the security context is defined as a new Web Services security token
type that is obtained using a binding of Web Services Trust.
■ Web Services Security Policy: This specification defines a standard set of patterns or sets of
assertions that represent common ways to describe how messages are secured on a
communications path. The WSIT implementation allows flexibility in terms of tokens,
cryptography, and mechanisms used, including leveraging transport security, but is specific
enough to ensure interoperability based on assertion matching by web service clients and
web services providers.
Message optimization enables web service endpoints to identify large binary message payloads,
remove the message payloads from the body of the SOAP message, encode the message
payloads using an efficient encoding mechanism (effectively reducing the size of the payloads),
re-insert the message payloads into the SOAP message as attachments (the file is linked to the
SOAP message body by means of an Include tag). Thus, message optimization is achieved by
encoding binary objects prior to transmission and then de-encoding them when they reach
there final destination.
The optimization process is really quite simple. To effect optimized message transmissions, the
sending endpoint checks the body of the SOAP message for XML encoded binary objects that
exceed a predetermined size and encodes those objects for efficient transmission over the
Internet.
SOAP MTOM, paired with the XML-binary Optimized Packaging (XOP), addresses the
inefficiencies related to the transmission of binary data in SOAP documents. Using MTOM and
XOP, XML messages are dissected in order to transmit binary files as MIME attachments in a
way that is transparent to the application. This transformation is restricted to base64 content in
canonical form as defined in XSD Datatypes as specified in XML Schema Part 2: Datatypes
Second Edition, W3C Recommendation 28 October 2004.
Thus, the WSIT technology achieves message optimization through an implementation of the
MTOM and XOP specifications. With the message optimization feature enabled, small binary
objects are sent in-line in the SOAP body. For large binary objects, this becomes quite
inefficient, so the binary object is separated from the SOAP body, encoded, sent as an
attachment to the SOAP message, and decoded when it reaches its destination endpoint.
Thus, using the Reliable Messaging technology, web service endpoints collaborate to determine
which messages in a particular application message sequence arrived at the destination
endpoint and which messages require resending. The reliable messaging protocol requires that
the destination endpoint return message-receipt acknowledgements that include the sequence
identifier and the message number of each message received. If the source determines that a
message was not received by the destination, it resends the message and requests an
acknowledgement. Once the source has sent all messages for a given sequence and their receipt
has been acknowledged by the destination, the source terminates the sequence.
The web service destination endpoint in turn sends the application messages along to the
application. If ordered delivery is configured (optional), the destination endpoint reconstructs a
complete stream of messages for each sequence in the exact order in which the messages were
sent and sends them along to the destination application. Thus, through the use of the reliable
messaging protocol, the destination endpoint is able to provide the following delivery
assurances to the web service application:
■ Each message is delivered to the destination application at least once.
■ Each message is delivered to the destination application at most once.
■ Sequences of messages are grouped by sequence identifiers and delivered to the destination
application in the order defined by the message numbers.
Figure 2–7 shows a simplified view of client and web service application message exchanges
when the Reliable Messaging protocol is not used.
When the Reliable Messaging protocol is not used, application messages flow over the HTTP
connection with no delivery assurances. If messages are lost in transit or delivered out of order,
the communicating endpoints have no way of knowing.
Figure 2–8 shows a simplified view of client and web service application message exchanges
when reliable messaging is enabled.
Proxy n Terminate
Sequence
With reliable messaging enabled, the Reliable Messaging source module is plugged into the
JAX-WS web service client. The source module transmits the application messages and keeps
copies of the messages until their receipt is acknowledged by the destination module through
the exchange of protocol messages. The destination module acknowledges messages and
optionally buffers them for ordered-delivery guarantee. After guaranteeing order, if configured,
the destination module allows the messages to proceed through the JAX-WS dispatch for
delivery to the endpoint or application destination.
The security policy model uses the policy specified in the WSDL file for associating policy
assertions with web service communication. As a result, whenever possible, the security policy
assertions do not use parameters or attributes. This enables first-level, QName-based assertion
matching to be done at the framework level without security domain-specific knowledge. The
first-level matching provides a narrowed set of policy alternatives that are shared by the client
and web service endpoint when they attempt to establish a secure communication path.
Note – A QName is a qualified name, as specified by the XML Schema Part2: Datatypes
specification (http://www.w3.org/TR/xmlschema-2/#QName), Namespaces in XML
(http://www.w3.org/TR/REC-xml-names/#ns-qualnames), and Namespaces in XML Errata
(http://www.w3.org/XML/xml-names-19990114-errata). A qualified name is made up of a
namespace URI, a local part, and a prefix.
RequestSecurityToken
Security
2. Token
RequestSecurityTokenResponse
Service
3.
Client
To establish trust between a client, a Security Token Service, and a web service:
1. The client establishes an HTTPS connection with the Secure Token Service using one of the
following methods:
■ Username Authentication and Transport Security: The client authenticates to the
Security Token Service using a username token. The Security Token Service uses a
certificate to authenticate to the Client. Transport security is used for message
protection.
■ Mutual Authentication: Both the client-side and server-side use X509 certificates to
authenticate to each other. The client request is signed using Client’s X509 certificate,
then signed using ephemeral key. The web service signs the response using keys derived
from the client’s key.
2. The client sends a RequestSecurityToken message to the Security Token Service.
3. The Security Token Service sends a Security Assertion Markup Language (SAML) token to
the Client.
4. The client uses the SAML token to authenticate itself to the web service and trust is
established.
This chapter describes how to use NetBeans IDE (“the IDE”) and GlassFish to build and deploy
a web service and client that use WSIT. It includes examples of the files that the IDE helps you
create and examples of the build directories and the key files that the IDE produces to create a
web service and a client.
3 Select GlassFish V2 or Sun Java System Application Server, and click Next.
The platform folder location window displays.
39
Creating a Web Service
4 Specify the platform location of the server instance and the domain to which you want to
register, then click Finish.
The Servers window displays.
5 Type the server username and password that you supplied when you installed the web
container (the defaults are admin and adminadmin), then click Close.
package org.me.calculator;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
@WebService()
public class Calculator {
@WebMethod(action="sample_operation")
public String operation(@WebParam(name="param_name")
String param) {
// implement the web service operation here
return param;
}
@WebMethod(action="add")
public int add(@WebParam(name = "i") int i,
@WebParam(name = "j") int j) {
int k = i + j;
return k;
}
}
Notice that this web service performs a very simple operation. It takes two integers, adds them,
and returns the result.
1 Click the Services tab in the left pane, expand the Servers node, and verify that GlassFish is listed
in the left pane. If it is not listed, register it by following the steps in “Registering GlassFish with
the IDE”on page 39.
2 Choose File→New Project, select Web from Category, select Web Application from Projects, and
click Next.
3 Assign the project a name that is representative of services that will be provided by the web
service (for example, CalculatorApplication), set the Project Location to the location where
you'd like to create the project, and click Finish.
Note – When you create the web service project, be sure to define a Project Location that does
not include spaces in the directory name. Spaces in the directory might cause the web service
and web service clients to fail to build and deploy properly. To avoid this problem, Sun
recommends that you create a directory, for example C:\work, and put your project there.
5 Type the web service name (CalculatorWS) and the package name (org.me.calculator) in the
Web Service Name and the Package fields respectively.
8 In the upper part of the Add Operation dialog box, type add in Name.
10 In the lower part of the Add Operation dialog box, click Add and create a parameter named i of
type int. Click Add again and create a parameter named j of type int.
12 Notice that the add method has been added in the Operations design box.
13 Click the Source tab for CalculatorWS.java in the right pane. Notice that the add method has
been added to the source code.
@WebMethod(operationName="add")
public int add(@WebParam(name = "i") int i, @WebParam(name = "j") int j) {
// TODO write your implementation code here
return 0;
}
1 In the Projects window, expand the Web Services node under the CalculatorApplication node,
right-click the CalculatorWSService node, and choose Edit Web Service Attributes, as shown in
Figure 3–1.
2 Select the Reliable Message Delivery check box, as shown in Figure 3–2, and click OK.
This setting ensures that the service sends an acknowledgement to the clients for each message
that is delivered, thus enabling clients to recognize message delivery failures and to retransmit
the message. This capability makes the web service a “reliable” web service.
3 In the left pane, expand the Web Pages node and the WEB-INF node, and double-click the
wsit-endpoint-classname.xml (wsit-org.me.calculator.CalculatorWS.xml) file to view this
file. Click the Source tab.
The following tags enable reliable messaging:
<wsp:Policy wsu:Id="CalculatorWSPortBindingPolicy">
<wsp:ExactlyOne>
<wsp:All>
<wsaw:UsingAddressing xmlns:wsaws="http://www.w3.org/2006/05/addressing/wsdl"/>
<wsrm:RMAssertion/>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
3 Right-click the project node and choose Run. The first time GlassFish is started, you will be
prompted for the admin password.
The IDE starts the web container, builds the application, and displays the WSDL file page in
your browser. You have now successfully deployed a WSIT-enabled web service.
The followingWSIT tags display in the WSDL file:
<wsp:UsingPolicy/>
<wsp:Policy wsu:Id="CalculatorWSPortBindingPolicy">
<wsp:ExactlyOne>
<wsp:All>
<ns1:RMAssertion/>
<ns2:UsingAddressing/>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
1 Choose File→New Project, select Web Application from the Web category and click Next.
Note – NetBeans submenus are dynamic, so the Web Service Client option may not appear. If
you do not see the Web Service Client option, select New→File\Folder→Webservices→Web
Service Client.
5 Cut and paste the URL of the web service that you want the client to consume into the WSDL URL
field.
For example, here is the URL for the CalculatorWS web service:
http://localhost:8080/CalculatorApplication/CalculatorWSService?wsdl
When JAX-WS generates the web service, it appends Service to the class name by default.
8 Name the servlet ClientServlet, specify the package name, for example,
org.me.calculator.client and click Finish.
9 To make the servlet the entry point to your application, right-click the
CalculatorWSServletClient project node, choose Properties, click Run, type /ClientServlet in
the Relative URL field, and click OK.
11 In the Source Editor, remove the line that comments out the body of the processRequest
method.
This is the start-comment line that starts the section that comments out the code:
/* TODO output your page here
12 Delete the end-comment line that ends the section of commented out code:
*/
14 Right-click in one of the empty lines that you added, then choose Web Service Client
Resources→Call Web Service Operation.
The Select Operation to Invoke dialog box appears.
out.close();
}
16 Change the values for int i and int j to other numbers, such as 3 and 4.
18 If Reliable Messaging is enabled, the client needs to close the port when done or the server log
will be overwhelmed with messages. To close the port, first add the following line to the import
statements at the top of the file:
import com.sun.xml.ws.Closeable;
Then add the line in bold at the end of the try block, as shown below.
19 Save ClientServlet.java.
This chapter explains how to retrieve information that is used to access and consume a
WSIT-enabled web service and provides pointers to examples that demonstrate how to
bootstrap and configure WSIT-enabled clients from Web Services Description Language
(WSDL) files.
Typically, web services package endpoint descriptions and use a WSDL file to share these
descriptions with clients. Clients use the web service endpoint description to generate code that
can send SOAP messages to and receive SOAP messages from the web service endpoint.
49
Client From WSDL Examples
Web Services Metadata Exchange (WS-MEX) is the protocol for requesting and transferring the
WSDL from the provider to the client. This protocol is a bootstrap mechanism for
communication. When the type of metadata desired is clearly known (for example, WS-Policy),
a client request may indicate that only that type should be returned.
Message Optimization
This chapter provides instructions on how to configure message optimization in web service
providers and clients.
For detailed instructions for how to use NetBeans IDE to create a web service, see “Creating a
Web Service” on page 40.
51
Configuring Message Optimization in a Web Service
2 Select the Optimize Transfer of Binary Data (MTOM) check box, as shown in Figure 5–1, and click
OK.
This setting configures the web service to optimize messages that it transmits and to decode
optimized messages that it receives.
1 Right-click the project node and select Properties, then select Run.
1 Choose File→New Project, select Web Application from the Web category and click Next.
Note – NetBeans submenus are dynamic, so the Web Service Client option may not appear. If
you do not see the Web Service Client option, select New→File\Folder→Webservices→Web
Service Client.
5 Cut and paste the URL of the web service that you want the client to consume into the WSDL URL
field.
For example, here is the URL for the CalculatorWS web service:
http://localhost:8080/CalculatorApplication/CalculatorWSService?wsdl
When JAX-WS generates the web service, it appends Service to the class name by default.
8 Name the servlet ClientServlet, specify the package name, for example,
org.me.calculator.client and click Finish.
9 To make the servlet the entry point to your application, right-click the
CalculatorWSServletClient project node, choose Properties, click Run, type /ClientServlet in
the Relative URL field, and click OK.
11 In the Source Editor, remove the line that comments out the body of the processRequest
method.
This is the start-comment line that starts the section that comments out the code:
/* TODO output your page here
12 Delete the end-comment line that ends the section of commented out code:
*/
14 Right-click in one of the empty lines that you added, then choose Web Service Client
Resources→Call Web Service Operation.
The Select Operation to Invoke dialog box appears.
16 Change the values for int i and int j to other numbers, such as 3 and 4.
18 Save ClientServlet.java.
For more information on how to use Secure Conversation, see Chapter 7, “Using WSIT
Security.”
This chapter explains how to configure reliable messaging in web service providers and clients.
Option Description
Ordered Delivery Specifies whether the Reliable Messaging protocol ensures that the application
messages for a given message sequence are delivered to the endpoint application
in the order indicated by the message numbers.
This option increases the time to process application message sequences and may
result in the degradation of web service performance. Therefore, you should not
enable this option unless ordered delivery is required by the web service.
57
Creating Web Service Providers and Clients that use Reliable Messaging
Flow Control Specifies whether the Flow Control feature is enabled. When enabled, this option
works in conjunction with the Max Buffer Size setting to determine the maximum
number of messages for sequence that can be stored at the endpoint awaiting
delivery to the application. Messages may have to be withheld from the
application if ordered delivery is required and some of their predecessors have
not arrived. If the number of stored messages reaches the threshold specified in
the Max Buffer Size setting, incoming messages belonging to the sequence are
ignored.
Max Buffer Size If Flow control is enabled, specifies the number of messages that will be buffered
for a message sequence. The default setting is 32. For more information, see the
description of the Flow Control option.
Inactivity Timeout Specifies the time interval beyond which either source or destination may
terminate any message sequence due to inactivity. The default setting is 600,000
milliseconds (10 minutes). A web service endpoint will always terminate a
sequence whose inactivity timeout has expired. To keep the sequence active, an
inactive client will always send a stand- alone message with an AckRequested
header to act as a heartbeat as the end of the Inactivity timeout interval
approaches.
For more information on how to use Secure Conversation, see Chapter 7, “Using WSIT
Security.”
■ AckRequested
■ no Last element
The following table lists the standard set of configurable features for Reliable Messaging Policy
v1.0 and v1.1.
1 Create a web service that uses reliable messaging following the steps in Chapter 3,“WSIT
Example Using a Web Container and NetBeans IDE.”
2 Open the WSIT Configuration file that is used when the web service is deployed by expanding
the Web Pages→WEB-INF elements of the application in the tree, and then double-clicking the
wsit-package.service.xml file to open it in the editor.
Note – Because of the missing tooling for specifying v1.1 of Reliable Messaging, do not configure
any Reliable Messaging details using NetBeans IDE.
5 Create a client following the instructions in Chapter 3,“WSIT Example Using a Web Container
and NetBeans IDE.”
Note – Because you are creating your web service client starting from a WSDL file, and because
the WSDL file already contains the WS-RM Policy v1.1 assertion(s), no further configuration is
required.
Because of the missing tooling for specifying v1.1 of Reliable Messaging, do not configure any
Reliable Messaging details using NetBeans IDE.
See Also An experimental version of the NetBeans plugin, that provides support for WS-RM v1.1. can be
downloaded from
http://websvc.netbeans.org/servlets/ProjectDocumentList?folderID=218.
This chapter describes how to use NetBeans Integrated Development Environment (“the IDE”)
to configure security for web services and web service clients using WSIT.
This release of WSIT makes securing web services even easier by including a set of
preconfigured security mechanisms that can be applied to a web service or a web service
operation simply by selecting it from a list. You can use advanced configuration options to
customize the security mechanism to the needs of your application.
63
Configuring Security Using NetBeans IDE
Note – When creating an application using the wizards in NetBeans IDE and running on
GlassFish, the Java EE Version defaults to Java EE 5. This results in an application compliant
with JSR-109, Implementing Enterprise Web Services, which can be read at
http://jcp.org/en/jsr/detail?id=109. If you select a value other than the default, for
example, J2EE 1.4, the application that is created is not JSR-109 compliant, which means that
the application is not JAX-WS, but is JAX-RPC.
3 Right-click the node for the web service you want to secure.
Options in the Configure dialog are discussed in “Security Mechanism Configuration Options”
on page 145.
8 Specify Keystore, Truststore, STS, SSL, and/or user information as required for the selected
security mechanism.
Refer to the entry for the selected security mechanism in Table 7–1. This table summarizes the
information that needs to be set up for each of the security mechanisms.
10 Run the web application by right-clicking the project node and selecting Run.
11 Verify the URL of the WSDL file before proceeding with the creation of the web service client.
The client will be created from this WSDL file, and will get the service’s security policies through
the web service reference URL when the client is built or refreshed.
Next Steps The WSIT Configuration file that is used when the web service is deployed can be viewed by
expanding the Web Pages→WEB-INF elements of the application in the tree, and then
double-clicking the wsit-package.service.xml file to open it in the editor. The full contents of
an example service-side WSIT configuration file can be viewed at “Service-Side WSIT
Configuration Files” on page 139.
Steps for configuring an example application are provided for several of the mechanisms. See
the following sections for a complete example of how to configure a web service and a web
service client to use these security mechanisms:
■ “Example: Username Authentication with Symmetric Key (UA)” on page 112
■ “Example: Mutual Certificates Security (MCS)” on page 114
■ “Example: Transport Security (SSL)” on page 116
■ “Example: SAML Authorization over SSL (SA)” on page 119
■ “Example: SAML Sender Vouches with Certificates (SV)” on page 123
To use the IDE to configure security for a web service client, perform the following steps.
Note – If you prefer to use localhost in place of the fully-qualified hostname when specifying
the URL for the service WSDL, you must follow the workaround described in “Transport
Security (SSL) Workaround” on page 78.
4 Right-click the node for the web service reference you want to secure.
FIGURE 7–2 Web Service References Attributes Editor Page for Web Service Clients
Next Steps To view the WSIT configuration files, in the tree, drill down from the project to Source
Packages→META-INF. Double-click on serviceService.xml or wsit-client.xml to view the
contents. The full contents of example client WSIT configuration files can be viewed at
“Client-Side WSIT Configuration Files” on page 142.
If you would like to enable message logging for this application to help with development and
debugging, you will need to edit some system properties. A blog describing these properties is
available at
http://weblogs.java.net/blog/arungupta/archive/2006/12/message_logging_1.html.
Username X X
Authentication with
Symmetric Key
Transport Security X X
Message Authentication X X
over SSL - Username
Token
SAML Authorization X
over SSL
Endorsing Certificate X X
■ Keystore: If this column has an X, select Use Development Defaults, or click the Keystore
button and configure the keystore to specify the alias identifying the service certificate and
private key. For the GlassFish keystores, the file is keystore.jks and the alias is
xws-security-server, assuming that you've updated the GlassFish default certificate
stores.
■ Truststore: If this column has an X, select Use Development Defaults, or click the
Truststore button and configure the truststore to specify the alias that contains the
certificate and trusted roots of the client. For the GlassFish keystores, the file is cacerts.
jks and the alias is xws-security-client, assuming that you've updated the GlassFish
default certificate stores.
■ STS: If this column has an X, you must have a Security Token Service that can be referenced
by the service. An example of an STS can be found in the section “To Create and Secure the
STS (STS)” on page 126. The STS is secured using a separate (non-STS) security mechanism.
The security configuration for the client-side of this application is dependent upon the
security mechanism selected for the STS, and not on the security mechanism selected for the
application.
■ SSL: To use a mechanism that uses secure transport (SSL), you must configure the system to
point to the client and server keystore and truststore files. Steps for doing this are described
in “Configuring SSL For Your Applications” on page 83.
■ User in Glassfish: To use a mechanism that requires a user database for authentication, you
can add a user to the file realm of GlassFish. Select Use Development Defaults, or follow the
instructions for doing this at “Adding Users to GlassFish” on page 86.
SAML
Callback User in
Mechanism Keystore Truststore Default User Handler STS SSL GlassFish
Username X X X
Authentication with
Symmetric Key
Mutual Certificates X X
Transport Security X X
Message X X X
Authentication over
SSL - Username
Token
Message X X
Authentication over
SSL - X.509 Token
SAML Authorization X X X X
over SSL
Endorsing Certificate X X
SAML Sender X X X
Vouches with
Certificate
■ Keystore: If this column has an X, select Use Development Defaults, or click Keystore to
configure the keystore to point to the alias for the client certificate. For the GlassFish
keystores, the keystore file is keystore.jks and the alias is xws-security-client,
assuming that you've updated the GlassFish default certificate stores.
■ Truststore: If this column has an X, select Use Development Defaults, or click Truststore to
configure the truststore that contains the certificate and trusted roots of the server. For the
GlassFish keystores, the file is cacerts.jks and the alias is xws-security-server,
assuming that you’ve updated the GlassFish default certificate stores as described in “To
Manually Update GlassFish Certificates” on page 89.
When using an STS mechanism, the client specifies the truststore and certificate alias for the
STS, not the service. For the GlassFish stores, the file is cacerts.jks and the alias is wssip.
■ Default User: When this column has an X, you must configure either a default username
and password, a UsernameCallbackHandler, or leave these options blank and specify a user
at runtime. More information on these options can be found at “Configuring Username
Authentication on the Client” on page 72.
■ SAML Callback Handler: When this column has an X, you must specify a SAML Callback
Handler. Examples of SAML Callback Handlers are described in “Example SAML Callback
Handlers” on page 74.
■ STS: If this column has an X, you must have a Security Token Service that can be referenced
by the service. An example of an STS can be found in the section “To Create and Secure the
STS (STS)” on page 126. The STS is secured using a separate (non-STS) security mechanism.
The security configuration for the client-side of this application is dependent upon the
security mechanism selected for the STS, and not on the security mechanism selected for the
application.
■ SSL: To use a mechanism that uses secure transport (SSL), you must configure the system to
point to the client and server keystore and truststore files. Steps for doing this are described
in “Configuring SSL For Your Applications” on page 83.
■ User in Glassfish: To use a mechanism that requires a user database for authentication,
select Use Development Defaults, or add a user to the file realm of GlassFish. Instructions
for doing this can be found at “Adding Users to GlassFish” on page 86.
1 In the Projects window, expand the node for the web service client.
3 Right-click the node for the web service reference for which you want to configure security
options.
5 Select the Quality of Service tab to display the WSIT Security options.
6 Expand the Security section to specify the user name and password information as required by
the service. The dialog appears as shown in Figure 7–3.
Note – Currently the GlassFish CallbackHandler cannot handle the following: SAML Callbacks
and Require ThumbPrint Reference assertions under an X.509 Token. This may be addressed in
a future milestone.
■ Use Development Defaults:
Select this option to import certificates into the GlassFish keystore and truststore so that
they can be used immediately for development. The WSIT message security mechanisms
require the use of v3 certificates. The default GlassFish keystore and truststore do not
contain v3 certificates at this time. In order to use message security mechanisms with
GlassFish, it is necessary to obtain keystore and truststore files that contain v3 certificates
and import the appropriate certificates into the default GlassFish stores.
In addition to importing certificates, when this option is selected a default user is created in
the file realm with username wsitUser.
In a production environment, you should provide your own certificates and user settings,
however, in a development environment you may find these defaults useful.
■ Authentication Credentials: Select Static or Dynamic. Select Static to supply a static
username and password, or select Dynamic and specify the Username and Password
CallbackHandlers. Select Static if you want to fill in the exact user credentials that the client
is providing, and which cannot be changed after deployment. Static is useful to developing
and testing applications prior to deployment. Select Dynamic to use CallbackHandlers to
provide a dynamic way to provide credentials. Dynamic is useful if the credentials need to be
obtained from some third party, for example, or if the developer doesn't want to store the
user name and password in a configuration file because it might introduce a security risk.
■ Default Username, Default Password: These options are available when Static is selected as
the Authentication Credential. Type the name of an authorized user and the password for
this user. This option is best used only in the development environment. When the Default
Username and Default Password are specified, the username and password are stored in the
wsit-client.xml file in clear text, which presents a security risk. Do not use this option for
production.
■ Default Username Callback Handler, Default Password Callback Handler: These options
are available when the Authentication Credential is Dynamic. If you create
JSR-109–compliant web services and web service clients that run under an Application
Server container (JSR-109 deployment), the container handles the callbacks and you do not
need to configure Callback Handlers of your own. If you are using another container, select
the Browse button to select the class implementing the
javax.security.auth.callback.CallbackHandler interface.
■ SAML Callback Handler: To use a SAML Callback Handler, you need to create one, as there
is no default. References to example SAML Callback Handlers are provided in “Example
SAML Callback Handlers” on page 74. An example that uses a SAML Callback Handler can
be found in “Example: SAML Authorization over SSL (SA)” on page 119.
https://wsit.dev.java.net/
source/browse/*checkout*/wsit/wsit/test/e2e/testcases/xwss/s11/resources/wsit-client.xml
■ An example of a SAML Callback Handler can be viewed and/or downloaded from the
following URL:
https://xwss.dev.java.net/
servlets/ProjectDocumentList?folderID=6645[amp ]expandFolder=6645[amp
]folderID=6645
■ An example application in this tutorial that uses a SAML Callback Handler can be found in
“Example: SAML Authorization over SSL (SA)” on page 119.
When writing SAML Callback Handlers for different security mechanisms, set the subject
confirmation method to SV (Sender Vouches) or HOK (Holder of Key) and the appropriate
SAML Assertion version depending on the SAML version and SAML Token Profile selected
when setting the security mechanism for the service. When the subject confirmation method is
HOK, a keystore and truststore file must be configured in the SAMLCallbackHandler. When
the method is SV, you can either comment out the keystore and truststore information, or leave
it, as it will not be used.
For example, the following code snippet for one of the SAMLCallbackHandlers listed above
demonstrates how to set the subject confirmation method and sets the SAMLAssertion version
to 1.0, profile 1.0.
/*
Set confirmation Method to SV [SenderVouches] or HOK[Holder of Key]
*/
samlCallback.setConfirmationMethod
(samlCallback.SV_ASSERTION_TYPE);
if (samlCallback.getConfirmationMethod().equals(
samlCallback.SV_ASSERTION_TYPE)) {
samlCallback.setAssertionElement
(createSVSAMLAssertion());
svAssertion_saml10 =
samlCallback.getAssertionElement();
/*
samlCallback.setAssertionElement
(createSVSAMLAssertion20());
svAssertion_saml20 =
samlCallback.getAssertionElement();
*/
} else if (samlCallback.getConfirmationMethod().equals(
samlCallback.HOK_ASSERTION_TYPE)) {
samlCallback.setAssertionElement
(createHOKSAMLAssertion());
hokAssertion_saml10 =
samlCallback.getAssertionElement();
/*
samlCallback.setAssertionElement
(createHOKSAMLAssertion20());
hokAssertion_saml20 =
samlCallback.getAssertionElement();
*/
}
} catch (Exception e) {
e.printStackTrace();
}
} else {
throw unsupportedCallback;
}
Security Mechanisms
This section describes security mechanisms you can implement with WSIT. This section
provides an overview of the following mechanisms:
■ “Username Authentication with Symmetric Key” on page 77
■ “Mutual Certificates Security” on page 77
■ “Transport Security (SSL)” on page 77
■ “Message Authentication over SSL” on page 79
■ “SAML Authorization over SSL” on page 79
■ “Endorsing Certificate” on page 79
■ “SAML Sender Vouches with Certificates” on page 80
■ “SAML Holder of Key” on page 80
■ “STS Issued Token” on page 81
■ “STS Issued Token with Service Certificate” on page 81
■ “STS Issued Endorsing Token” on page 82
A table that summarizes the configuration options on the server side is available in “Summary
of Service-Side Configuration Requirements” on page 69.
Some common communication issues that need to be addressed using security mechanisms are
discussed in “Using Security Mechanisms” on page 137.
To use this mechanism, follow the steps in “Configuring SSL For Your Applications” on
page 83.
Note – If you use the fully-qualified hostname (FQHN) in the URL for the service WSDL when
you are adding the web service client to the client application, this workaround is not required.
It is only required when you specify localhost in the URL for the service WSDL.
A developer would want to use a CN which is different from the host name in the URL in WSIT
when using https addresses in Dispatch clients and during wsimport. The below mentioned
workaround is only for the Dispatch clients, which are also used in WS-Trust to communicate
with STS. This has to be done even if the client’s main service is not on https, but only the STS is
on https.
Java by default verifies that the certificate CN (Common Name) is the same as host name in the
URL. If the CN in the certificate is not the same as the host name, your web service client fails
with the following exception:
javax.xml.ws.WebServiceException: java.io.IOException:
HTTPS hostname wrong: should be <hostname as in the certificate>
The recommended way to overcome this issue is to generate the server certificate with the
Common Name (CN) matching the host name.
To work around this only during development, in your client code, you can set the default host
name verifier to a custom host name verifier which does a custom check. An example is given
below. It is sometimes necessary to include this in the static block of your main Java class as
shown below to set this verifier before any connections are made to the server.
static {
//WORKAROUND. TO BE REMOVED.
javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(
new javax.net.ssl.HostnameVerifier(){
Please remember to remove this code once you install valid certificates on the server.
By default, a Username Supporting Token will be used for message authentication. To use an
X.509 Supporting Token instead, click the Configure button and select X509. Under this
scenario, you will need to configure your system for using SSL as described in “Configuring SSL
For Your Applications” on page 83.
To use this mechanism, configure SSL on the server, as described in “Configuring SSL For Your
Applications” on page 83, and, on the clients side, configure a SAMLCallbackHandler as
described in “Example SAML Callback Handlers” on page 74.
See Also: “Example: SAML Authorization over SSL (SA)” on page 119.
Endorsing Certificate
This mechanism uses secure messages using symmetric key for integrity and confidentiality
protection, and uses an endorsing client certificate to augment the claims provided by the token
associated with the message signature. For this mechanism, the client knows the service’s
certificate, and requests need to be endorsed/authorized by a special identity. For example, all
requests to a vendor must be endorsed by a purchase manager, so the certificate of the purchase
manager should be used to endorse (or counter sign) the original request.
For this mechanism, the SAML token is included as part of the message signature as an
authorization token and is sent only to the recipient. The message payload needs to be signed
and encrypted. The requestor is vouching for the credentials (present in the SAML assertion) of
the entity on behalf of which the requestor is acting.
The initiator token, which is an X.509 token, is used for signature. The recipient token, which is
also an X.509 token, is used for encryption. For the server, this is reversed, the recipient token is
the signature token and the initiator token is the encryption token. A SAML token is used for
authorization.
See Also: “Example: SAML Sender Vouches with Certificates (SV)” on page 123.
Under this scenario, the service does not trust the client directly, but requires the client to send a
SAML assertion issued by a particular SAML authority. The client knows the recipient’s public
key, but does not share a direct trust relationship with the recipient. The recipient has a trust
relationship with the authority that issues the SAML token. The request is signed with the
client’s private key and encrypted with the server certificate. The response is signed using the
server’s private key and encrypted using the key provided within the HOK SAML assertion.
An STS is a service that implements the protocol defined in the WS-Trust specification (you can
find a link to this specification at https://wsit.dev.java.net/). This protocol defines
message formats and message exchange patterns for issuing, renewing, canceling, and
validating security tokens.
Service providers and consumers are in potentially different managed environments but use a
single STS to establish a chain of trust. The service does not trust the client directly, but instead
trusts tokens issued by a designated STS. In other words, the STS is taking on the role of a
second service with which the client has to securely authenticate. The issued tokens contain a
key, which is encrypted for the server and which is used for deriving new keys for signing and
encrypting.
To use this mechanism for the web service, you simply select this option as your security
mechanism. However, you must have a Security Token Service that can be referenced by the
service. An example of an STS can be found in the section “To Create and Secure the STS (STS)”
on page 126. In this section, you select a security mechanism for the STS. The security
configuration for the client-side of this application is dependent upon the security mechanism
selected for the STS, and not on the security mechanism selected for the application. The client
truststore must contain the certificate of the STS, which has the alias of wssip if you are using
the updated GlassFish certificates.
To use this mechanism for the web service, you simply select this option as your security
mechanism. However, you must have a Security Token Service that can be referenced by the
service. An example of an STS can be found in the section “To Create and Secure the STS (STS)”
on page 126. In this section, you select a security mechanism for the STS. The security
configuration for the client-side of this application is dependent upon the security mechanism
selected for the STS, and not on the security mechanism selected for the application. The client
truststore must contain the certificate of the STS, which has the alias of wssip if you are using
the updated GlassFish certificates.
In this mechanism, message integrity and confidentiality are protected using ephemeral keys
encrypted for the service. Ephemeral keys use an algorithm where the exchange key value is
purged from the cryptographic service provider (CSP) when the key handle is destroyed. The
service requires messages to be endorsed by a SAML token issued by a designated STS.
Service providers and consumers are in potentially different managed environments. For this
mechanism, the service requires that secure communications be endorsed by a trusted STS. The
service does not trust the client directly, but instead trusts tokens issued by a designated STS. In
other words, the STS is taking on the role of a second service with which the client has to
securely authenticate.
To use this mechanism for the web service, you simply select this option as your security
mechanism. However, you must have a Security Token Service that can be referenced by the
service. An example of an STS can be found in the section “To Create and Secure the STS (STS)”
on page 126. In this section, you select a security mechanism for the STS. The security
configuration for the client-side of this application is dependent upon the security mechanism
selected for the STS, and not on the security mechanism selected for the application. The client
truststore must contain the certificate of the STS, which has the alias of wssip if you are using
the updated GlassFish certificates.
2 Server Configuration
■ GlassFish is already configured for SSL. No further SSL configuration is necessary if you are
using Transport Security. However, if you are using one of the Message Security
mechanisms with SSL, you must update the GlassFish certificates as described in “To
Manually Update GlassFish Certificates” on page 89.
■ Configure a user on GlassFish as described in “Adding Users to GlassFish” on page 86.
3 Client Configuration
For configuring your system for SSL in order to work through the examples in this tutorial, the
same keystore and truststore files are used for both the client and the service. This makes it
unnecessary to set system properties to point to the client stores, as both GlassFish and
NetBeans IDE are aware of these certificates and point to them by default.
In general, for the client side of SSL you will not be using the same certificates for the client and
the service. In that case, you need to define the client certificate stores by setting the system
properties -Djavax.net.ssl.trustStore, -Djavax.net.ssl.keyStore,
-Djavax.net.ssl.trustStorePassword, and -Djavax.net.ssl.keyStorePassword in the
application client container.
You can specify the environment variables for keystore and truststore by setting the
environment variable VMARGS through the shell environment or inside an Ant script, or by
passing them in when you start NetBeans IDE from the command line. For example, in the
latter case, you would specify the property settings as follows:
netbeans-install/bin/netbeans.exe
-J-Djavax.net.ssl.trustStore=as-install/domains/domain1/config/cacerts.jks
-J-Djavax.net.ssl.keyStore=as-install/domains/domain1/config/keystore.jks
-J-Djavax.net.ssl.trustStorePassword=changeit
-J-Djavax.net.ssl.keyStorePassword=changeit
Use the hard-coded path to the keystore and truststore files, not variables.
For the SSL mechanism, the browser will prompt you to accept the server alias s1as.
Caution – On the client side, for the Transport Security (SSL) mechanism, you must either use
the fully-qualified hostname in the URL for the service WSDL when you are creating the web
sercie client, or else you must follow the steps in “Transport Security (SSL) Workaround” on
page 78.
4 Service Configuration
To require the service to use the HTTPS protocol, you must select a security mechanism that
uses SSL (as described in a previous step), and you have to specify the security requirements in
the service’s application deployment descriptor. This file is ejb-jar.xml for a web service that is
implemented as an EJB endpoint, and web.xml for a web service implemented as a servlet. To
specify the security information, follow these steps:
d. On the Security Constraints line, expand the node for SSL transport for CalculatorWSService.
This will display when a security mechanism that requires SSL is selected. This constraint will
be sufficient for the example applications. This sections walks you through making some
changes in the event that you would like to customize the security constraint for your
application.
f. Change the URL Pattern to be protected (for example, /*). Select which HTTP Methods to
protect, for example, POST. Click OK to close this dialog.
g. Unselect Enable Authentication Constraint. Ensure that the Enable User Data Constraint box
is checked. Verify that CONFIDENTIAL is selected for the Transport Guarantee to specify that
the application uses SSL because the application requires that data be transmitted so as to
prevent other entities from observing the contents of the transmission.
The IDE appears as shown in Figure 7–4.
h. Click the XML tab to display the additions to web.xml. The security constraint looks like this:
<security-constraint>
<display-name>Constraint1</display-name>
<web-resource-collection>
<web-resource-name>CalcWebResource</web-resource-name>
<description/>
<url-pattern>/*</url-pattern>
<http-method>POST</http-method>
</web-resource-collection>
<user-data-constraint>
<description/>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
i. When you run this project (right-click, select Run), the browser will ask you to accept the
server certificate of s1as. Accept this certificate. The WSDL appears in the browser.
5 Creating a Client
When creating your client application, use the fully-qualified hostname to specify the secure
WSDL location (use
https://fully_qualified_hostname:8181/CalculatorApplication/CalculatorWSService?
wsdl, for example, in place of
http://localhost:8080/CalculatorApplication/CalculatorWSService?wsdl).
In some cases, you might get an error dialog telling you that the URL
https://fully_qualified_hostname:8181/CalculatorApplication/CalculatorWSService?
wsdl couldn’t be downloaded. However, this is the correct URL, and it does load when you run
the service. So, when this error occurs, repeat the steps that create the Web Service Client using
the secure WSDL. The second time, the web service reference is created and you can continue
creating the client.
1 In NetBeans IDE, right-click the web service, select Edit Web Service Attributes.
3 To log in to the Admin Console, type the user name and password of a user in the admin-realm
who belongs to the asadmin group.
The name (admin) and password (adminadmin) entered during installation will work, as will any
users added to this realm and group subsequent to installation.
9 Type the correct information into the User ID, Password, and Group(s) fields.
The example applications reference a user with the following attributes:
■ User ID = wsitUser
■ Group List = wsit
■ New Password = changeit
■ Confirm New Password = changeit
1 In NetBeans IDE, right-click the web service, select Edit Web Service Attributes.
Note – The XWSS keystores are sample keystores containing sample v3 certificates. These
sample keystores can be used for development and testing of security with WSIT technology.
Once an application is in production, you should definitely use your own v3 certificates issued
by a trusted authority. In order to use WSIT security on GlassFish, you will have to import your
trusted stores into GlassFish’s keystore and specify those certificates from NetBeans IDE.
1 Download the zip file that contains the certificates and the Ant scripts (copyv3.zip) by going to
this URL:
https://xwss.dev.java.net/
servlets/ProjectDocumentList?folderID=6645[amp ]expandFolder=6645[amp
]folderID=6645
3 Set the AS_HOME variable to the location where GlassFish is installed, as described in the
README.txt file in this directory.
4 From the copyv3 directory, execute the Ant command that will copy the keystore and truststore
files to the appropriate location, and import the appropriate certificates into the GlassFish
keystore and truststore.
This Ant command is as follows:
as-install/lib/ant/bin/ant
The command window will echo back the certificates that are being added to the keystore and
truststore files, and should look something like this:
a. Change to the directory containing the GlassFish keystore and truststore files,
as-install/domains/domain1/config.
b. Verify that the v3 certificate has been imported into the GlassFish truststore. To do this, run
the following keytool command (all on one line):
java-home/bin/keytool -list -keystore cacerts.jks -alias wssip
-storepass changeit
If the certificates are successfully updated, your response will look something like this:
If the certificates were not successfully update, your response will look something like this:
c. Verify that the v3 certificate has been imported into the GlassFish keystore. To do this, run
the following keytool commands:
java-home/bin/keytool -list -keystore keystore.jks
-alias xws-security-server -storepass changeit
java-home/bin/keytool -list -keystore keystore.jks
-alias xws-security-client -storepass changeit
If the certificates were successfully updated, your response should look something like this:
If your certificates were not successfully updated, your response will look more like this:
The configuration of the aliases for applications that use a Security Token Service (STS)
mechanism is as shown in Table 7–4.
1 In NetBeans IDE, right-click the web service, select Edit Web Service Attributes.
2 Right-click the web service and select Edit Web Service Attributes.
The Web Service Attributes editor is displayed.
6 Click the Keystore button. The dialog shown in Figure 7–5 displays.
7 Depending on what is required for the selected mechanism, you may specify the following
information in the Keystore Configuration dialog:
■ Keystore Password: Specifies the password for the keystore file. If you are running under
GlassFish, GlassFish’s password is already entered. If you have changed the keystore’s
password from the default, you must specify the correct value in this field.
■ Load Aliases: Click the Load Aliases button to populate the Alias field with the aliases
contained in the keystore file. The Location and Store Password fields must be specified
correctly for this option to work.
■ Alias: Specifies the alias of the certificate in the specified keystore to be used for
authentication. Refer to the table in “Specifying Aliases with the Updated Stores” on page 91
to determine which alias to choose for the selected security mechanism.
■ Key Password: Specifies the password of the key within the keystore. For this sample, leave
this blank. For this field, the default assumes the key password is the same as the store
password, so you only need to specify this field when the key password is different.
Note – The Key Password field enables you to specify a password for the keystore used by the
application. When specified, this password is stored in a WSIT configuration file in clear text,
which is a security risk. Setting the keystore password in the development environment is fine,
however, when you go into production, remember to use the container’s Callback Handler to
obtain the keys from the keystore. This eliminates the need for the keystore passwords to be
supplied by the users. You can also specify the passwords for keystores and truststores by
specifying a Callback Handler class that implements the
javax.security.auth.callback.CallbackHandler interface in the Key Password or Store
Password fields.
When creating JSR-109-compliant application, GlassFish will only use the default
CallbackHandlers and Validators, and you cannot override the location of the keystore and
truststore files. Any attempt to override the default location will be ignored. You do, however,
need to specify the keystore and truststore locations in these dialogs in order to specify the alias.
When creating non-JSR-109-compliant application, you can specify the passwords for
keystores and truststores by specifying a CallbackHandler class that implements the
javax.security.auth.callback.CallbackHandler interface in the Key Password or Store
Password fields.
1 In NetBeans IDE, right-click the web service, select Edit Web Service Attributes.
The truststore contains the Certificate Authority (CA) certificates and the certificates of the
other party to which this entity intends to send encrypted (confidential) data. This file must
contain the public key certificates of the CA and the client’s public key certificate. Any kind of
encryption without WS-SecureConversation will generally require that a truststore be
configured on the client side. Any kind of signature without WS-SecureConversation will
generally require a truststore on the server side.
Note – For this release, place the trusted certificates of other parties in GlassFish’s truststore,
cacerts.jks. This is not normally a recommended practice because any certificate you add to
the cacerts.jks file effectively means it can be a trusted root for any and all certificate chains,
which can be a security problem. In future releases, trusted certificates from other parties will be
placed in a certstore, and only trusted roots will be placed inside cacerts.jks.
To set the truststore configuration options on a service, perform the following steps.
2 Right-click the web service and select Edit Web Service Attributes.
The Web Service Attributes editor is displayed.
■ Location: By default, the location and name of the truststore that stores the public key
certificates of the CA and the client’s public key certificate is already entered. The GlassFish
truststore file is as-install/domains/domain1/config/cacerts.jks.
■ Store Password: Specifies the password for the truststore. If you are using GlassFish, the
value of changeit is already entered. If you have changed the value of the truststore
password, you must type the new value in this field.
Note – The Store Password field enables you to specify a password for the truststore used by
the application. When specified, this password is stored in a WSIT configuration file in clear
text, which is a security risk. Setting the truststore password in the development
environment is fine, however, when you go into production, remember to use the
container’s Callback Handler to obtain the keys from the truststore. This eliminates the need
for the truststore passwords to be supplied by the users. You can also specify the passwords
for keystores and truststores by specifying a CallbackHandler class that implements the
javax.security.auth.callback.CallbackHandler interface in the Key Password or Store
Password fields.
When creating JSR-109-compliant application, GlassFish will only use the default
CallbackHandlers and Validators, and you cannot override the location of the keystore and
truststore files. Any attempt to override the default location will be ignored. You do,
however, need to specify the keystore and truststore locations in these dialogs in order to
specify the alias.
■ Load Aliases: Click the Load Aliases button to populate the Alias field with the aliases
contained in the truststore file. The Location and Store Password fields must be specified
correctly for this option to work.
■ Alias: Specifies the peer alias of the certificate in the truststore that is to be used when the
client needs to send encrypted data. Refer to the table in “Specifying Aliases with the
Updated Stores” on page 91 to determine which alias is appropriate for the selected security
mechanism. A truststore contains trusted other-party certificates and certificates of
Certificate Authorities (CA). A peer alias is the alias of the other party (peer) that the
sending party needs to use to encrypt the request.
2 In the Projects window, expand the node for the web service client.
4 Right-click the node for the web service reference for which you want to configure security
options.
Tip – You can simply select Use Development Defaults, and then OK, to use the default values
for the keystore and truststore. Otherwise, continue with these steps.
6 Click Keystore or Truststore to specify the keystore or truststore information if required by the
service.
7 Depending on what is required for the selected mechanism, you may specify the following
information:
■ Keystore Location: The directory and file name containing the certificate key to be used to
authenticate the client. By default, the location is already set to the default GlassFish
keystore, as-install/domains/domain1/config/keystore.jks.
■ Keystore Password: The password for the keystore used by the client. By default, the
password for the GlassFish keystore is already entered. This password is changeit.
Note – When specified, this password is stored in a WSIT configuration file in clear text.
Setting the keystore password in the development environment is fine, however, when you
go into production, remember to use the container’s default CallbackHandler to obtain the
keys from the keystore. This eliminates the need for the keystore passwords to be supplied
by the users. You can also specify the passwords for keystores and truststores by specifying a
CallbackHandler class that implements the
javax.security.auth.callback.CallbackHandler interface in the Keystore Password,
Truststore Password, or Key Password fields.
■ Load Aliases: Click this button to populate the Alias list with all of the certificates available
in the selected keystore. This option will only work if the keystore location and password are
correct.
■ Keystore Alias: Select the alias in the keystore. Refer to the table in “Specifying Aliases with
the Updated Stores” on page 91 to determine which alias is appropriate for the selected
security mechanism.
■ Key Password: If the client key has been password-protected, type the password for this key.
The GlassFish certificate key password is changeit.
■ Truststore Location: The directory and file name of the client truststore containing the
certificate of the server. By default, this field points to the default GlassFish truststore,
as-install/domains/domain1/config/cacerts.jks.
■ Truststore Password: The password for the truststore used by the client. By default, the
password for the GlassFish truststore is already specified. The password is changeit.
Note – When specified, this password is stored in a WSIT configuration file in clear text.
Setting the truststore password in the development environment is fine; however, when you
go into production, remember to use the container’s default CallbackHandler to obtain the
keys from the keystore. This eliminates the need for the keystore passwords to be supplied
by the users. You can also specify the passwords for keystores and truststores by specifying a
CallbackHandler class that implements the
javax.security.auth.callback.CallbackHandler interface in the Keystore Password,
Truststore Password, or Key Password fields.
■ Load Aliases: Click this button to populate the Alias list with all of the certificates available
in the selected keystore. This option will only work if the truststore location and password
are correct.
■ Truststore Alias: Select the alias of the server certificate and private key in the client
truststore. Refer to the table in “Specifying Aliases with the Updated Stores” on page 91 to
determine which alias is appropriate for the selected security mechanism.
Configuring Validators
A validator is an optional set of classes used to check the validity of a token, a certificate, a
timestamp, or a username and password. The Validators button will be enabled when all of the
following are true:
■ Security is enabled for the service.
■ Target server for the service is not GlassFish.
■ Development defaults are disabled.
■ Security profile for the service is not one of the three STS based profiles.
Applications that run under a GlassFish 9.1 or higher container do not need to configure
Callback Handlers and Validators when using the IDE with WSIT enabled. This is because the
container handles the callbacks and validation. You only need to make sure that the certificates
are available at locations that GlassFish requires and/or create authorized users using the
Admin Console (described in “Adding Users to GlassFish” on page 86.
Validators are always optional because there are defaults in the runtime (regardless of the
container and regardless of whether the application is a JSR-109 or a non-JSR-109 deployment.)
For non-JSR-109 deployment, you only need to specify a validator when you want to override
the default validators. For JSR-109 deployments, there is no point in specifying an overriding
validator, as these will be overridden back to the defaults by GlassFish, thus the Validators
button is not available when the selected web service is a JSR-109-compliant application.
1 Right-click the web service and select Edit Web Service Attributes.
The Web Service Attributes editor is displayed.
5 On the Validator Configuration page, specify the following options, when necessary:
■ Username Validator: Specifies the validator class to be used to validate username and
password on the server side. This option is only used by a web service.
Note – When using the default Username Validator, make sure that the username and
password of the client are registered with GlassFish (using Admin Console, described in
“Adding Users to GlassFish” on page 86) if using GlassFish, or is included in the
tomcat-users.xml file if using Tomcat.
■ Timestamp Validator: Specifies the validator class to be used to check the token timestamp
to determine whether the token has expired or is still valid.
■ Certificate Validator: Specifies the validator class to be used to validate the certificate
supplied by the client or the web service.
■ SAML Validator: Specifies the validator class to be used to validate SAML token supplied by
the client or the web service.
4 Expand the operationOperation node (for example, the add Operation node.) It should look like
Figure 7–6.
6 Select an option from the Transactions list to specify a level at which transactions will be
secured.
For this release, transactions will only use SSL for security. Transactions are discussed in
Chapter 12, “Using Atomic Transactions.”
9 For the Input Message and/or Output Message, click the Message Parts button to specify which
parts of the message need to be encrypted, signed, and/or required.
See the following section for more information on the options in the Message Parts dialog.
The Message Parts dialog appears. It should look like Figure 7–7.
10 Click in a checkbox to the right of the message part or element that you would like to sign,
encrypt or require.
■ Select Sign to specify the parts or elements of a message that require integrity protection
(digital signature).
■ Select Encrypt to specify the parts or elements of a message that require confidentiality
(encryption).
■ Select Require to specify the set of parts and/or elements that a message must contain.
12 Click Add Header to add a row for either a specific SOAP header part or for all SOAP header parts.
This will only be necessary if the SOAP header row in question has been deleted. The header
parts that are available to sign and/or encrypt before clicking the Add Header button include To
(Addressing), From (Addressing), FaultTo (Addressing), ReplyTo (Addressing), MessageID
(Addressing), RelatesTo (Addressing), and Action (Addressing). After clicking Add Header,
and then clicking All Headers, you may also specify AckRequested (RM),
SequenceAcknowledgement (RM), and Sequence (RM).
13 There are no XPath elements displayed by default. Click Add XPath to add rows that enable you
to specify signature and/or encryption for an XPath expression or a URI which indicates the
version of XPath to use.
By default, the Required field is selected. This is an editable field. Double-click the XPath row to
specify the XPath expression or URI. Only one XPath element is allowed.
Note – There is a limitation when specifying XPath elements. To use XPath elements, switch off
Optimize Security manually by adding the disableStreamingSecurity policy assertion. For
information on how to do this, refer to http://blogs.sun.com/venu/ for more information
on disableStreamingSecurity.
14 To remove an element, select it in the Message Part section, and then click Remove to remove it
from message security.
The issued token security model includes a target server, a client, and a trusted third party called
a Security Token Service (STS). Policy flows from server to client, and from STS to client. Policy
may be embedded inside an issued token assertion, or acquired out-of-hand. There may be an
explicit trust relationship between the server and the STS. There must be a trust relationship
between the client and the STS.
When the web service being referenced by the client uses any of the STS security mechanisms
(refer to tables in “Summary of Service-Side Configuration Requirements” on page 69 smf
“Summary of Client-Side Configuration Requirements” on page 70), an STS must be specified.
You can specify the STS in the following ways.
■ On the service side, specify the endpoint of the Issuer element and/or specify the Issuer
Metadata Exchange (Mex) address of the STS.
If you need to create a third-party STS, follow the steps in “To Create a Third-Party STS” on
page 105.
If you already have an STS that you want to use, follow the steps in “To Specify an STS on the
Service Side” on page 108.
An example that creates and uses an STS can be found in “Example: STS Issued Token
(STS)” on page 126.
■ On the client side, specify the information for a preconfigured STS. This is mainly used for a
local STS that is in the same domain as the client. Configuring the STS for the client is
described in “To Specify an STS on the Client Side” on page 109.
4 Right-click the STS Project, and select New, then select Other.
6 Select Secure Token Service (STS) from the File Type(s) list.
7 Click Next.
10 Click Finish.
The IDE takes a while to create the STS. When created, it appears under the project’s Web
Services node as your_STSService, and the Java file appears in the right pane.
12 Back in the Projects window, expand the STS project folder, expand the Web Services node,
right-click on the web service, and select Edit Web Service Attributes to configure the STS.
14 Select a Security Mechanism that is NOT one of the STS mechanisms. The example application
uses Username Authentication with Symmetric Key.
15 Select the Configure button. For the Algorithm Suite option, specify a value that matches the
value of the web service. Set the Key Size to 128 if you have not configured Unlimited Strength
Encryption. Select OK to close the configuration dialog.
Note – Some of the algorithm suite settings require that Unlimited Strength Encryption be
configured in the Java Runtime Environment (JRE), particularly the algorithm suites that use
256 bit encryption. Instructions for downloading and configuring unlimited strength
encryption can be found at the following URLS:
http://java.sun.com/products/jce/javase.html
http://java.sun.com/javase/downloads/index_jdk5.jsp#docs
Optionally, you can change the following configuration options by clicking the Configure
button:
■ Issuer: Specify an identifier for the issuer for the issued token. This value can be any string
that uniquely identifies the STS, for example, MySTS.
■ Contract Implementation Class: Specify the actual implementation class for the
WSTrustContract interface that will handle token issuance, validation, and the like. Default
value is com.sun.xml.ws.trust.impl.IssueSamlTokenContractImpl for issuing SAML
assertions, or click Browse to browse to another contract implementation class.
■ Life Time of Issued Tokens: The life span of the token issued by the STS. Default value is
300,000 ms.
■ Encrypt Issued Key: Select this option if the issued key should be encrypted using the
service certificate. Default is true.
■ Encrypt Issued Token: Select this option if the issued token should be encrypted using the
service certificate. Default is false.
Optionally, to add one or more Service Providers that have a trust relationship with the STS,
click the Add button, and specify the following configuration options:
■ Provider Endpoint URI: The endpoint URI of the service provider.
■ Certificate Alias: The alias of the certificate of the service provider in the keystore.
■ Token Type: The type of token the service provider requires, for example,
urn:oasis:names:tc:SAML1.0:assertion.
■ Key Type: The type of key the service provider requires. The choices are public key or
symmetric key. Symmetric key cryptography relies on a shared secret and is usually faster
than public key cryptography. Public key cryptography relies on a key that is made public to
all and is primarily used for encryption but can be used for verifying signatures.
20 Right-click the STS Project and select Properties. Select the Run category, and type the
following in the Relative URL field: /your_STSService?wsdl.
21 Run the Project (right-click the Project and select Run). The STS WSDL displays in a browser
window.
The STS itself is secured using a separate (non-STS) security mechanism. The security
configuration of the client-side of this application is dependent upon the security mechanism
selected for the STS, and not on the security mechanism selected for the application.
1 Right-click the node for the web service you want to secure.
7 Set the Algorithm Suite value so that the algorithm suite value of the service matches the
algorithm suite value of the STS. Select 128 if you have not installed Unlimited Strength
Encryption.
9 Click OK.
A new file is added to the project. To view the WSIT configuration file, expand Web
Pages→WEB-INF, then double-click the file wsit-package-name.service-name.xml and select
the Source page.
10 Right-click the project node and select Run to compile the application and deploy it onto
GlassFish. A browser will open and display the WSDL file for the application.
1 In the Projects window, expand the node for the web services client.
3 Right-click the node for the web service reference for which you want to configure security
options.
5 When the Web Service References Attributes Editor is opened, select the Quality of Service tab.
6 Provide the client’s private key by pointing to an alias in the keystore. For development
purposes, click the Keystore button, click the Load Aliases button, and select
xws-security-client from the Alias list.
7 Provide the service’s certificate by pointing to an alias in the client truststore. For development
purposes, click the Truststore button,, click the Load Aliases button for the truststore and select
xws-security-server from the Alias list.
■ In some instances, NetBeans will not detect that this client is a JSR-196 client, and thus will
require that the keystore and truststore entries be manually configured. To do this, follow
the steps in this section.
■ Double-click <service-project>..xml to open it in the Source window. Click the Source tab to
view the code. Find the sc:KeyStore and sc:TrustStore elements. If these elements
contain parameters for location and storepass, then just continue to the next section. If not,
add these attributes to this file. The following code shows an example of how these
elements could be specified.
<sc:TrustStore wspp:visibility="private"
location="<GF_HOME>\glassfish\domains\domain1\config\cacerts.jks"
storepass="changeit" peeralias="xws-security-server"/>
<sc:KeyStore wspp:visibility="private"
location="<GF_HOME>\glassfish\domains\domain1\config\cacerts.jks"
storepass="changeit" alias="xws-security-client"/>
8 Expand the Security Token Service node to provide details for the STS to be used. When the
Endpoint and the Metadata values are the same, you only need to enter the Endpoint value. For
the example application you would enter the following value in the Endpoint field:
http://localhost:8080/MySTSProject/MySTSService.
The Endpoint field is a mandatory field. Depending on how you plan to configure the STS, you
can provide either Metadata information or information regarding the WSDL Location, Service
Name, Port Name and Namespace. The examples following this section describe a few potential
STS configurations.
10 The service requires a token to be issued from the STS, which, for the example, is
http://localhost:8080/MySTSProject/MySTSService, with WSDL file
http://localhost:8080/MySTSProject/MySTSService?wsdl. To do this, follow these steps:
a. Right-click the web service client project node and select New→Web Service Client.
The New Web Service Client window appears.
c. Cut and paste the URL of the web service that you want the client to consume into the WSDL
URL field. For the tutorial example, the URL for the MySTS web servicen is:
http://localhost:8080/MySTSProject/MySTSService?wsdl
d. Type the package name, for example, org.me.calculator.client.sts, into the Package
field, then click Finish.
The Projects window displays the new web service client.
11 Drill down from the web service client project node to the Web Service References node.
12 Right-click the node for the STS service, and select Edit Web Service Attributes.
14 Provide the client’s private key by pointing to an alias in the keystore. For development
purposes, click the Keystore button, click the Load Aliases button, and select
xws-security-client from the Alias list.
15 Verify the STS’s certificate by pointing to an alias in the client truststore. For development
purposes, click the Truststore button,, click the Load Aliases button and select wssip from the
Alias list.
■ In some instances, NetBeans will not detect that this client is a JSR-196 client, and thus will
require that the keystore and truststore entries be manually configured. To do this, follow
the steps in this section.
■ Expand the web services client project node, then Source Packages→META-INF.
■ Double-click <sts-service>.xml to open it in the Source window. Click the Source tab to view
the code. Find the sc:KeyStore and sc:TrustStore elements. If these elements contain
parameters for location and storepass, then just continue to the next section. If not, add
these attributes to this file. The following code shows an example of how these elements
could be specified.
<sc:TrustStore wspp:visibility="private"
location="<GF_HOME>\glassfish\domains\domain1\config\cacerts.jks"
storepass="changeit" peeralias="wssip"/>
<sc:KeyStore wspp:visibility="private"
location="<GF_HOME>\glassfish\domains\domain1\config\cacerts.jks"
storepass="changeit" alias="xws-security-client"/>
18 Compile and run this application by right-clicking the web services client project and selecting
Run.
Example 7–2 Endpoint with WSDL Location, Service Name, Port Name, and Namespacei
■ Endpoint: http://131.107.72.15/ Security_Federation_SecurityTokenService_Indigo/
Symmetric.svc/ Scenario_5_IssuedTokenForCertificate_MutualCertificate11
■ WSDL Location: http://131.107.72.15//
Security_Federation_SecurityTokenService_Indigo/ Symmetric.svc?wsdl
■ Service Name: MySTSService
■ Port Name: CustomBinding_IMySTSService
■ Namespace: http://tempuri.org/
Example Applications
The following example applications demonstrate configuring web services and web service
clients for different security mechanisms. If you are going to work through the examples
sequentially, you must manually undo the changes to the service and then refresh the client in
order for the client to receive the most recent version of the service’s WSDL file, which contains
the latest security configuration information.
■ “Example: Username Authentication with Symmetric Key (UA)” on page 112
■ “Example: Mutual Certificates Security (MCS)” on page 114
■ “Example: Transport Security (SSL)” on page 116
■ “Example: SAML Authorization over SSL (SA)” on page 119
■ “Example: SAML Sender Vouches with Certificates (SV)” on page 123
■ “Example: STS Issued Token (STS)” on page 126
■ “Example: Kerberos Token (Kerb)” on page 132
For this example, the security mechanism of “Username Authentication with Symmetric Key”
on page 77 is used to secure the application. To add security to the service part of the example,
follow these steps.
1 Create the CalculatorApplication example by following the steps described in the following
sections of Chapter 3,“WSIT Example Using a Web Container and NetBeans IDE.”
c. “Deploying and Testing a Web Service”on page 44 (first two steps only, do not run the
project yet)
2 Expand CalculatorApplication→Web Services, then right-click the node for the web service
(CalculatorWS) and select Edit Web Service Attributes.
5 From the drop-down list for Security Mechanism, select Username Authentication with
Symmetric Key.
6 Select Use Development Defaults to set up the keystore and truststore files, and to create a user
for this application, if needed.
8 Right-click the CalculatorApplication node and select Run. A browser will open and display the
WSDL file for the application.
9 Follow the steps to secure the client application as described in “To Secure the Example Web
Service Client Application (UA)”on page 113.
1 Create the client application by following the steps described in “Creating a Client to Consume a
WSIT-Enabled Web Service”on page 45.
Note – Whenever you make changes on the service, refresh the client so that the client will pick
up the change. To refresh the client, right-click the node for the Web Service Reference for the
client, and select Refresh Client.
2 Expand the node for the web service client application, CalculatorWSServletClient.
5 In the Security section of the Quality of Service tab, select Use Development Defaults. Click OK
to close.
Note – By default, the user name of wsitUser and the password of changeit will be entered in this
section. If the example doesn't run, make sure that you have a user with this name and password
set up in the file realm of the Application Server or GlassFish, as described in “Adding Users to
GlassFish” on page 86.
6 If you'd like to, in the tree, drill down from the project to Source Packages→META-INF.
Double-click on CalculatorWSService.xml, and verify that lines similar to the following are
present:
<wsp:All>
<sc:TrustStore wspp:visibility="private"
location="<GF_HOME>\glassfish\domains\domain1\config\cacerts.jks"
storepass="changeit" peeralias="xws-security-server"/>
<sc:CallbackHandlerConfiguration wspp:visibility="private">
<sc:CallbackHandler default="wsitUser" name="usernameHandler"/>
<sc:CallbackHandler default="changeit" name="passwordHandler"/>
</sc:CallbackHandlerConfiguration>
</wsp:All>
By selecting Use Development Defaults when securing the service, these values are
automatically generated for you.
An example of this file can be viewed in the tutorial by clicking this link: “Client-Side WSIT
Configuration Files” on page 142.
7 Right-click the CalculatorWSServletClient node and select Run. The result of the add operation
will display in a browser window.
For this example, the security mechanism of “Mutual Certificates Security” on page 77 is used to
secure the application. To add security to the service part of the example, follow these steps.
1 Create the CalculatorApplication example by following the steps described in the following
sections of Chapter 3,“WSIT Example Using a Web Container and NetBeans IDE.”
c. “Deploying and Testing a Web Service”on page 44 (first two steps only, do not run the
project yet)
2 Expand CalculatorApplication→Web Services, then right-click the node for the web service,
CalculatorWS, and select Edit Web Service Attributes.
5 From the drop-down list for Security Mechanism, select Mutual Certificates Security.
10 Follow the steps to secure the client application as described in “To Secure the Example Web
Service Client Application (MCS)”on page 115.
To add security to the client that references this web service, complete the following steps.
1 Create the client application following the steps described in “Creating a Client to Consume a
WSIT-Enabled Web Service”on page 45.
Note – Whenever you make changes on the service, refresh the client so that the client will pick
up the change. To refresh the client, right-click the node for the Web Service Reference for the
client, and select Refresh Client.
2 If you'd like, in the tree, drill down from the project to Source Packages→META-INF.
Double-click on CalculatorWSService.xml, click the Source tab, and look at the section in the
section <wsp:All> to see the WSIT code that has been added to this configuration file.
3 Compile and run this application by right-clicking the CalculatorWSServletClient node and
selecting Run. The result of the add operation will display in a browser window.
For this example, the security mechanism of “Transport Security (SSL)” on page 77 is used to
secure the application. To add security to the service part of the example, follow these steps.
1 Create the CalculatorApplication example by following the steps described in the following
sections of Chapter 3,“WSIT Example Using a Web Container and NetBeans IDE,”:
c. “Deploying and Testing a Web Service”on page 44 (first two steps only, do not run the
project yet)
2 Expand CalculatorApplication→Web Services, then right-click the node for the web service,
CalculatorWS, and select Edit Web Service Attributes.
5 From the drop-down list for Security Mechanism, select Transport Security (SSL).
8 To require the service to use the HTTPS protocol, security requirements must be specified in the
service’s application deployment descriptor, which is web.xml for a web service implemented as
a servlet. Selecting Use Development Defaults takes care of this task for you.
To view or change the security information, follow these steps:
e. A Web Resource Collection named Secure Area contains the URL Pattern to be protected,
/CalculatorWSService//* and the HTTP Methods to be protected, , POST.
g. The Enable User Data Constraint box is checked and CONFIDENTIAL is chosen as the
Transport Guarantee to specify that the application uses SSL.
h. Click the XML tab to view the resulting deployment descriptor additions.
9 Right-click the CalculatorApplication node and select Run. If the server presents its certificate,
s1as, accept this certificate. A browser will open and display the WSDL file for the application.
10 Follow the steps to secure the client application as described in “To Secure the Example Web
Service Client Application (SSL)”on page 118.
To add security to the client that references this web service, complete the following steps.
1 Create the client application by following the steps described in “Creating a Client to Consume a
WSIT-Enabled Web Service”on page 45, with the exception that you need to specify the secure
WSDL when creating the Web Service Client.
To do this, create the client application up to the step where you create the Servlet (step 7 as of
this writing) by following the steps described in “Creating a Client to Consume a
WSIT-Enabled Web Service” on page 45, with the following exception.
In the step where you are directed to cut and paste the URL of the web service that you want the
client to consume into the WSDL URL field, type
https://fully-qualified-hostname:8181/CalculatorApplication/CalculatorWSService?
wsdl (changes indicated in bold) to indicate that this client should reference the web service
using the secure port. The first time you access this service, accept the certificate (s1as) when
you are prompted. This is the server certificate popping up to confirm its identity to the client.
In some cases, you might get an error dialog telling you that the URL
https://fully-qualified-hostname:8181/CalculatorApplication/CalculatorWSService?
wsdl couldn’t be downloaded. However, this the correct URL, and it does load when you run
the service. So, when this error occurs, repeat the steps that create the Web Service Client using
the secure WSDL. The second time, the web service reference is created and you can continue
creating the client.
Note – If you prefer to use localhost in place of the fully-qualified hostname (FQHN) in this
example, you must follow the steps in “Transport Security (SSL) Workaround” on page 78.
2 Continue creating the client following the remainder of the instructions in “Creating a Client to
Consume a WSIT-Enabled Web Service”on page 45.
Note – Some users are working through this document and just making the recommended
changes and refreshing the client. For this example, you must create a new client so that you can
specify the secure WSDL to create the correct setup for the client.
Whenever you make changes on the service, refresh the client so that the client will pick up the
change. To refresh the client, right-click the node for the Web Service Reference for the client,
and select Refresh Client.
3 Compile and run this application by right-clicking on the CalculatorWSServletClient node and
selecting Run. The result of the add operation will display in a browser window.
1 Create the CalculatorApplication example by following the steps described in the following
sections of Chapter 3,“WSIT Example Using a Web Container and NetBeans IDE,”:
c. “Deploying and Testing a Web Service”on page 44 (first two steps only, do not run the
project yet)
2 Expand CalculatorApplication→Web Services, right-click the node for the web service,
CalculatorWS, and select Edit Web Service Attributes.
5 From the drop-down list for Security Mechanism, select SAML Authorization over SSL.
6 Select Use Development Defaults to have the web.xml file modified to include a security
constraint that forces the use of SSL.
8 To require the service to use the HTTPS protocol, security requirements must be specified in the
service’s application deployment descriptor, which is web.xml for a web service implemented as
a servlet. Selecting Use Development Defaults takes care of this task for you.
To view or change the security information in the deployment descriptor, follow these steps:
e. A Web Resource Collection named Secure Area contains the URL Pattern to be protected,
/CalculatorWSService//* and the HTTP Methods to be protected, , POST.
g. The Enable User Data Constraint box is checked and CONFIDENTIAL is chosen as the
Transport Guarantee to specify that the application uses SSL.
h. Click the XML tab to view the resulting deployment descriptor additions.
9 Right-click the CalculatorApplication node and select Run. Accept the s1as certificate if you are
prompted to. A browser will open and display the WSDL file for the application.
10 Follow the steps to secure the client application as described in “To Secure the Example Web
Service Client Application (SA)”on page 120.
To add security to the client that references this web service, complete the following steps.
1 This example uses a non-JSR-109-compliant client for variety. To do this, create the client
application up to the step where you create the Servlet (step 7 as of this writing) by following
the steps described in “Creating a Client to Consume a WSIT-Enabled Web Service”on page 45,
with the following exceptions:
a. In the step where you are directed to cut and paste the URL of the web service that you want
the client to consume into the WSDL URL field, type
https://fully-qualified-hostname:8181/CalculatorApplication/CalculatorWSService?wsdl,
to indicate that this client should reference the web service using the secure port.
The first time you access this service, accept the certificate (s1as) when you are prompted.
This is the server certificate popping up to confirm its identity to the client.
In some cases, you might get an error dialog telling you that the URL
https://fully-qualified-hostname:8181/CalculatorApplication/CalculatorWSService?wsdl
couldn’t be downloaded. However, this the correct URL, and it does load when you run the
service. So, when this error occurs, repeat the steps that create the Web Service Client using
the secure WSDL. The second time, the web service reference is created and you can
continue creating the client.
Note – If you prefer to use localhost in place of the fully-qualified hostname (FQHN) in this
example, follow the steps in “Transport Security (SSL) Workaround” on page 78.
a. If the index.jsp file is not open in the right pane, expand Web Pages, then double-click
index.jsp to open it.
b. Drill down through the Web Service References node until you get to the add operation.
c. Drag the add operation to the line immediately following the following line:
<body>
3 Write a SAMLCallback handler for the client side to populate a SAML assertion into the client’s
request to the service.
To create the SAMLCallbackHandler, follow these steps:
g. From the File Types list, select Empty Java File and click Next.
k. Modify the home variable to provide the hard-coded path to your GlassFish installation.
For example, modify the line:
String home = System.getProperty("WSIT_HOME");
to
l. Copy the contents of this file into the SamlCallbackHandler.java window that is displaying
in the IDE.
8 Enter the name of the SAML Callback Handler written earlier in this section,
xwss.saml.SamlCallbackHandler, into the SAML Callback Handler field.
10 To view the WSIT Configuration options, in the tree, drill down from the project to Source
Packages→META-INF. Double-click CalculatorWSService.xml, click the Source tab, and look
for the lines where xwss.saml.SamlCallbackHandler is specified as the SAML Callback Handler
class for the client.
11 Compile and run this application by right-clicking the CalculatorClient node and selecting Run.
The result of the add operation will display in a browser window.
For this example, the security mechanism of “SAML Sender Vouches with Certificates” on
page 80 is used to secure the application. The steps are similar to the ones described in
“Example: Username Authentication with Symmetric Key (UA)” on page 112, with the addition
of the writing of a client-side SAML callback handler to populate the client’s request with a
SAML assertion.
To add security to the service part of the example, follow these steps.
1 Create the CalculatorApplication example by following the steps described in the following
sections of Chapter 3,“WSIT Example Using a Web Container and NetBeans IDE,”:
c. “Deploying and Testing a Web Service”on page 44 (first two steps only, do not run the
project yet)
2 Expand CalculatorApplication→Web Services, then right-click the node for the web service,
CalculatorWS, and select Edit Web Service Attributes.
5 From the drop-down list for Security Mechanism, select SAML Sender Vouches with Certificates.
6 Select Use Development Defaults. This step properly configures the keystore, truststore, and
default user for this security mechanism.
7 Click OK.
A new file is added to the project. To view the WSIT configuration file, expand Web
Pages→WEB-INF, then double-click the file wsit-org.me.calculator.CalculatorWS.xml.
This file contains the security elements within wsp:Policy tags.
8 Right-click the CalculatorApplication node and select Run. Accept the s1as certificate if you are
prompted to.
A browser will open and display the WSDL file for the application.
9 Follow the steps to secure the client application as described in “To Secure the Example Web
Service Client Application (SV)”on page 124.
To add security to the client that references this web service, complete the following steps.
1 This example uses a non-JSR-109-compliant client. To do this, create the client application up to
the step where you create the Servlet (step 7 as of this writing) by following the steps described
in “Creating a Client to Consume a WSIT-Enabled Web Service”on page 45, with one exception:
name the application CalculatorClient (since it’s not a servlet.).
a. If the index.jsp file is not open in the right pane, double-click it to open it.
b. Drill down through the Web Service References node until you get to the add operation.
c. Drag the add operation to the line immediately following the following line:
<body>
3 Write a SAMLCallback handler for the client side to populate a SAML assertion into the client’s
request to the service.
To create the SAMLCallbackHandler, follow these steps:
g. From the File Types list, select Empty Java File and click Next.
k. Modify the home variable to provide the hard-coded path to your GlassFish installation.
For example, modify the line:
String home = System.getProperty("WSIT_HOME");
to
l. Copy the contents of this file into the SamlCallbackHandler.java window that is displaying
in the IDE.
7 In the SAML Callback Handler field, type the name of the class written in step 3 above,
xwss.saml.SamlCallbackHandler.
9 In the tree, drill down from the project to Source Packages→META-INF. Double-click
CalculatorWSService.xml, click the Source tab, and look for that lines where
xwss.saml.SamlCallbackHandler is specified as the SAML Callback Handler class for the client.
In some instances, NetBeans will not correctly specify the keystore and truststore information
for non-JSR-196 clients, and thus will require that the keystore and truststore entries be
manually configured. To do this, follow the example in this section.
■ Find the sc:KeyStore and sc:TrustStore elements. If these elements contain parameters
for location and storepass, then just continue to the next step. If not, replace the existing
keystore and truststore attributes to include these parameters. The following code shows an
example of how these elements should be specified.
<sc:TrustStore wspp:visibility="private"
location="<GF_HOME>\glassfish\domains\domain1\config\cacerts.jks"
storepass="changeit" peeralias="xws-security-server"/>
<sc:KeyStore wspp:visibility="private"
location="<GF_HOME>\glassfish\domains\domain1\config\keystore.jks"
storepass="changeit" alias="xws-security-client"/>
10 Compile and run this application by right-clicking the CalculatorClient node and selecting Run.
The result of the add operation will display in a browser window.
6 Select Secure Token Service (STS) from the File Type(s) list, then click Next.
7 Type the name MySTS for the Web Service Class Name.
8 Enter or select org.me.my.sts in the Package field, then click Finish. If prompted to reload the
catalog.xml file, click No.
The IDE takes a while to create the STS. When created, it appears under the project’s Web
Services node as MySTSService.
9 The STS wizard creates an implementation of the provider class. To view it, expand Source
Packages, then org.me.my.sts. Double-click MySTS.java to open it in the right pane.
10 In the Projects window, expand the MySTSProject node, then expand the Web Services node.
Right-click the MySTSService[IMySTSService_Port] node and select Edit Web Service Attributes
to configure the STS.
12 Verify that the Security Mechanism of Username Authentication with Symmetric Key is selected.
13 Select the Configure button. For Algorithm Suite, verify that Basic128 bit is selected (so that it
matches the value selected for the service.) Select OK to close the configuration dialog.
Note – If you'd like to use an STS other than the default, click the STS Configure button, and
click the Add button to add a different service provider. Click OK to close the STS
Configuration dialog.
16 Click the Keystore button to provide your keystore with the alias identifying the service
certificate and private key. To do this, click the Load Aliases button, select wssip, then click OK to
close the dialog.
17 Click OK.
A new file is added to the project. To view the WSIT configuration file, expand Configuration
Files→xml-resources→web-services→MySTS→wsdl, then double-click the file
MySTSService.wsdl. This file contains the tc:STSConfiguration element within the
wsp:Policy elements..
18 Right-click the MySTSProject tab, select Properties. Select the Run category, and type the
following in the Relative URL field: /MySTSService?wsdl.
Next Steps Follow the steps to secure the service application as described in “To Secure the Example
Service Application (STS)” on page 128.
For this example, the security mechanism of “STS Issued Token” on page 81 is used to secure
the application. The steps are similar to the ones described in “Example: Username
Authentication with Symmetric Key (UA)” on page 112, with the addition of creating and
securing an STS.
To add security to the service part of the example, follow these steps.
1 Create the CalculatorApplication example by following the steps described in the following
sections of Chapter 3,“WSIT Example Using a Web Container and NetBeans IDE.”
c. “Deploying and Testing a Web Service”on page 44 (first two steps only, do not run the
project yet).
2 Expand CalculatorApplication→Web Services, then right-click the node for the web service,
CalculatorWS, and select Edit Web Service Attributes.
5 From the drop-down list for Security Mechanism, select STS Issued Token.
6 Click Configure. For Issuer Address and Issuer Metadata Address, enter
http://localhost:8080/MySTSProject/MySTSService.
7 For Algorithm Suite, select Basic 128 bit. For Key Size, select 128 (the algorithm suite value of the
service must match the algorithm suite value of the STS). Select OK to close the configuration
dialog.
Note – If you have configured Unlimited Strength Encryption as described in “To Create a
Third-Party STS” on page 105, you can leave the key size at 256. Otherwise, you must set it to
128.
9 Click OK.
A new file is added to the project. To view the WSIT configuration file, expand Web
Pages→WEB-INF, then double-click the file wsit-org.me.calculator.CalculatorWS.xml
and select the Source page. This file contains the security elements within wsp:Policy tags.
10 Right-click the CalculatorApplication node and select Run. This step compiles the application
and deploys it onto GlassFish. A browser will open and display the WSDL file for the application.
Next Steps Follow the steps for creating and securing the web service client applications as described in “To
Secure the Example Web Service Client Application (STS)” on page 129.
To add security to the web service client, complete the following steps.
1 Create the client application by following the steps described in “Creating a Client to Consume a
WSIT-Enabled Web Service”on page 45.
Note – Whenever you make changes on the service, refresh the client so that the client will pick
up the change. To refresh the client, right-click the node for the Web Service Reference for the
client, and select Refresh Client.
3 Right-click CalculatorWSService and select Edit Web Service Attributes, then select the Quality
of Service tab.
4 Provide the client’s private key by pointing to an alias in the keystore. To do this, click the
Keystore button, click the Load Aliases button, and select xws-security-client from the Alias
list.
5 Provide the service’s certificate by pointing to an alias in the client truststore. To do this, click the
Truststore button,, click the Load Aliases button for the truststore and select
xws-security-server from the Alias list.
■ In some instances, NetBeans will not detect that this client is a JSR-196 client, and thus will
require that the keystore and truststore entries be manually configured. To do this, follow
the steps in this section.
■ Double-click CalculatorWSService.xml to open it in the Source window. Click the Source tab
to view the code. Find the sc:KeyStore and sc:TrustStore elements. If these elements
contain parameters for location and storepass, then just continue to the next section. If not,
add these attributes to this file. The following code shows an example of how these
elements should be specified.
<sc:TrustStore wspp:visibility="private"
location="<GF_HOME>\glassfish\domains\domain1\config\cacerts.jks"
storepass="changeit" peeralias="xws-security-server"/>
<sc:KeyStore wspp:visibility="private"
location="<GF_HOME>\glassfish\domains\domain1\config\keystore.jks"
storepass="changeit" alias="xws-security-client"/>
6 Expand the Security Token Service node to provide details for the STS to be used. When the
Endpoint and the Metadata values are the same, you only need to enter the Endpoint value. For
the Endpoint field, enter the following value:
http://localhost:8080/MySTSProject/MySTSService.
c. Cut and paste the URL of the web service that you want the client to consume into the WSDL
URL field. For this example, here is the URL for the MySTS web service:
http://localhost:8080/MySTSProject/MySTSService?wsdl
12 Provide the client’s private key by pointing to an alias in the keystore. To do this, click the
Keystore button, click the Load Aliases button, and select xws-security-client from the Alias
list. If the Keystore button is not selectable, follow the instructions in the next step for adding
the keystore entry manually.
13 Verify the STS’s certificate by pointing to an alias in the client truststore. To do this, click the
Truststore button,, click the Load Aliases button and select wssip from the Alias list.
■ In some instances, NetBeans will not detect that this client is a JSR-196 client, and thus will
require that the keystore and truststore entries be manually configured. To do this, follow
the steps in this section.
■ Double-click MySTSService.xml to open it in the Source window. Click the Source tab to view
the code. Find the sc:KeyStore and sc:TrustStore elements. If these elements contain
parameters for location and storepass, then just continue to the next section. If not, add
these attributes to this file. The following code shows an example of how these elements
should be specified.
<sc:TrustStore wspp:visibility="private"
location="<GF_HOME>\glassfish\domains\domain1\config\cacerts.jks"
storepass="changeit" peeralias="wssip"/>
<sc:KeyStore wspp:visibility="private"
location="<GF_HOME>\glassfish\domains\domain1\config\keystore.jks"
storepass="changeit" alias="xws-security-client"/>
16 Compile and run this application by right-clicking the CalculatorWSServletClient project and
selecting Run. The result of the add operation will display in a browser window.
For a blog discussing using Kerberos with WSIT, go to Running Kerberos Token Profile
scenario with Metro.
1 Select this link to view a blog describing how to set up Kerberos on your system:
http://blogs.sun.com/ashutosh/entry/running_kerberos_token_profile_scenario.
2 Follow the steps in the section titled Setting Up Kerberos, and the first step in the section titled
Setting up Glassfish and Metro to run Kerberos Scenario.
For this example, a Kerberos token is used to secure the application. To add security to the
service part of the example, follow these steps.
1 Create the CalculatorApplication example by following the steps described in the following
sections of Chapter 3,“WSIT Example Using a Web Container and NetBeans IDE.”
c. “Deploying and Testing a Web Service”on page 44 (first two steps only, do not run the
project yet)
2 Expand CalculatorApplication→Web Services, then right-click the node for the web service
(CalculatorWS) and select Edit Web Service Attributes.
5 From the drop-down list for Security Mechanism, select Username Authentication with
Symmetric Key.
6 Select Use Development Defaults to set up the keystore and truststore files, and to create a user
for this application, if needed.
9 Locate and replace the Binding level policy with the following policy. This section of code has
been formatted to fit the page.
Tip – Make sure that in your version, the section in bold, below, contains no whitespaces or
returns.
Note – Look for the KerberosConfig element, which points to the LoginModule to be used for
this service. Refer to the code provided in step 2 in the section titled Setting Up Glassfish and
Metro to run Kerberos Scenario, from the blog at
http://blogs.sun.com/ashutosh/entry/running_kerberos_token_profile_scenario.
<wsp:Policy wsu:Id="IFinancialService_policy">
<wsp:ExactlyOne>
<wsp:All>
<wsaws:UsingAddressing
xmlns:wsaws="http://www.w3.org/2006/05/addressing/wsdl"/>
<sp:SymmetricBinding>
<wsp:Policy>
<sp:ProtectionToken>
<wsp:Policy>
<sp:KerberosToken
sp:IncludeToken="http://schemas.xmlsoap.org/
ws/2005/07/
securitypolicy/IncludeToken/Once">
<wsp:Policy>
<!--<sp:RequireDerivedKeys />-->
<sp:WssGssKerberosV5ApReqToken11/>
</wsp:Policy>
</sp:KerberosToken>
</wsp:Policy>
</sp:ProtectionToken>
<sp:Layout>
<wsp:Policy>
<sp:Strict/>
</wsp:Policy>
</sp:Layout>
<sp:IncludeTimestamp/>
<sp:OnlySignEntireHeadersAndBody/>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic128/>
</wsp:Policy>
</sp:AlgorithmSuite>
</wsp:Policy>
</sp:SymmetricBinding>
<sp:Wss11>
<wsp:Policy>
<sp:MustSupportRefKeyIdentifier/>
<sp:MustSupportRefIssuerSerial/>
<sp:MustSupportRefThumbprint/>
<sp:MustSupportRefEncryptedKey/>
</wsp:Policy>
</sp:Wss11>
<sc:KerberosConfig xmlns:
sc="http://schemas.sun.com/2006/03/wss/server"
loginModule="KerberosServer"/>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
10 Right-click the CalculatorApplication node and select Run. A browser will open and display the
WSDL file for the application.
If the application doesn't build, expand CalculatorApplication→Web Pages→WEB-INF, and
double-click web.xml to open it in the right pane. Select the Security tab, and remove any
existing security constraints. Then run the project again.
11 Follow the steps to secure the client application as described in “To Secure the Example Web
Service Client Application (Kerb)”on page 135.
To add security to the client that references this web service, complete the following steps.
1 Create the client application by following the steps described in “Creating a Client to Consume a
WSIT-Enabled Web Service”on page 45.
Note – Whenever you make changes on the service, refresh the client so that the client will pick
up the change. To refresh the client, right-click the node for the Web Service Reference for the
client, and select Refresh Client.
Note – Because you are creating your web service client starting from a WSDL file, and because
the WSDL file already contains the Kerberos Profile, no further configuration is required.
Because of the missing tooling for specifying Kerberos Token Profile, do not configure any
WSIT configuration details using NetBeans IDE.
3 Right-click the CalculatorWSServletClient node and select Run. The result of the add operation
will display in a browser window.
Further Information
For more information on securing web applications using WSIT, visit the Project Tango web
site at https://wsit.dev.java.net/. On this page, you will find information about the
specifications implemented in this product, source code, support information, links to
documentation updates, and much more.
Some other sources that contain blogs and/or screencasts about using WSIT include the
following:
■ Sun WSIT Bloggers:
http://planet.sun.com/webservices/group/blogs/
■ Project Tango: An Overview:
https://wsit.dev.java.net/docs/tango-overview.pdf
■ Web Services blog:
http://blogs.sun.com/arungupta/category/webservices
■ Manual Web Service Configuration In From Java Case (and others):
http://blogs.sun.com/japod/date/20070226
■ Develop WSTrust Application Using NetBeans (and others):
http://blogs.sun.com/shyamrao/
■ Security in WSIT (and others):
http://blogs.sun.com/ashutosh/
■ WSIT Screencasts:
https://metro.dev.java.net/discover/screencasts.htm
■ Specifications Implemented by WSIT:
https://wsit.dev.java.net/specification-links.html
This chapter provides additional information about WSIT security features in NetBeans
Integrated Development Environment (“the IDE”).
137
Understanding WSIT Configuration Files
■ Symmetric binding is used for message protection. This binding has two binding specific
token properties: encryption token and signature token. If the message pattern requires
multiple messages, this binding defines that the encryption token used from initiator to
recipient is also used from recipient to initiator. Similarly, the signature token used from
initiator to recipient is also used from recipient to initiator.
In some cases, the client does not have its own certificates. In this case, the client can choose
a security mechanism that makes use of symmetric binding and could use a Username token
as a signed supporting token for authentication with the server. The symmetric binding in
this case serves the purpose of integrity and confidentiality protection.
■ In the absence of a notion of secure session, the client would have to reauthenticate with the
server upon every request. In this situation, if the client is sending a Username token, the
client will be asked for its username and password on each request, or, if the client is sending
a certificate, the validity of the certificate has to be established with every request. This is
expensive! Enable Secure Conversation to remove the requirement for re-authentication.
■ The use of the same session key (Secure Conversation) for repeated message exchanges is
sometimes considered a risk. To reduce that risk, enable Require Derived Keys.
■ RSA Signatures (signatures with public-private keys) is more expensive than Symmetric Key
signatures. Use the Secure Conversation option to enable Symmetric Key signatures.
■ Enabling WSS 1.1 enables an encrypted key generated by the client to be reused by the server
in the response to the client. This saves the time otherwise required to create a Symmetric
Key, encrypt it with the client public key (which is also an expensive RSA operation), and
transmit the encrypted key in the message (it occupies markup and requires Base64
operations).
The service-side WSIT Configuration file that is used when the web service is deployed can be
viewed by expanding the Web Pages→WEB-INF elements of the application in the tree, and
then double-clicking the wsit-package.service.xml file to open it in the editor.
For the example application “Example: Username Authentication with Symmetric Key (UA)”
on page 112, the WSIT configuration file for the service is named
wsit-org.me.calculator.CalculatorWS.xml, and looks like this:
</portType>
<binding name="CalculatorWSPortBinding" type="tns:CalculatorWS">
<wsp:PolicyReference URI="#CalculatorWSPortBindingPolicy"/>
<wsdl:operation name="add">
<wsdl:input>
<wsp:PolicyReference URI="#CalculatorWSPortBinding_add_Input_Policy"/>
</wsdl:input>
<wsdl:output>
<wsp:PolicyReference URI="#CalculatorWSPortBinding_add_Output_Policy"/>
</wsdl:output>
</wsdl:operation>
</binding>
<service name="CalculatorWSService">
<wsdl:port name="CalculatorWSPort" binding="tns:CalculatorWSPortBinding"/>
</service>
<wsp:Policy wsu:Id="CalculatorWSPortBindingPolicy">
<wsp:ExactlyOne>
<wsp:All>
<wsaws:UsingAddressing xmlns:wsaws="http://www.w3.org/2006/05/addressing/wsdl"/>
<sp:SymmetricBinding>
<wsp:Policy>
<sp:ProtectionToken>
<wsp:Policy>
<sp:X509Token
sp:IncludeToken=
"http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
<wsp:Policy>
<sp:WssX509V3Token10/>
</wsp:Policy>
</sp:X509Token>
</wsp:Policy>
</sp:ProtectionToken>
<sp:Layout>
<wsp:Policy>
<sp:Strict/>
</wsp:Policy>
</sp:Layout>
<sp:IncludeTimestamp/>
<sp:OnlySignEntireHeadersAndBody/>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic128/>
</wsp:Policy>
</sp:AlgorithmSuite>
</wsp:Policy>
</sp:SymmetricBinding>
<sp:Wss11>
<wsp:Policy>
<sp:MustSupportRefKeyIdentifier/>
<sp:MustSupportRefIssuerSerial/>
<sp:MustSupportRefThumbprint/>
<sp:MustSupportRefEncryptedKey/>
</wsp:Policy>
</sp:Wss11>
<sp:SignedSupportingTokens>
<wsp:Policy>
<sp:UsernameToken
sp:IncludeToken=
"http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
<wsp:Policy>
<sp:WssUsernameToken10/>
</wsp:Policy>
</sp:UsernameToken>
</wsp:Policy>
</sp:SignedSupportingTokens>
<sc:KeyStore wspp:visibility="private"
alias="xws-security-server" storepass="changeit"
type="JKS" location="C:\Sun\glassfish\domains\domain1\config\keystore.jks"/>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsp:Policy wsu:Id="CalculatorWSPortBinding_add_Input_Policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:EncryptedParts>
<sp:Body/>
</sp:EncryptedParts>
<sp:SignedParts>
<sp:Body/>
<sp:Header Name="To"
Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="From"
Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="FaultTo"
Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="ReplyTo"
Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="MessageID"
Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="RelatesTo"
Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="Action"
Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="AckRequested"
Namespace="http://schemas.xmlsoap.org/ws/2005/02/rm"/>
<sp:Header Name="SequenceAcknowledgement"
Namespace="http://schemas.xmlsoap.org/ws/2005/02/rm"/>
<sp:Header Name="Sequence"
Namespace="http://schemas.xmlsoap.org/ws/2005/02/rm"/>
</sp:SignedParts>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsp:Policy wsu:Id="CalculatorWSPortBinding_add_Output_Policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:EncryptedParts>
<sp:Body/>
</sp:EncryptedParts>
<sp:SignedParts>
<sp:Body/>
<sp:Header Name="To"
Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="From"
Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="FaultTo"
Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="ReplyTo"
Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="MessageID"
Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="RelatesTo"
Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="Action"
Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Name="AckRequested"
Namespace="http://schemas.xmlsoap.org/ws/2005/02/rm"/>
<sp:Header Name="SequenceAcknowledgement"
Namespace="http://schemas.xmlsoap.org/ws/2005/02/rm"/>
<sp:Header Name="Sequence"
Namespace="http://schemas.xmlsoap.org/ws/2005/02/rm"/>
</sp:SignedParts>
</wsp:All>
</wsp:ExactlyOne
> </wsp:Policy>
</definitions>
3. Select and/or configure the appropriate WSIT features on the WSIT Configuration tab for
the web service client. Many of the WSIT features are discussed in Chapter 7, “Using WSIT
Security.”
4. Select OK to close the dialog.
5. Run the web service client by right-clicking the project node and selecting Run Project.
The serviceService.xml file is an XML file that must conform to the WSDL specification. The
WSIT configuration is written to this file. For the example application “Example: Username
Authentication with Symmetric Key (UA)” on page 112, the WSIT configuration file for the
client is named CalculatorWSService.xml, and looks like this:
<portType name="CalculatorWS">
<operation name="add">
<input message="tns:add"></input>
<output message="tns:addResponse"></output>
</operation>
</portType>
<binding name="CalculatorWSPortBinding" type="tns:CalculatorWS">
<wsp:PolicyReference URI="#CalculatorWSPortBindingPolicy"/>
<soap:binding
transport="http://schemas.xmlsoap.org/soap/http" style="document">
</soap:binding>
<operation name="add">
<soap:operation soapAction=""></soap:operation>
<input>
<soap:body use="literal"></soap:body>
</input>
<output>
<soap:body use="literal"></soap:body>
</output>
</operation>
</binding>
<service name="CalculatorWSService">
<port name="CalculatorWSPort" binding="tns:CalculatorWSPortBinding">
<soap:address
location="http://localhost:8080/CalculatorApplication/CalculatorWSService">
</soap:address>
</port>
</service>
<wsp:Policy wsu:Id="CalculatorWSPortBindingPolicy">
<wsp:ExactlyOne>
<wsp:All>
<tc:PreconfiguredSTS wspp:visibility="private"/>
<sc:CallbackHandlerConfiguration wspp:visibility="private">
<sc:CallbackHandler default="wsitUser" name="usernameHandler"/>
<sc:CallbackHandler default="changeit" name="passwordHandler"/>
</sc:CallbackHandlerConfiguration>
<sc:KeyStore wspp:visibility="private"
storepass="changeit" type="JKS"
location="C:\Sun\glassfish\domains\domain1\config\keystore.jks"/>
<sc:TrustStore wspp:visibility="private"
storepass="changeit" type="JKS"
location="C:\Sun\glassfish\domains\domain1\config\cacerts.jks"
peeralias="xws-security-server"/>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
</definitions>
The wsit-client.xml file imports the serviceService.xml file. For the example shown about,
the wsit-client.xml file looks like this:
Option Description
Algorithm Suite This attribute specifies the algorithm suite required for performing cryptographic
operations with symmetric or asymmetric key-based security tokens. An
algorithm suite specifies actual algorithms and allowed key lengths. A mechanism
alternative will define what algorithms are used and how they are used. The value
of this attribute is typically referenced by a security binding and is used to specify
the algorithms used for all cryptographic operations performed under the
security binding. The default value is Basic 128 bit.
Some of the algorithm suite settings require that Unlimited StrengthEncryption
be configured in the Java Runtime Environment (JRE), particularly the algorithm
suites that use 256 bit encryption. Instructions for downloading and configuring
unlimited strength encryption can be found at the following URLS:
http://java.sun.com/products/jce/javase.html
http://java.sun.com/javase/downloads/index_jdk5.jsp#docs
Read the OASIS specification WS-Security Policy section on Security Binding
Properties for more description of the components for each of these algorithm
suites. A link to this document can be found at https://wsit.dev.java.net/.
Encrypt Before Signing If selected, specifies that the order of message protection is to encrypt the SOAP
content, then sign the entire SOAP body. Encryption key and signing key must be
derived from the same source key.
If not selected, the default behavior is Sign Before Encrypt.
Encrypt Signature Specifies whether the signature must be encrypted. If selected, the primary
signature must be encrypted and any signature confirmation elements must also
be encrypted. If not selected (the default), the primary signature must not be
encrypted and any signature confirmation elements must not be encrypted.
Establish Secure Session Secure Conversation enables a consumer and provider to establish a shared
(Secure Conversation) security context when a multiple-message-exchange sequence is first initiated.
Subsequent messages use (possibly derived) session keys that increase the overall
security while reducing the security processing overhead for each message.
In the absence of a notion of secure session, the client would have to
reauthenticate with the server upon every request. In this situation, if the client is
sending a Username token, it has to authenticate on every request, or, if the client
is sending a certificate, the validity of the certificate has to be established on every
request. This is expensive. Enable Secure Conversation to get over this
requirement for re-authentication.
When this option and Require Derived Keys are both enabled, a derived key will
be used. If not, the original session key will be used.
Note on Secure Conversation with Reliable Message Delivery: Reliable Messaging
can be used independently of the security mechanisms; however, when Reliable
Messaging (RM) is used with a security mechanism, it requires the use of Secure
Conversation, which will be automatically configured for a security mechanism
when Reliable Messaging is selected before the security mechanism is selected. If
Secure Conversation is selected for a security mechanism and the Reliable
Messaging option was not selected before the security mechanism was specified,
Reliable Messaging will need to be manually selected in order for Secure
Conversation to work. Reliable messaging, as well as the Advanced configuration
options and Deliver Messages in Exact Order feature, is discussed in Chapter 6,
“Using Reliable Messaging.”
Issuer Address This optional element specifies the address of the issuer (STS) that will accept the
security token that is presented in the message. This element’s type is an endpoint
reference. An STS contains a set of interfaces to be used for the issuance,
exchange, and validation of security tokens. An example that creates and uses an
STS can be found at “Example: STS Issued Token (STS)” on page 126.
For example, for JAX-WS services, the Issuer Address is:
http://localhost:8080/jaxws-sts/sts
For WCF STS, the Issuer Address is:
http://131.107.72.15/Security_Federation_SecurityTokenService_Indigo/
Symmetric.svc/Scenario_5_IssuedTokenForCertificate_MutualCertificate11
Issuer Metadata Address Specifies the address from which to retrieve the issuer metadata. They should be
just the URLs. For example, for JAX-WS services, the Issuer Metadata Address is
as follows:
http://localhost:8080/jaxws-sts/sts
For WCF STS, the Issuer Metadata Address is as follows:
http://131.107.72.15/Security_Federation_SecurityTokenService_Indigo/
Symmetric.svc
For more information, read “Configuring A Secure Token Service (STS)” on
page 104.
Key Type Applicable for Issued Token mechanisms only. The type of key the service
provider desires. The choices are public key or symmetric key. Symmetric key
cryptography relies on a shared secret and is usually faster than public key
cryptography. Public key cryptography relies on a key that is made public to all
and is primarily used for encryption but can be used for verifying signatures.
Key Size Applicable for Issued Token mechanisms only. The size of the symmetric key
requested, specified in number of bits. This is a request, and, as such, the
requested security token is not obligated to use the requested key size, nor is the
STS obligated to issue a token with the same key size. That said, the recipient
should try to use a key at least as strong as the specified value if possible. The
information is provided as an indication of the desired strength of the security.
Valid choices include 128, 192, and 256.
Require Client Certificate Select this option to require that a client certificate be provided to the server for
verification.
If you are using a security mechanism with SSL, a client certificate will be required
by the server both during its initial handshake and again during verification.
Require Derived Keys A derived key is a cryptographic key created from a password or other user data.
Derived keys allow applications to create session keys as needed, eliminating the
Require Derived Keys
need to store a particular key. The use of the same session key (for example, when
for:Issued Token,
using Secure Conversation) for repeated message exchanges is sometimes
Secure Session,
considered a risk. To reduce that risk, enable Require Derived Keys.
X509 Token
Require Signature When the WSS Version is 1.1, select this option to reduce the risk of attacks
Confirmation because signature confirmation indicates that the responder has processed the
signature in the request. For more information, read section 8.5, Signature
Confirmation, of the Web Services Security: SOAP Message Security 1.1
specification at http://www.oasis-open.org/
committees/download.php/16790/wss-v1.1-spec-os-SOAPMessageSecurity.pdf.
SAML Version Specifies which version of the SAML token should be used. The SAML Version is
something the CallbackHandler has to verify, not the security runtime. SAML
tokens are defined in WSS: SAML Token Profile documents, available from
http://www.oasis-open.org/specs/index.php.
For an example that uses SAML Callbacks, refer to “Example: SAML
Authorization over SSL (SA)” on page 119.
Security Header Layout Specifies which layout rules to apply when adding items to the security header.
The options are:
■ Strict: Items are added to the security header following the general principle
of “declare before use”.
■ Lax: Items are added to the security header in any order that conforms to
WSS: SOAP Message Security. However, WSIT follows Strict even when Lax
is selected.
■ Lax (Timestamp First or Last): The same as for Lax, except that the first or
last item in the security header must be a wsse:Timestamp.
Supporting Token Specifies the type of supporting token to be used. Supporting Tokens are included
in the security header and may sign and/or encrypt additional message parts.
Valid options for supporting tokens include X.509 tokens, Username tokens,
SAML tokens, or an Issued Token from an STS.
For more information on these options, read “Supporting Token Options” on
page 104.
Token Type The type of SAML token the service provider requires, for example,
urn:oasis:names:tc:SAML1.0:assertion.Choices are 1.0, 1.1, or 2.0.
WSS Version Specifies which version of the Web Services Security specification should be
followed, 1.0 or 1.1. These specifications can be viewed from
http://www.oasis-open.org/specs/index.php.
Enabling WSS 1.1 enables an encrypted key generated by the client to be reused
by the Server in the response to the client. This saves the time otherwise required
to create a Symmetric Key during the course of response, encrypt it with the client
public key (which is also an expensive RSA operation), and transmit the
encrypted key in the message (it occupies markup and requires Base64
operations). Enabling WSS 1.1 also enables encrypted headers.
This chapter describes how to use the two supported web containers, GlassFish version 2 and
Apache Tomcat 5.5, to create, build, and deploy a web service and a client that use the Web
Services Interoperability Technologies (WSIT). This chapter also includes examples of the files
you must create and the build directories.
To run the examples described in this chapter, download the WSIT samples kits,
wsit-enabled-fromjava.zip and wsit-enabled-fromwsdl.zip, from the following location:
https://wsit.dev.java.net/source/browse/wsit/wsit/docs/howto/
You could also useNetBeans IDE to create and deploy WSIT web services and clients. The IDE
provides a graphical user interface (GUI) and does many of the manual steps described in this
chapter for you, thus reducing the amount of coding and processing required. For an example
that creates, builds, and deploys a web service and a web service client using NetBeans IDE, see
Chapter 3, “WSIT Example Using a Web Container and NetBeans IDE.”
151
Environment Configuration Settings
features used by a given web service. The assertions may specify particular configuration
settings or rely on default settings that are predetermined by the specific technology. For
instance, in the snippet shown below, the wsrm:AcknowledgementInterval and
wsrm:InactivityTimeout settings are both optional and could be omitted. The following
snippet shows WS-Policy assertions for WS-Addressing and WS-Reliable Messaging:
<wsp:Policy wsu:Id="AddNumbers_policy">
<wsp:ExactlyOne>
<wsp:All>
<wsaw:UsingAddressing/>
<wsrm:RMAssertion>
<wsrm:InactivityTimeout Milliseconds="600000"/>
<wsrm:AcknowledgementInterval Milliseconds="200"/>
</wsrm:RMAssertion>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
The Java API for XML Web Services (JAX-WS) 2.0 Specification, JSR-224, relies heavily on the
use of annotations as specified in A Metadata Facility for the Java Programming Language
(JSR-175) and Web Services Metadata for the Java Platform (JSR-181), as well as additional
annotations defined by the JAX-WS 2.0 specification.
The web service is written as a normal Java class. Then the class and its exposed methods are
annotated with the web service annotations @WebService and @WebMethod. The following code
snippet shows an example:
Chapter 9 • WSIT Example Using a Web Container Without NetBeans IDE 153
Creating a Web Service
@WebService
public class AddNumbersImpl {
@WebMethod(action="addNumbers")
public int addNumbers(int number1, int number2)
throws AddNumbersException {
if (number1 < 0 || number2 < 0) {
throw new AddNumbersException(
"Negative number can’t be added!",
"Numbers: " + number1 + ", " + number2);
}
return number1 + number2;
}
}
When developing a web service from scratch or based on an existing Java class, WSIT features
are enabled using a configuration file. That file, wsit-package.service.xml, is written in WSDL
format. An example configuration file can be found in the accompanying samples:
wsit-enabled-fromjava/etc/wsit-fromjava.server.AddNumbersImpl.xml
The settings in the wsit-package.service.xml file are incorporated dynamically by the WSIT
runtime into the WSDL it generates for the web service. So when a client requests the web
service’s WSDL, the runtime embeds any publicly visible policy assertions contained in the
wsit-package.service.xml file into the WSDL. For the example
wsit-fromjava.server.AddNumbersImpl.xml in the sample discussed in this tutorial, the
Addressing and Reliable Messaging assertions are part of the WSDL as seen by the client.
■ custom-schema.xml
■ sun-jaxws.xml
■ web.xml
■ These files are standard in any Ant build environment. Examples of these files are provided
in the wsit-enabled-fromjava sample directory.
■ build.xml
■ build.properties
The starting point for developing a web service that uses the WSIT technologies is a Java class
file annotated with the javax.jws.WebService annotation. The @WebService annotation
defines the class as a web service endpoint.
import javax.jws.WebService;
import javax.jws.WebMethod;
@WebService
public class AddNumbersImpl {
@WebMethod(action="addNumbers")
public int addNumbers(int number1, int number2)
throws AddNumbersException {
if (number1 < 0 || number2 < 0) {
throw new AddNumbersException(
"Negative number cannot be added!",
"Numbers: " + number1 + ", " + number2);
}
return number1 + number2;
}
}
Chapter 9 • WSIT Example Using a Web Container Without NetBeans IDE 155
Creating a Web Service
wsit-package.service.xml File
This file is the WSIT configuration file. It defines which WSIT technologies are enabled in the
web service. The snippet shown below illustrates how to enable the WSIT reliable messaging
technology in a wsit-package.service.xml file.
<wsp:Policy wsu:Id="AddNumbers_policy">
<wsp:ExactlyOne>
<wsp:All>
<wsaw:UsingAddressing/>
<wsrm:RMAssertion>
<wsrm:InactivityTimeout Milliseconds="600000"/>
<wsrm:AcknowledgementInterval Milliseconds="200"/>
</wsrm:RMAssertion>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
When developing a web service starting from an existing WSDL, the process is actually simpler
than starting from Java. This is because the policy assertions needed to enable various WSIT
technologies are already embedded in the WSDL file. An example WSDL file is included in the
fromwsdl sample provided with this tutorial at:
tut-install/wsit-enabled-fromwsdl/etc/AddNumbers.wsdl
To create a web service from WSDL, create the following source files:
■ “WSDL File” on page 157
■ “Web Service Implementation File” on page 157
■ custom-server.xml
■ web.xml
■ sun-jaxws.xml
■ build.xml
■ build.properties
The following files are standard files required for JAX-WS. Examples of these files are provided
in the fromwsdl sample directory.
■ custom-server.xml
■ sun-jaxws.xml
■ web.xml
The build.xml and build.properties files are standard in any Ant build environment.
Examples of these files are provided in the respective samples directories.
The sample files provided in this tutorial define a web service that takes two integers, adds them,
and returns the result. If one of the integers is negative, an exception is returned.
WSDL File
You can create a WSDL file by hand or retrieve it from an existing web service by simply
pointing a web browser at the web service’s URL. The snippet shown below illustrates how to
enable the WSIT Reliable Messaging technology in a WSDL file.
<wsp:Policy wsu:Id="AddNumbers_policy">
<wsp:ExactlyOne>
<wsp:All>
<wsrm:RMAssertion>
<wsrm:InactivityTimeout Milliseconds="600000"/>
<wsrm:AcknowledgementInterval Milliseconds="200"/>
</wsrm:RMAssertion>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
For a complete example of a WSDL file, see the AddNumbers.wsdl file in the fromwsdl example.
Another benefit of the AddNumbers.wsdl file is that it shows how a WSIT-enabled WSDL is
constructed. Therefore, you can use it as a reference when you create a WSDL file or modify an
existing one.
import javax.jws.WebService;
import javax.jws.WebMethod;
@WebService (endpointInterface=
"fromwsdl.server.AddNumbersPortType")
Chapter 9 • WSIT Example Using a Web Container Without NetBeans IDE 157
Building and Deploying the Web Service
ant server
This command calls the server target in build.xml, which builds and packages the application
into a WAR file, wsit-enabled-fromjava.war, and places it in the
wsit-enabled-fromjava/build/war directory. The ant server command also deploys the
WAR file to the web container.
The ant command calls multiple tools to build and deploy the web service. The JAX-WS
annotation processing tool (apt) processes the annotated source code and invokes the compiler
itself, resulting in the class files for each of the Java source files. In the wsit-enabled-fromjava
example, the Ant target build-server-java in build.xml handles this portion of the process.
Next, the individual class files are bundled together along with the web service’s supporting
configuration files into the application’s WAR file. It is this file that is deployed to the web
container by the deploy target.
During execution of the server target, you will see a warning message. The message refers to
“Annotation types without processors”. The warning is expected and does not indicate an
abnormal situation. The text is included here for reference:
build-server-java:
[apt] warning: Annotation types without processors:
[javax.xml.bind.annotation.XmlRootElement,
javax.xml.bind.annotation.XmlAccessorType,
javax.xml.bind.annotation.XmlType,
javax.xml.bind.annotation.XmlElement]
[apt] 1 warning
ant server
This command calls wsimport, which takes the WSDL description and generates a
corresponding Java interface and other supporting classes. Then the Java compiler is called to
compile both the user’s code and the generated code. Finally, the class files are bundled together
into the WAR file. To see the details of how this is done, see the build-server-wsdl and
create-war targets in the wsit-enabled-fromwsdl/build.xml file.
Chapter 9 • WSIT Example Using a Web Container Without NetBeans IDE 159
Building and Deploying the Web Service
The following sections describe how to deploy on the different web containers:
■ “Deploying to GlassFish” on page 160
■ “Deploying to Apache Tomcat” on page 160
Deploying to GlassFish
For development purposes, the easiest way to deploy is to use the autodeploy facility of the
GlassFish application server. To do so, you simply copy your application’s WAR file to the
/autodeploy directory for the domain to which you want to deploy. If you are using the default
domain, domain1, which is set up by the GlassFish installation process, the appropriate
directory path would be as-install/domains/domain1/autodeploy.
The build.xml file which accompanies this example has a deploy target for GlassFish. To
invoke that target, run the following command in the top-level directory of the respective
examples, either wsit-enabled-fromjava or wsit-enabled-fromwsdl, as follows.
ant deploy
The build.xml file which accompanies this example has a deploy target for Tomcat. To invoke
that target, run the following command in the top-level directory of the respective examples,
either wsit-enabled-fromjava or wsit-enabled-fromwsdl, as follows. You need to use the
-Duse.tomcat=true switch to make sure that the application is deployed to Tomcat, and not to
the default server, which is GlassFish.
Verifying Deployment
A basic test to verify that the application has deployed properly is to use a web browser to
retrieve the application’s WSDL from its hosting web container. The following URLs retrieve
the WSDL from each of the two example services. If you are running your web browser and web
container on different machines, you need to replace localhost with the name of the machine
hosting your web service.
■ http://localhost:8080/wsit-enabled-fromjava/addnumbers?wsdl
■ http://localhost:8080/wsit-enabled-fromwsdl/addnumbers?wsdl
If the browser displays a page of XML tags, the web service has been deployed and is working. If
not, check the web container log for any error messages related to the sample WAR you have
just deployed. For GlassFish, the log can be found at
as-install/domains/domain1/logs/server.log. For Apache Tomcat, the appropriate log file
can be found at tomcat-home/logs/catalina.out.
The policy assertions describe any requirements from the server as well as any optional features
the client may use. The WSIT build tools and run-time environment detect the WSDL’s policy
assertions and configure themselves appropriately, if possible. If an unsupported assertion is
found, an error message describing the problem will be displayed.
Typically, you retrieve the WSDL directly from a web service provider using the wsimport tool.
The wsimport tool then generates the corresponding Java source code for the interface
described by the WSDL. The Java compiler, javac, is then called to compile the source into class
files. The programming code uses the generated classes to access the web service.
Chapter 9 • WSIT Example Using a Web Container Without NetBeans IDE 161
Creating a Web Service Client
■ build.properties
The build.xml and build.properties files are standard in any Ant build environment.
Examples of these files are provided in the wsit-enabled-fromjava sample directory.
package fromjava.client;
import com.sun.xml.ws.Closeable;
import java.rmi.RemoteException;
number1 = -10;
System.out.printf ("Invoking addNumbers(%d, %d)\n",
number1, number2);
result = port.addNumbers (number1, number2);
System.out.printf (
"The result of adding %d and %d is %d.\n",
number1, number2, result);
} catch (AddNumbersException_Exception ex) {
System.out.printf (
"Caught AddNumbersException_Exception: %s\n",
ex.getFaultInfo ().getDetail ());
} finally {
((Closeable)port).close();
}
}
}
This file specifies two positive integers that are to be added by the web service, passes the
integers to the web service and gets the results from the web service by using the
port.addNumbers method, and prints the results to the screen. It then specifies a negative
number to be added, gets the results (which should be an exception), and prints the results (the
exception) to the screen.
The build.xml and build.properties files are standard in any Ant build environment.
Examples of these files are provided in the fromwsdl sample directory.
Chapter 9 • WSIT Example Using a Web Container Without NetBeans IDE 163
Building and Deploying a Client
For GlassFish:
ant client
This command runs wsimport, which retrieves the web service’s WSDL, and then it runs javac
to compile the source.
For GlassFish:
ant run
This command executes the run target, which simply runs Java with the name of the client’s
class, for example, fromwsdl.client.AddNumbersClient.
rm $CATALINA_HOME/webapps/wsit-enabled-fromjava.war
rm $CATALINA_HOME/webapps/wsit-enabled-fromwsdl.war
Chapter 9 • WSIT Example Using a Web Container Without NetBeans IDE 165
166
10
C H A P T E R 1 0
This chapter describes how to build and run a Microsoft Windows Communication
Foundation (WCF) client that accesses the addnumbers service described in Chapter 9, “WSIT
Example Using a Web Container Without NetBeans IDE.”
167
Creating a WCF Client
You must also deploy the addnumbers service described in Chapter 9, “WSIT Example Using a
Web Container Without NetBeans IDE.” You can download the service from
https://wsit.dev.java.net/
source/browse/*checkout*/wsit/wsit/docs/howto/wsit-enabled-fromjava.zip.
:...
int result = port.addNumbers (number1, number2);
...
using System;
class Client {
static void Main(String[] args) {
AddNumbersImplClient port = null;
try {
port = new AddNumbersImplClient("AddNumbersImplPort");
int number1 = 10;
int number2 = 20;
number1 = -10;
Console.Write("Adding {0} and {1}. ", number1, number2);
result = port.addNumbers (number1, number2);
Console.WriteLine("Result is {0}.\n\n",result);
port.Close();
} catch (System.ServiceModel.FaultException e) {
Console.WriteLine("Exception: " + e.Message);
The example bundle contains a batch file, build.bat, that calls svcutil.exe to generate the
proxy class. The command is:
1 At a command prompt, navigate to the location where you extracted the example bundle.
2 If necessary, customize the build.bat file as described in “To Customize the build.bat File”on
page 170.
2 On the first line, type the full path to the svcutil.exe tool. By default, it is installed at
C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin.
3 On the first line, change the WSDL location URL if you did not deploy the addnumbers service to
the local machine, or if the service was deployed to a different port than the default 8080 port
number.
For example, the following command (all on one line) sets the host name to
testmachine.example.com and the port number to 8081:
svcutil /config:Client.exe.config
http://testmachine.example.com:8081/wsit-enabled-fromjava/addnumbers?wsdl
4 On line 2, change the location of the csc.exe C# compiler and the System.ServiceModel and
System.Runtime.Serialization support DLLs if you installed the .NET 2.0 and 3.0 frameworks
to non-default locations.
1 At a command prompt, navigate to the location where you extracted the example bundle.
Data Contracts
1 1
A WSIT client/service uses JAXB 2.0 for XML serialization, generating XML schemas from Java
classes and generating Java classes from XML schemas. A WCF client/service uses either
XmlSerializer or DataContractSerializer for like tasks. JAXB 2.0 and the WCF XML
serialization mechanisms differ in two fundamental ways:
■ JAXB 2.0 supports all of XML schema. .NET’s DataContractSerializer and
XmlSerializer support different XML schema sets.
■ WCF’s XMLSerializer/DataContractSerializer and JAXB 2.0 differ in their mapping of
programming language datatypes to XML Schema constructs.
As a result, an XML schema generated from a programming language on one platform and
consumed on another platform may result in less than developer-friendly bindings. This
chapter discusses some of the common databinding differences between the two systems and
recommends ways to address them.
171
Web Service - Start from Java
Not all JAXB 2.0 annotations are included here; not all are relevant from an interoperability
standpoint. For example, the annotation @XmlAccessorType provides control over default
serialization of fields and properties in a Java class but otherwise has no effect on the
on-the-wire XML representation or the XML schema generated from a Java class. Select JAXB
2.0 annotations are therefore not included here in the guidance.
The guidance includes several examples, which use the following conventions:
■ The prefix xs: is used to represent XML Schema namespace.
■ JAXB 2.0 annotations are defined in javax.xml.bind.annotation package but, for brevity,
the package name has been omitted.
Data Types
This section covers the following topics:
■ “Primitives and Wrappers” on page 172
■ “BigDecimal Type” on page 173
■ “java.net.URI Type” on page 175
■ “Duration” on page 176
■ “Binary Types” on page 178
■ “XMLGregorianCalendar Type” on page 180
■ “UUID Type” on page 181
■ “Typed Variables” on page 182
■ “Collections Types” on page 183
■ “Array Types” on page 186
//--Schema fragment
<xs:complexType name="stockItem">
<xs:sequence>
<xs:element name="wholeSalePrice" type="xs:double" minOccurs="0"/>
<xs:element name="retailPrice" type="xs:double"/>
</xs:sequence>
</xs:complexType>
BigDecimal Type
Guideline: Limit decimal values to the range and precision of .NET’s System.decimal.
arbitrary precision. System.decimal does not. For interoperability use only values within the
range and precision of System.decimal. (See System.decimal.Minvalue and
System.decimal.Maxvalue.) Any values outside of this range require a customized .NET client.
java.net.URI Type
Guideline: Use the @XmlSchemaType annotation for a strongly typed binding to a .NET client
generated with the DataContractSerializer.
Thus, the above technique only works if the WSDL is processed using
DataContractSerializer.
Duration
Guideline: Use .NET’s System.Xml.XmlConvert to generate a lexical representation of
xs:duration when the binding is to a type of System.string.
When xs:duration is bound to .NET System.string, the string value must be a lexical
representation for xs:duration. .NET provides utility System.Xml.XmlConvert for this
purpose.
Binary Types
Guideline: java.awt.Image, javax.xml.transform.Source, and
javax.activation.DataHandler map to xs:base64Binary. .NET maps xs:base64Binary to
byte[].
JAXB 2.0 provides the annotation @XmlMimeType, which supports specifying the content type,
but .NET ignores this information.
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
XMLGregorianCalendar Type
Guideline: Use java.xml.datatype.XMLGregorianCalendar instead of java.util.Date and
java.util.Calendar.
tmpP.orderDate = System.Xml.XmlConvert.ToString(
System.DateTime.Now, System.Xml.XmlDateTimeSerializerMode.RoundtripKind);
UUID Type
Guideline: Use Leach-Salz variant of UUID at runtime.
java.util.UUID maps to schema type xs:string. .NET maps xs:string to System.string.
The constructors in java.util.UUID allow any variant of UUID to be created. Its methods are
for manipulation of the Leach-Salz variant.
Typed Variables
Guideline: A typed variable maps to xs:anyType. .NET maps xs:anyType to System.Object.
// Java class
public class Shape <T>
{
private T xshape;
Collections Types
Java collections types (java.util.Collection and its subtypes, array, List, and parameterized
collection types such as List<Integer>) can be mapped to XML schema in different ways and
can be serialized in different ways. The following examples show .NET bindings.
<po>
<items> 1 </items>
<items xsi:nil=true/>
<items> 3 </items>
</po>
List of Values
Guideline: A collection such as List<Integer> can be mapped to a list of XML values (that is,
an XML schema list simple type) using annotation @XmlList. .NET maps a list simple type to a
.NET System.string.
</xs:simpleType>
</xs:element>
</xs:complexType>
...
Array Types
Example: Single and multidimensional arrays
@XmlElement Annotation
Guideline: The @XmlElement annotation maps a property or field to an XML element. This is
also the default mapping in the absence of any other JAXB 2.0 annotations. The annotation
parameters in @XmlElement can be used to specify whether the element is optional or required,
nillable or not. The following examples illustrate the corresponding bindings in the .NET client.
@XmlAttribute Annotation
Guideline: A property or field can be mapped to an XML attribute using @XmlAttribute
annotation. .NET binds an XML attribute to a property.
@XmlElementRefs Annotation
Guideline: @XmlElementRefs maps to a xs:choice. This binds to a property with name item in
the C# class. If there is another field/property named item in the Java class, there will be a name
clash that .NET will resolve by generating name. To avoid the name clash, either change the
name or use customization, for example @XmlElement(name="foo").
@XmlRootElement(name="plane")
public class PlaneType extends TransportType {}
@XmlRootElement(name="auto")
public class AutoType extends TransportType { }
@XmlRootElement
public class TransportType { ... }
</xs:choice>
</xs:complexType>
<xs:complexType name="autoType">
<!-- content omitted - details not relevant to example -->
</xs:complexType>
</xs:complexType name="planeType">
<!-- content omitted - details not relevant to example -->
</xs:complexType>
Java Classes
A Java class can be mapped to different XML schema type and/or an XML element. The
following guidelines apply to the usage of annotations at the class level.
The @XmlType annotation is used to customize the mapping of a Java class to an anonymous
type. .NET binds an anonymous type to a .NET class - one per reference to the anonymous type.
Thus, each Java class mapped to an anonymous type can generate multiple classes on the .NET
client.
set {
this.itemField = value;
}
}
}
}
}
@XmlType(propOrder={}) maps a Java class to an XML Schema complex type with xs:all
content model. Since XML Schema places severe restrictions on xs:all, the use of
@XmlType(propOrder={}) is therefore not recommended. So, the following example shows the
mapping of a Java class to xs:all, but the corresponding .NET code generated by svcutil is
omitted.
Open Content
JAXB 2.0 supports the following annotations for defining open content. (Open content allows
content not statically defined in XML schema to occur in an XML instance):
■ The @XmlAnyElement annotation maps to xs:any, which binds to the .NET type
System.Xml.XmlElement[].
■ The @XmlAnyAttribute annotation maps to xs:anyAttribute, which binds to the .NET
type System.Xml.XmlAttribute[].
Enum Type
Guideline: A Java enum type maps to an XML schema type constrained by enumeration facets.
This, in turn, binds to the .NET type enum type.
Package-level Annotations
The following package-level JAXB annotations are relevant from an interoperability
standpoint:
■ @XmlSchema – customizes the mapping of package to XML namespace.
■ @XmlSchemaType – customizes the mapping of XML schema built-in type. The
@XmlSchemaType annotation can also be used at the property/field level, as was seen in the
example “XMLGregorianCalendar Type” on page 180.
@XmlSchema Annotation
A package is mapped to an XML namespace. The following attributes of the XML namespace
can be customized using the @XmlSchema annotation parameters:
■ elementFormDefault using @XmlSchema.elementFormDefault()
■ attributeFormDefault using @XmlSchema.attributeFormDefault()
■ targetNamespace using @XmlSchema.namespace()
■ Associate namespace prefixes with the XML namespaces using the @XmlSchema.ns()
annotation
These XML namespace attributes are bound to .NET serialization attributes (for example,
XmlSerializer attributes).
svcutil wsdl-file
Java Client
A Java client is always developed starting from a WSDL. See “Customizations for WCF Service
WSDL” on page 197 for guidelines.
The following sections explain the use and rationale of these customizations.
generateElementProperty Attribute
WCF service WSDL generated from a programming language such as C# using
DataContractSerializer may contain XML Schema constructs which result in
JAXBElement<T> in generated code. A JAXBElement<T> type can also sometimes be generated
when a WSDL contains advanced XML schema features such as substitution groups or
elements that are both optional and nillable. In all such cases, JAXBElement<T> provides
roundtripping support of values in XML instances. However, JAXBElement<T> is not natural to
a Java developer. So the generateElementProperty customization can be used to generate an
alternate developer friendly but lossy binding. The different bindings along with the trade-offs
are discussed below.
Default Binding
The following is the default binding of an optional (minOccurs="0") and
nillable(nillable="true") element:
// Binding
public class Person {
JAXBElement<String> getName() {...};
public void setName(JAXBElement<String> value) {...}
}
Since the XML element name is both optional and nillable, it can be represented in an XML
instance in one of following ways:
The JAXBElement<String> type roundtrips the XML representation of name element across an
unmarshal/marshal operation.
Customized Binding
When generateElementProperty is false, the binding is changed as follows:
The above binding is more natural to Java developer than JAXBElement<String>. However, it
does not roundtrip the value of name.
<jaxb:bindings version="2.0"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jaxb:bindings schemaLocation="schema-importedby-wcfsvcwsdl"
node="/xs:schema">
<jaxb:globalBindings generateElementProperty="false"/>
</jaxb:bindings>
...
mapSimpleTypeDef Attribute
XML Schema Part 2: Datatype defines facilities for defining datatypes for use in XML Schemas.
.NET platform introduced the CLR types for some of the XML schema datatypes as described in
Table 11–1.
byte xs:unsignedByte
uint xs:unsignedInt
ushort xs:unsignedShor
ulong xs:unsignedLong
However, there are no corresponding Java types that map to the XML Schema types listed in
Table 11–1. Furthermore, JAXB 2.0 maps these XML schema types to Java types that are natural
to Java developer. However, this results in a mapping that is not one-to-one. For example:
■ xs:int -> int
■ xs:unsignedShort -> int
The lack of a one-to-one mapping means that when XML Schema types shown in Table 11–1
are used in an xsi:type construct, they won’t be preserved by default across an unmarshal
followed by marshal operation. For example:
// C# web method
public Object retObject(Object objvalue);
// Java web method generated from WCF service WSDL
public Object retObject(
Object objvalue);
}
<objvalue xsi:type="xs:unsignedShort"/>
■ JAXB 2.0 unmarshaller unmarshals the value as an instance of int and assigns it to
parameter objvalue.
■ The objvalue is marshalled back by JAXB 2.0 marshaller with an xsi:type of xs:int.
<objvalue xsi:type="xs:int"/>
One way to preserve and roundtrip the xsi:type is to use the mapSimpleTypeDef
customization. The customization makes the mapping of XML Schema Part 2 datatypes
one--to-one by generating additional Java classes. Thus, xs:unsignedShort will be bound to its
own class rather than int, as shown:
<objvalue xsi:type="xs:unsignedShort"/>
■ JAXB 2.0 unmarshaller unmarshals the value as an instance of UnsignedShort and assigns it
to parameter objvalue.
■ The objvalue is marshalled back by JAXB 2.0 marshaller with an xsi:type of xs:int.
<objvalue xsi:type="xs:unsignedShort"/>
<jaxb:bindings version="2.0"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jaxb:bindings schemaLocation="schema-importedby-wcfsvcwsdl"
node="/xs:schema">
<jaxb:globalBindings mapSimpleTypeDef="true"/>
</jaxb:bindings>
....
1 Generate WCF web service client artifacts using the svcutil.exe tool:
svcutil.exe java-web-service-wsdl
BP 1.1 Conformance
JAX-WS 2.0 enforces strict Basic Profile 1.1 compliance. In one situation, the .NET framework
does not enforce strict BP 1.1 semantics, and their usage can lead to interoperability problems.
From a developer perspective this means that in rpclit mode, JAX-WS does not allow a null to
be passed in a web service method parameter.
<!-- In rpclit mode, the above Java web service method will throw an exception
if the following XML instance with xsi:nil is passed by a .NET client.-->
<RetByteArray xmlns="http://tempuri.org/">
<inByteArray a:nil="true" xmlns=""
xmlns:a="http://www.w3.org/2001/XMLSchema-instance"/>
</RetByteArray>
This chapter explains how to configure and use WSIT WS-TX, which implements Web
Services-AtomicTransactions (WS-AT) and Web Services-Coordination (WS-Coordination).
WSIT WS-TX enables Java EE transactions to work across heterogeneous systems that support
WS-AT and WS-Coordination.
203
About the basicWSTX Example
The servlet and CMT EJB transacted web service operations manipulate two JMS resources:
■ jms/ConnectionFactory, an XATransaction connection factory
■ jms/Queue, a JMS queue
This example shows how to use XATransaction -enabled JMS and JDBC. The first version of
this example, showing WSIT-to-WSIT operations, has the SampleServiceClient client
configured to run on one GlassFish instance and the service running on the other GlassFish
instance. Either the Java client or the Java web service could be replaced by a semantically
equivalent Microsoft implementation. The Java client is, in fact, replaced by a Microsoft WCF
client in the more advanced version of the example.
The basicWSTX example was initially designed so it could be run in either one or in two
GlassFish domains. If you run the example in one domain, only one coordinator is used; no
WS-Coordination protocol messages will be exchanged. This chapter explains how to run the
example in two domains so both protocols, WS-Coordination and WS-AtomicTransaction
(WS-AT), are used, as shown in Figure 12–1.
Domain 2 Domain 1
Transacted Application
Message Request
wscoor: register
wscoor: response
Application
Message Response
WS-AT
Protocol Messages
(two-phase commit)
The example also provides the msclient client, which is the equivalent of the client servlet
shown in Domain 2.
Figure 12–2 shows the components that make up the two domain example. Again, the msclient
client would be equivalent to the client servlet in Domain 2 in this figure as well.
Machine B
Domain 1
SimpleService
(servlet web service)
(transacted operators)
SimpleServiceASCMTEJB
(EJB web service)
(transacted operators) Machine A
Domain 2
JMS Resources
Client Servlet msclient
jms/ConnectionFactory
(Txn initiator) XATransaction (Txn initiator)
jms/Queue
LibraryFacadeWebServiceBean
(accessor EJB web service)
(transacted operators)
Book
(entity)
JDBC Resources
jdbc/ConnectionPool
XATransaction
jdbc/javaProgrammingLibrary
The SimpleService web service uses two JMS resources that are created in domain1:
■ jms/ConnectionFactory, an XATransaction connection factory
■ jms/Queue, a JMS queue
The LibraryFacadeWebServiceBean web service uses the Java Persistence API (JPA) with two
JDBC resources that are created in domain1:
■ connectionPool, an XATransaction JDBC connection pool
■ jdbc/javaProgrammingLibrary, a JDBC connection resource
2 Ensure that properties that point to your local Application Server (or GlassFish) and WSIT
Tutorial installations have been set.
c. Ensure that Application Server (or GlassFish) and at least Ant 1.6.5 have been installed and
are on the path.
Application Server (or GlassFish) includes Ant 1.6.5, which can be found in the
as-install/lib/ant/bin directory.
b. Issue the following command to configure your environment to run the example:
ant setup
g. Click OK.
5 Register the Application Server (or GlassFish) server instances (domain1 and domain2) in the
NetBeans IDE.
a. If Sun Java System Application Server (domain1) is already registered, go to Step 4g. If it is
not, go to Step 4b.
c. Choose the server (Sun Java System Application Server (or GlassFish V2) from the
drop—down list and give it a descriptive name, such as Sun Java System Application Server -
domain1 (Server), and then click Next.
The Platform Location dialog displays.
d. ClickBrowse, navigate to the location where the Application Server (or GlassFish server) is
installed, then click Choose.
e. Make sure that the Register Local Default Domain radio button has been selected.
i. Click Finish.
The server instance you just registered is the one in which you will run the web service
(SampleService).
k. Choose the server (Sun Java System Application Server (or GlassFish V2) from the
drop—down list and give it a descriptive name, such as Sun Java System Application Server -
domain2 (Client), and then click Next.
The Platform Location dialog displays.
l. ClickBrowse, navigate to the location where the Application Server (or GlassFish server) is
installed, then click Choose.
m. Make sure that the Register Local Default Domain radio button has been selected.
q. Click Finish.
The server instance you just registered is the one in which you will run the web service client
(SampleServiceClient).
6 Open the SampleService project and associate the SampleService web service with the
appropriate instance (domain1) of the Application Server (or GlassFish server).
f. In the Projects tab, right-click SampleService, select Properties, then select the Run
category.
g. Use the Server drop—down list to point to the default domain, domain1, for the Application
Server (or Glassfish) server instance you registered in Step 4.
h. Click OK.
7 Resolve references to or add the Toplink Essentials Library to the SampleService-ejb project.
The SampleService-ejb project references the Toplink Essentials Library Module that is
included with NetBeans IDE. To verify whether the reference to this library is resolved in your
NetBeans IDE environment:
c. If you do not see the library, click Add Library to display the Add Library dialog.
d. Locate and select Toplink Essentials and then click Add Library.
You should now see Toplink Essentials in the Compile-time Libraries pane of the Compile
tab.
e. Click OK.
To verify that you have Toplink Essentials library in NetBeans IDE, select Tools and then
Library Manager. You should see "Toplink Essentials" in the left pane. If you don't, you can
create the library yourself using the two Toplink JAR files in the Application Server (or
GlassFish) lib directory and then resolve the reference to the newly created library.
8 Set the proper transaction attributes for each mapping (wsdl:binding /wsdl:operation) in
the SimpleService-war web service.
To set the transaction attributes for the SampleService-war web service:
d. In the Quality of Service tab, expand the five operation nodes and then expand the method
nodes under each operation node. Use the Transaction drop-down list to set the appropriate
transaction attribute for each method:
■ Set init to Required.
■ Set publishRequired to Required.
■ Set publishSupports to Supported.
■ Set verify to Required.
■ Set getMessage to Required.
If any other operations are displayed, ignore them.
e. Click OK.
Transaction attributes for SampleServiceASCMTEJB do not need to be set; EJB 3.0
transaction attributes are used.
The transaction attribute settings for the SampleService-war are stored in the file
SampleService\SampleService-war\web\WEB-INF\wsit-wstx.sample.service.Simple.xml.
10 Register the SampleServiceClient client with the appropriate instance (domain2) of the
Application Server (or GlassFish) server.
f. In the Projects tab, right-click SampleServiceClient, select Properties, then select the Run
category.
h. Click OK.
11 Create web service references for the client (three web service clients, a simpleServlet and two
CMT EJB clients) and generate the WSDL for all.
a. In the Projects tab, right-click SampleServiceClient, select New, then select Web Service
Client.
The New Web Service Client dialog displays.
12 (Optional) If transaction attributes for the servlet (see Step 7) or CMT EJB web service have
changed, those services must be deployed and client web service references refreshed to get
new web service attributes.
To refresh the client web service references for this example:
a. In the Projects tab, open the SampleServiceClient, then open Web Service References.
b. Right-click Simple and select Refresh Client to refresh the client node and regenerate the
WSDL for the simpleServlet.
A E
aliases, specifying, 91 endpoints
annotations descriptions, 49
WebService, 40, 155 references, 49
Application Server, adding users to, 86-88 server-side, 49
atomic transactions, example, 203-213
authentication credentials, 74
F
flow control, 58
B
binary objects, encoding, 22
bootstrapping and configuration, 49-50
overview, 20-21 G
GlassFish
registering with the IDE, 39-40
C updating certificates, 89-90
certificates GlassFish users
digital, 77 adding, 86-88
v3, 89-90 configuring, 72
validating, 98
clients, securing web services, 63-69
configuration files, 138-145
client-side, 142-145 I
service-side, 139-142 inactivity timeout, 58
D J
data contracts, 171-202 Java files
default user, configuring, 72 annotations, 40, 51, 155
derived session keys, 23
215
Index
S
M SAML callback handlers
message optimization, 51-56 configuring, 72, 74
overview, 22, 31-32 examples of, 74-76
secure conversation and, 56 SAML tokens, validating, 98
messages, securing, 99 secure conversation
MetadataExchangeRequest, 21 message optimization and, 56
multiple-message-exchange sequence, 23 overview, 36-37
reliable messaging and, 59
security context token, 59
Secure Service, 65
O Secure Token Service (STS), configuring, 104-111
operations, securing, 99-104 security, 63-136, 137-149
ordered delivery, 57 client, 67-69
client-side configuration requirements, 70-76
configuration files, 138-145
configuring, 63-69
P derived session keys, 23
password, default, 74 examples, 112-135
mutual certificates (MCS), 114-116
SAML authorization over SSL (SA), 119-123
SAML sender vouches (SV), 123-126
Q STS issued token (STS), 126-131
Quality of Service, 22-23 transport security (SSL), 116-118
username authentication, 112-114
Secure Service, 65
service-side configuration requirements, 69-70
R SSL, 83-88
Reliable Message Delivery, 146 transport-layer, 77
reliable messaging, 57-61, 146 security context token, 59
configuration options, 57-58 security mechanisms, 65, 76-82
overview, 22-23, 32-34 configuration options, 145-149
performance degradation, 57 Endorsing Certificate, 79
secure conversation and, 59 issues addressed, 137-138
reliable messaging options Message Authentication over SSL, 79
enabled/disabled, 57 Mutual Certificates Security, 77
flow control, 58 SAML Authorization over SSL, 79
217
Index
X
XML Infoset, 28