The Artima Developer Community
Sponsored Link

Java Community News
Writing a Java Web Service with JAX-WS 2.0

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

Writing a Java Web Service with JAX-WS 2.0 Posted: Jun 13, 2006 8:16 AM
Reply to this message Reply
Summary
The Java API for XML-Based Web Services (JAX-WS) 2.0 (JSR 224) defines a streamlined way to write Java Web services. In a recent java.net article, John Ferguson Smart shows how to write a complete JAX-WS 2.0 Web service, using annotations to factor out most WS-related details.
Advertisement

Annotations pervade much of the new Java EE 5 APIs, providing a more programmer-friendly environment. The Web service-related components in Java EE 5 benefit from the use of annotations chiefly by hiding much Web service-related tedium from the developer.

The latest Java API for XML-Based Web Services (JAX-WS) 2.0 (JSR 224), takes advantage of annotations extensively in mapping WS-related metadata to Java classes and service interfaces, and provides features such as direct support for JAXB 2.0-based data binding, support for the latest W3C and WS-I standards, such as SOAP 1.2, WSDL 1.2, an improved handler framework, and support for asynchronous RPC and non-HTTP transports.

An earlier Artima article, Three Minutes to a Web Service, took the early-access version of JAX-RPC 2.0 for a test-drive, demonstrating how annotations allow one to write a complete Web service with just 15 lines of code. JAX-RPC was subsequently renamed to JAX-WS, but most features of the early-access API were retained.

John Ferguson Smart's similar to-the-point tutorial, Web Services Made Easy with JAX-WS 2.0 on java.net, provides a complete Web service example using the reference implementation of JAX-WS 2.0:

JAX-WS (formerly JAX-RPC) is Sun's answer to the question of how to develop web services easily in Java. JAX-WS 2.0 provides a library of annotations and a toolkit of Ant tasks and command-line utilities that hide the complexity of the underlying XML message protocol. This new release supports different protocols such as SOAP 1.1, SOAP 1.2, and REST, and uses JAXB 2.0, also new to Java EE 5, for XML data binding.

When writing a JAX-WS 2.0 web service, the developer uses annotations to define methods either in an interface or directly in an implementation class (the interface can be automatically generated). On the client side, the web service client simply creates a proxy object, and then invokes methods on this proxy. Neither the server nor the client needs to generate or parse SOAP (or REST) messages; the JAX-WS 2.0 API takes care of these tedious low-level tasks.

While Web services have traditionally been associated with the overly-complex SOAP protocol, APIs such as JAX-WS 2.0, hide that protocol-level complexity. As these APIs become widely available in every Java EE 5 implementation, do you see yourself writing more Web services or Web service clients?

Topic: Writing a Java Web Service with JAX-WS 2.0 Previous Topic   Next Topic Topic: Drools 3 Released

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use