SDSU CS 683 Emerging Technologies
Spring Semester, 2003
Java Soap Example
Previous    Lecture Notes Index    Next    
© 2003, All Rights Reserved, SDSU & Roger Whitney
San Diego State University -- This page last updated 11-Mar-03

Contents of Doc 13, Java Soap Example

Apache SOAP,

Doc 13, Java Soap Example Slide # 2

BabelFish Java Soap Example

Download and Install Java SOAP

Will use Apache SOAP as it supports client side usage

Download Apache SOAP at:

I used version 2.3.1

The directions at: are useful.

You need to download the following:



Apache Xerces compiler

You need to have the following in your classpath:


I have yet to determine if one really needs all these jar files

Doc 13, Java Soap Example Slide # 3
Simple Example
Modified from Apache SOAP example

import org.apache.soap.rpc.Call;
import org.apache.soap.rpc.Parameter;
import org.apache.soap.rpc.Response;
import org.apache.soap.Constants;
import org.apache.soap.Fault;

import java.util.*;

public class BabelFishExample {
   public static void main( String[] arguments) throws Exception {
      Call test = new Call();
      test.setTargetObjectURI ("urn:xmethodsBabelFish");
      test.setMethodName ("BabelFish");
      Vector params = new Vector ();
      params.addElement (
         new Parameter("translationmode", String.class, "en_de", null));
      params.addElement (
         new Parameter("sourcedata", String.class, "this is a test", null));
      test.setParams (params);
      URL service = 
         new URL("");
      Response translation = test.invoke ( service,  "" );
      if (translation.generatedFault ()) {
         Fault fault = translation.getFault ();
         System.err.println("Generated fault: " + fault);
      } else {
         Parameter result = translation.getReturnValue ();
         System.out.println (result.getValue ());

Copyright ©, All rights reserved.
2003 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA.
OpenContent license defines the copyright on this document.

Previous    visitors since 11-Mar-03    Next