O'Reilly logo

Java™ Web Services Unleashed by Mark Wutka, Joseph Weber, Arthur Ryman, K. Scott Morrison, Benoît Marchal, Matthias Kloppmann, Steven Haines, Darren Govoni, Francisco Curbera, Frank Cohen, Robert Brunner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Apache SOAP Client

First, use the classes provided by Apache SOAP to test the service. Apache provides a powerful abstraction in its Call class. In Call, you identify the service name you want to access, its location, and its arguments:

Listing 19.3. TimeServerClient, an Apache SOAP Client for the TimeServer SOAP Endpoint.
 package com.sams.jws.chapter19; import java.util.Vector; import java.net.URL; import org.apache.soap.Constants; import org.apache.soap.Fault; import org.apache.soap.SOAPException; import org.apache.soap.rpc.Call; import org.apache.soap.rpc.Parameter; import org.apache.soap.rpc.Response; public class TimeServerClient { public static void main(String[] args) throws Exception { URL url = new URL("http://localhost:8080/soap/servlet/rpcrouter"); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required