Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Customize JAX-RPC Web services and clients with advanced tools

Use Apache Axis tools to generate Web services and clients and configure advanced options

Brett McLaughlin (brett@newInstance.com), Author/editor, O'Reilly Media
Author1 photo
Brett McLaughlin is a best-selling and award-winning nonfiction author. His books on computer programming, home theater, and analysis and design have sold in excess of 100,000 copies. He has been writing, editing, and producing technical books for nearly a decade, and is as comfortable in front of a word processor as he is behind a guitar, chasing his two sons around the house, or laughing at reruns of Arrested Development with his wife. His most recent book, Head First Object Oriented Analysis and Design, won the 2007 Jolt Technical Book award. His classic Java and XML remains one of the definitive works on using XML technologies in the Java language.

Summary:  This tutorial takes you beyond the basics of the JAX-RPC and shows how to customize your JAX-RPC Web services and clients with the help of Apache Axis. On the client side, you can autogenerate much of the code required to connect with new JAX-RPC Web services, focusing your time on the interactions themselves rather than on routine Web service calls. On the server side, you can add additional options, limit the methods you expose, and restrict parameters you'll accept. All of this is possible with a little customization and a deeper understanding of the Apache Axis toolset.

Date:  19 Aug 2008
Level:  Intermediate PDF:  A4 and Letter (258 KB)Get Adobe® Reader®

Activity:  8154 views
Comments:  

Before you start

About this tutorial

This tutorial is a guide to the more advanced feature set of Apache Axis and its JAX-RPC capabilities. You'll learn how to autogenerate client programs from a Web Services Description Language (WSDL) file, making consumption of JAX-RPC services simple. You'll also learn how to deploy your Web service restrictively, limiting the methods and parameters available for other users to work with. Along the way, you'll gain a deeper and more thorough understanding of Apache Axis and how it configures, sends, and receives JAX-RPC requests and responses.


Objectives

Most Java™-based Web services begin as stand-alone Java classes. Those classes are then converted to Web services, often simply by being dropped into an autodeploy directory in a Web service toolkit. However, in many cases it isn't appropriate to expose every method on a Java class as a Web service. By default, though, that's exactly what most Web service toolkits do: let the world use each and every public method in your Java class. This tutorial will help you learn not only how to specify which methods should be exposed — and which should not — but also how to make good decisions about what to expose.

WSDL has become the lingua franca of Web services. However, WSDL is extremely verbose, full of information that's marginally human-readable, and generally a pain to deal with. Fortunately, Web service toolkits like Apache Axis make it simple to feed a WSDL file to a command-line program or Java process and get a set of mostly usable autogenerated classes. You'll learn how to use Axis' code-generation utilities, as well as what you need to change in that generated code to get it working quickly and efficiently.

You'll also:

  • Become familiar with the various command-line code-generation tools that Axis offers
  • Learn how to construct Web services that protect both private and public methods from Web access
  • See which Java idioms do not translate well to a Web service environment

Prerequisites

This tutorial is a follow-on to "Build an RPC service and client using JAX-RPC." It is highly recommended that readers who are unfamiliar with JAX-RPC programming complete that tutorial before beginning this one. Regardless of your JAX-RPC experience, you'll find it easier to follow this tutorial if you work through that one first.

This tutorial is written for Java programmers. You should be comfortable coding Java applications and working with standard and third-party Java APIs and toolkits. You should be comfortable writing simple Web services and clients that consume them. You should also have deployed at least one Web service via dropping a Java class into Apache Axis' webapps/axis directory. This autodeployment feature is the basis of much of this tutorial's advanced discussion, so familiarity with that deployment mechanism is critical.

Basic familiarity with WSDL is helpful but not required. In fact, you can avoid many of the details surrounding WSDL by using the techniques detailed in this tutorial for code autogeneration.


System requirements

You need a Web server that's capable of hosting server-side Java applications (servlets). You can use any Java-capable Web servlet container, application server, or hosting provider. One of the most popular solutions is Apache Tomcat, which is both free and well-documented. It's also up to you whether you test out your programs on a remote server (at your company or an ISP), or on your local machine. You just need to have the server installed and running on an accessible machine.

You should have Apache Axis installed and configured on your servlet engine/Web server. If you're unsure how to get Apache Axis running, you should refer to "Build an RPC service and client using JAX-RPC."

1 of 9 | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Java technology, SOA and Web services
ArticleID=331847
TutorialTitle=Customize JAX-RPC Web services and clients with advanced tools
publish-date=08192008
author1-email=brett@newInstance.com
author1-email-cc=jaloi@us.ibm.com

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).