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 profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

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]

Build an RPC service and client using JAX-RPC

Using the Java APIs for building RPC-based Web services

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:  Remote procedure calls (RPCs) are the precursors to modern Web services that are based on the Simple Object Access Protocol (SOAP) or Representational State Transfer (REST). Because all of the Java™ platform's Web service APIs are built on the concepts introduced in RPC, understanding the Java APIs for XML-Based RPC (JAX-RPC) is an almost mandatory step for writing efficient and effective Web services in the Java language. This tutorial takes you through getting and installing JAX-RPC, configuring it, and building a server-side RPC receiver and a simple client-side application.

Date:  15 Jul 2008
Level:  Introductory PDF:  A4 and Letter (679 KB)Get Adobe® Reader®

Activity:  37393 views
Comments:  

Before you start

About this tutorial

This tutorial is a complete guide to installing, configuring, building, and exercising (running) Web services that are based on remote procedure calls (RPCs). You'll download and install an implementation of the Java APIs for XML-Based RPC (JAX-RPC), learn how JAX-RPC is represented in Java classes and packages, and build both a client and server to allow for RPC-based interactions. Configuration options are covered, and you'll become comfortable deploying your own RPC-based applications.


Objectives

This tutorial walks you through the construction of JAX-RPC Web services, from start to finish. More important, you'll see how all Web services are constructed. This tutorial covers the basics of client-server interactions in a service-based architecture and explores RPC simply as one implementation of those principles.

You'll also gain a thorough understanding of the JAX-RPC APIs, all in the context of practical use. Although you won't use every method of every class, you'll know which classes and methods are essential in a real-world context, and why some methods are not useful. All of these concepts are presented in the context of building one working RPC-based client and server.

Because service-based architectures are less direct — and somewhat harder to manage — than a typical client-server Web interaction (such as an HTML front-end making POST requests to a Java servlet), they're harder to implement well. This tutorial explores some of the best practices for building Web services, as well as common mistakes.

You'll also:

  • Understand the basics of JAX-RPC as they relate to the wider scope of Web services
  • See how RPC-based services are different from SOAP- and REST-based services
  • Understand when RPC services are still a good choice, despite some of the more "modern" approaches to Web services

Prerequisites

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'll also 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. Details about how to configure JAX-RPC on those servers are included in the tutorial, so you don't need to understand the relationship between JAX-RPC's servlets and your Web server yet.

Knowledge of Java servlets and Apache Tomcat (particularly the servlet-hosting facilities and the web.xml deployment descriptor file) is helpful, although not strictly required.

See Resources for pointers to additional information on these topics.

This tutorial focuses on JAX-RPC and the Apache Axis open source implementation of JAX-RPC, but no previous knowledge of RPC, JAX-RPC, or Apache Axis is required. Details regarding their download, installation, and configuration are covered in the tutorial.

1 of 11 | Next

Comments



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Java technology, SOA and Web services
ArticleID=319837
TutorialTitle=Build an RPC service and client using JAX-RPC
publish-date=07152008
author1-email=brett@newInstance.com
author1-email-cc=jaloi@us.ibm.com