Newsletter sign-up
View all newsletters

Sign up for our Enterprise Java Newsletter

Enterprise Java

Mustang: The fast track to Web services

Java SE eases Web services development and consumption

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone

If you haven't been keeping up with what Sun Microsystems has been cooking up for the next release of Java, here is a wakeup call: For months now, Sun has been providing early releases of binaries, Javadocs, and source code for Java Platform, Standard Edition 6 (Java SE is Sun's new name for J2SE), also known as Mustang. And it is not too late to hitch your wagon to this galloping horse.

An obvious question is, "Why should I care?" For the skeptic, Java SE 6 has improvements across the board, from opening programmatic access to the Java compiler, to system-tray and splash-screen components, to mixing scripting languages with your Java source code (with JavaScript supported out-of-box), to a dapper look and feel in Swing, to XML digital signatures, to the Smart Card I/O API, to JMX monitor threading improvements, to Web services annotations for service providers and simplified client access—to name just a few of the new features coming our way. (The java.net Website provides everything you wanted to know about this new release.)

In this article, we focus on the improvements to the Web Services Metadata specification and Java API for XML Web Services (JAX-WS) 2.0 in Java SE 6 that make both development and consumption of Web services quite easy. Using these new features, we create a Web service from a simple Java class by merely slapping on annotations; thereafter, we consume this service using JAX-WS 2.0. We even add a handler to the service that intercepts the service call and dumps the SOAP messages to System.out.

Actually, these features have been available as after-market downloads that implement Java Specification Request 181 (Web Services Metadata) and JSR 224 (JAX-WS). Having these features part of the standard Java release makes them more mainstream; expect to see proliferated support in IDEs soon.

JSR 181 and JSR 224 are also part of Java EE 5, which allows application vendors to supply hosting platforms for Web services based on the standard specification. Ideally, such functionality would allow inchoate Web service applications deployed on just the Java SE 6 Java Runtime Environment to scale to large workload deployments by using application servers that support the same specifications without codebase changes—reality aside, that is at least the hope.

Our Mustang Web service: Server and client

Before we let the horses out of stables, download the zip file that accompanies this article. It contains the following four files (the jar files are just for convenience):

  • mustangws.zip contains this article's Web service server application source code, build file, and wsgen script file
  • mustangwsclient.zip contains the client application source code, build file, and wsimport script file
  • mustangws.jar contains the compiled application for our server
  • mustangwsclient.jar contains the compiled application for our client

Note: You'll need Java SE 6 and Apache Ant to work with this article's example.

After you unzip the files, you will have two folders, mustangws and mustangwsclient, with each corresponding to a server and client application. Both projects have the familiar src folder containing Java source files and Apache Ant's build.xml under it. There are additional wsgenMustang.bat and wsimportMustang.bat files that contain console commands for generating Web service artifacts and stubs, which I cover later in this article.

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Comments (1)
Login
Forgot your account info?

noneBy Anonymous on October 16, 2009, 1:00 pmsdsad

Reply | Read entire comment

View all comments

Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a JavaWorld account? Log in here. Register now for a free account.
Resources