Learn By Doing: Building a Web Service Client

The best way to learn about web services is to get first-hand experience with them. Let's write a Java program to use a real web service, the Interfax web service. All of the steps outlined above are done for you in the distribution that accompanies this tutorial. In the tutorial distribution, you will find a fully-working copy of the demo program we're about to build below.

Workspace Setup

First, we need to create a workspace for our Java program. Following convention, let's build a sensible set of directories to hold our source code and documentation. You can do this in a new directory if you like, these directories already exist in the distribution of this tutorial:

/tutorial
   /src
   /doc

We will build our project using Apache ANT. You should have ANT installed on your system--you can get the latest version
here. We will need a simple ANT build file to get us started. Below is a slightly modified copy of the sample build.xml file from the ANT manual. We'll put this build file (build.xml) in our tutorial directory:

/tutorial/build.xml

<project name="MyProject" default="dist" basedir=".">
    <description>
        Interfac Tutorial build file
    </description>
  <!-- set global properties for this build -->
  <property name="src" location="src"/>
  <property name="build" location="build"/>
  <property name="dist"  location="dist"/>
 
  <target name="init">
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}"/>
  </target>
 
  <target name="compile" depends="init"
        description="compile the source " >
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}"/>
  </target>
 
  <target name="dist" depends="compile"
        description="generate the distribution" >
    <!-- Create the distribution directory -->
    <mkdir dir="${dist}"/>
 
    <!-- Put everything in ${build} into the MyProject.jar file -->
    <jar jarfile="${dist}/MyProject.jar" basedir="${build}"/>
  </target>
 
  <target name="clean"
        description="clean up" >
    <!-- Delete the ${build} and ${dist} directory trees -->
    <delete dir="${build}"/>
    <delete dir="${dist}"/>
  </target>
</project>

Interfax Account Creation

Please be sure to create an account with Interfax at this point. Registration is free and can be done online http://www.interfax.net/Scripts/Reg_BP.asp. You will need your Interfax username and password to send faxes through the Interfax web service, be sure to have both handy. To avoid typing them over and over again, it's a good idea to put them in one place where we can reference them. We'll create a TestConstants class for this as shown below.

/*
 * These are constants used throughout our tests.  Moved there here to avoid
 * repeating them in each test.
 */
public class TestConstants {
 
    // Replace with your Interfax username and password.
    public static final String USERNAME = "username";
    public static final String PASSWORD = "password";
}

Apache Axis Toolkit

Connecting to a web service involves several steps. You have to first have the WSDL document describing the service you're going to connect to. The WSDL for the Interfax web service is available here: http://ws.interfax.net/dfs.asmx?wsdl. (Note: If you want to use SSL to securely communicate with the Interfax web service, use an https URL instead: https://ws.interfax.net/dfs.asmx?wsdl).

WSDL documents can be difficult to interpret and they are often quite complicated. One popular example, the WSDL for Ebay's web services, is 1.92 MB big in its latest version! Fortunately, you don't have to learn how to read and decipher WSDL to use webservices. In fact, you don't usually have to learn how to parse XML, make HTTP connections, or read XML Schema. Programmers have automated these processes in SOAP toolkits, special software that can be used to generate a set of Java classes that you can use directly to call a web service. Several SOAP toolkits exist for Java programmers, and the most popular and capable today is the Axis toolkit from the Apache Organization. This toolkit is nothing more than a set of Java classes itself which reads a WSDL, interprets it, and generates a set of Java classes which will call the web service specified in the WSDL.

You can download the latest Axis 1.x distribution from Apache here: http://ws.apache.org/axis/ or you can use the version in the distribution of this tutorial (1.4). Either way, you should have a set of jar files from the Axis distribution in a new lib directory in your workspace that looks like the listing below. (Note that Apache has release Axis 2 which is completely new SOAP implementation and not what we're using for this tutorial. For best results, use Axis 1.4).

tutorial/lib/
    axis-ant.jar
    axis.jar
    commons-discovery-0.2.jar
    commons-logging-1.0.4.jar
    jaxrpc.jar
    log4j-1.2.8.jar
    log4j.properties
    saaj.jar
    wsdl4j-1.5.1.jar

At this point, we'll make a couple of additions to our build.xml file to add these jar files to our classpath and to enable a special ANT task that will generate our web service client starter code for us. Additions are in red. Don't be alarmed the only changes we made were the following:

  • Added a lib directory
  • Added a generated directory for Java classes generated by Axis
  • Established a classpath that simply includes everything in our lib directory
  • Added a hardcoded reference to the Interfax WSDL URL
  • Imported the ANT tasks that come with Axis, including the WSDL-to-Java task which we will use
  • Created a new target called code.generation to call the axis-wsdl2java task on the Interfax WSDL
  • Updated our compile task to build the Java code generated by Axis as well as the Java code in our src directory
<project name="MyProject" default="dist" basedir=".">
    <description>
        Interfac Tutorial build file
    </description>
  <!-- set global properties for this build -->
  <property name="lib" location="lib"/>
  <property name="generated" location="generated"/>
  <property name="src" location="src"/>
  <property name="build" location="build"/>
  <property name="dist"  location="dist"/>
 
  <!-- Establish a classpath we can use in the compile target.-->
  <path id="compile.classpath">
      <fileset dir="${lib}">
        <include name="**/*.jar" />
      </fileset>
  </path>
 
  <!-- Hardcoded Interfax service URL -->
  <property name="wsdl.url" value="http://ws.interfax.net/dfs.asmx?WSDL"/>
 
  <!-- Apache Axis comes with a pre-built wsdl-to-java ANT task.  The following
       path and taskdef make this ANT task available to us. -->
  <taskdef resource="axis-tasks.properties" classpathref="compile.classpath" />
 
  <target name="init">
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}"/>
    <mkdir dir="${generated}"/>
  </target>
 
  <target name="code.generation" depends="init" description="generate the Java stubs for accessing the InterFAX web service">
  <axis-wsdl2java
      output="${generated}"
      testcase="false"
      verbose="true"
      nowrapped="true"
      url="${wsdl.url}" >
      <mapping
          namespace="http://axis.apache.org/ns/interop"
          package="interop" />
  </axis-wsdl2java>
  </target>
 
  <target name="compile" depends="code.generation"
        description="compile the source " >
    <!-- Compile the java code from ${generated} into ${build} -->
    <javac srcdir="${generated}" destdir="${build}">
        <!-- Compilation Classpath -->
        <classpath>
            <path refid="compile.classpath" />
        </classpath>
    </javac>
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}">
        <!-- Compilation Classpath -->
        <classpath>
            <path refid="compile.classpath" />
        </classpath>
    </javac>
  </target>
 
  <target name="dist" depends="compile"
        description="generate the distribution" >
    <!-- Create the distribution directory -->
    <mkdir dir="${dist}"/>
 
    <!-- Put everything in ${build} into the MyProject.jar file -->
    <jar jarfile="${dist}/MyProject.jar" basedir="${build}"/>
  </target>
 
  <target name="clean"
        description="clean up" >
    <!-- Delete the ${build} and ${dist} directory trees -->
    <delete dir="${build}"/>
    <delete dir="${dist}"/>
    <delete dir="${generated}"/>
  </target>
</project>

Here's the output from building with the updated build file:

$ ant
Buildfile: C:\workspace\InterfaxJavaTutorial\build.xml
init:
    [mkdir] Created dir: C:\workspace\InterfaxJavaTutorial\build
    [mkdir] Created dir: C:\workspace\InterfaxJavaTutorial\build\dist
    [mkdir] Created dir: C:\workspace\InterfaxJavaTutorial\build\test
    [mkdir] Created dir: C:\workspace\InterfaxJavaTutorial\generated
code.generation:
[axis-wsdl2java] - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
 
[axis-wsdl2java] WSDL2Java http://ws.interfax.net/DFS.asmx?WSDL
[axis-wsdl2java] Parsing XML file:  http://ws.interfax.net/DFS.asmx?WSDL
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\CancelFileUpload.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\ReSendFaxResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\SendfaxEx_2Response.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\GetSupportedFileTypes.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\Sendfax.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\SendfaxEx_2.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\IsSupportedFileTypeResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\FaxStatusXML.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\FaxQueryResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\HideFaxResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\SendCharFaxResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\FaxItem.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\FaxStatus.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\CancelFileUploadResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\SendfaxEx.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\FaxStatusExResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\FaxStatusResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\HideFax.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\FaxItemEx.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\GetFaxImage.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\FaxQuery.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\IsSupportedFileType.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\FaxStatusXMLResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\GetFaxImageResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\SendCharFax.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\UploadFileChunk.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\FaxStatusEx.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\SendfaxResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\SendfaxExResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\GetSupportedFileTypesResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\StartFileUpload.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\StartFileUploadResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\UploadFileChunkResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\ReSendFax.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\InterFaxSoap.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\InterFaxSoapStub.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\InterFax.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\InterFaxLocator.java
 
compile:
    [javac] Compiling 38 source files to C:\workspace\InterfaxJavaTutorial\build\dist
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] Compiling 11 source files to C:\workspace\InterfaxJavaTutorial\build\test
dist:
    [mkdir] Created dir: C:\workspace\InterfaxJavaTutorial\dist
      [jar] Building jar: C:\workspace\InterfaxJavaTutorial\dist\Interfax.jar
BUILD SUCCESSFUL
Total time: 12 seconds

The important thing to notice above is that Axis did a lot of the hard work for us. It downloaded the Interfax web service WSDL, parsed it, and generated several new Java classes that we can use to call the Interfax web service. This has saved us tons of time and frustrating trial and error. With a little more effort, we'll be ready to use the Interfax SOAP service from Java programs.

Of all the files Axis generated, InterFaxSoapStub.java is the most important because, as its name implies, it acts as a stub that can be used to call the Interfax web service. This stub class has various methods on it (listed below) which correspond to the methods described in the Interfax WSDL file. Axis translated the WSDL into methods we can call from our code without having to worry about the details of how each call gets made. This is very similar to RMI, which also allows you to make simple method calls that hide the details of the remote call that's happening under the hood.

All of the methods in InterFaxSoapStub are documented on the Interfax website--keep in mind that each method (and the description that appears for each one) came directly from the WSDL that Axis interpreted for us.

/**
 * This is the simplest method to fax ASCII text.  Also allows
 * structured text documents, such as HTML, PostScript, etc.  (To fax
 * an attachment simply - use the SendFax method.)
 */
public cc.interfax.www.SendCharFaxResponse sendCharFax(cc.interfax.www.SendCharFax parameters) throws java.rmi.RemoteException;
 
/**
 * This is the simplest method to fax an attached file.  Five
 * parameters are all that's required.  (To fax a simple text message
 * - use the SendCharFax method.)
 */
public cc.interfax.www.SendfaxResponse sendfax(cc.interfax.www.Sendfax parameters) throws java.rmi.RemoteException;
 
/**
 * [Retained for backward-compatibility; replaced by SendfaxEx_2]
 */
public cc.interfax.www.SendfaxExResponse sendfaxEx(cc.interfax.www.SendfaxEx parameters) throws java.rmi.RemoteException;
 
/**
 * The most feature-filled fax sending method.  Allows full control
 * over all aspects of fax transmission.  Adds page-control features
 * not previously found in the SendfaxEx method.
 */
public cc.interfax.www.SendfaxEx_2Response sendfaxEx_2(cc.interfax.www.SendfaxEx_2 parameters) throws java.rmi.RemoteException;
 
/**
 * This is a simple method to resend a fax. Four parameters are
 * all that's required
 */
public cc.interfax.www.ReSendFaxResponse reSendFax(cc.interfax.www.ReSendFax parameters) throws java.rmi.RemoteException;
 
/**
 * Returns full information (27 fields - see<a href="http://www.interfax.net/en/dev/webservice/reference.html#faxstatusex">Reference</a>)
 * regarding a fax transaction's current status.
 */
public cc.interfax.www.FaxStatusExResponse faxStatusEx(cc.interfax.www.FaxStatusEx parameters) throws java.rmi.RemoteException;
 
/**
 * Returns full information (27 fields - see <a href="http://www.interfax.net/en/dev/webservice/reference.html#faxstatusex">Reference</a>)
 * regarding a population determined by Verb.
 */
public cc.interfax.www.FaxQueryResponse faxQuery(cc.interfax.www.FaxQuery parameters) throws java.rmi.RemoteException;
 
/**
 * Returns quick and minimal information (11 fields - see <a href="http://www.interfax.net/en/dev/webservice/reference.html#faxstatusex">Reference</a>)
 * regarding a fax transaction's current status.
 */
public cc.interfax.www.FaxStatusResponse faxStatus(cc.interfax.www.FaxStatus parameters) throws java.rmi.RemoteException;
 
/**
 * Similar to FaxStatusEx, however, returns information in XML-formatted
 * structure.
 */
public cc.interfax.www.FaxStatusXMLResponse faxStatusXML(cc.interfax.www.FaxStatusXML parameters) throws java.rmi.RemoteException;
 
/**
 * Returns a TIF file of a transactions rendered document.
 */
public cc.interfax.www.GetFaxImageResponse getFaxImage(cc.interfax.www.GetFaxImage parameters) throws java.rmi.RemoteException;
 
/**
 * A utility method to obtain the currently supported file types.
 */
public cc.interfax.www.GetSupportedFileTypesResponse getSupportedFileTypes(cc.interfax.www.GetSupportedFileTypes parameters) throws java.rmi.RemoteException;
 
/**
 * A utility method to verify if a given file type is supported.
 */
public cc.interfax.www.IsSupportedFileTypeResponse isSupportedFileType(cc.interfax.www.IsSupportedFileType parameters) throws java.rmi.RemoteException;
 
/**
 * This is a simple method to hide a transaction in the log
 */
public cc.interfax.www.HideFaxResponse hideFax(cc.interfax.www.HideFax parameters) throws java.rmi.RemoteException;
 
/**
 * Start an Upload session; Returns a Session ID string, to be
 * used by subsequent calls.
 */
public cc.interfax.www.StartFileUploadResponse startFileUpload(cc.interfax.www.StartFileUpload parameters) throws java.rmi.RemoteException;
public cc.interfax.www.UploadFileChunkResponse uploadFileChunk(cc.interfax.www.UploadFileChunk parameters) throws java.rmi.RemoteException;
public cc.interfax.www.CancelFileUploadResponse cancelFileUpload(cc.interfax.www.CancelFileUpload parameters) throws java.rmi.RemoteException;

LoadSupportedFileTypes

Let's make our first web service call. We'll start off simple with a call that asks the Interfax SOAP service for the list of file types it understands. Below is a simple class that uses the InterFaxSoapStub class generated by Axis to call the GetSupportedFileTypes SOAP method. The web service call is highlighted in red.

import cc.interfax.www.GetSupportedFileTypes;
import cc.interfax.www.GetSupportedFileTypesResponse;
 
public class GetSupportedFileTypesTest {
 
    public void run() throws Exception {
        cc.interfax.www.InterFaxSoapStub theBinding;
 
        try {
           theBinding = (cc.interfax.www.InterFaxSoapStub)
                         new cc.interfax.www.InterFaxLocator().getInterFaxSoap();
        }
        catch (javax.xml.rpc.ServiceException jre) {
            if(jre.getLinkedCause()!=null)
                jre.getLinkedCause().printStackTrace();
            throw new RuntimeException("JAX-RPC ServiceException caught: " + jre);
        }
 
        // Time out after a minute
        theBinding.setTimeout(60000);
 
        GetSupportedFileTypesResponse response =
            theBinding.getSupportedFileTypes(new GetSupportedFileTypes());
 
        String theSupportedFileTypesStr = response.getGetSupportedFileTypesResult();
        System.out.println(theSupportedFileTypesStr);
    }
 
 
    public static void main(String[] anArgs) {
        try {
            new GetSupportedFileTypesTest().run();
        } catch(Exception theE) {
           System.out.println("Error encountered while running GetSupportedFileTypesTest:");
           theE.printStackTrace();
        }
     }
}

We'll add the following target to our ANT build script so we can run our test program using ANT.

<target name="run-get-supported-types-test" depends="dist" description="Test that makes a GetSupportedFileTypes call" >
    <java classname="GetSupportedFileTypesTest">
       <arg value="-h"/>
       <classpath>
         <pathelement location="dist/Interfax.jar"/>
         <pathelement path="${build}/test/"/>
         <pathelement path="${java.class.path}"/>
         <path refid="compile.classpath"/>
       </classpath>
    </java>
</target>

Invoking this target should produce output similar to what appears below.

$ ant run-get-supported-types-test
Buildfile: C:\workspace\InterfaxJavaTutorial\build.xml
init:
code.generation:
[axis-wsdl2java] - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
[axis-wsdl2java] WSDL2Java http://ws.interfax.net/DFS.asmx?WSDL
[axis-wsdl2java] Parsing XML file:  http://ws.interfax.net/DFS.asmx?WSDL
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\CancelFileUpload.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\ReSendFaxResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\SendfaxEx_2Response.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\GetSupportedFileTypes.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\Sendfax.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\SendfaxEx_2.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\IsSupportedFileTypeResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\FaxStatusXML.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\FaxQueryResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\HideFaxResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\SendCharFaxResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\FaxItem.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\FaxStatus.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\CancelFileUploadResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\SendfaxEx.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\FaxStatusExResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\FaxStatusResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\HideFax.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\FaxItemEx.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\GetFaxImage.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\FaxQuery.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\IsSupportedFileType.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\FaxStatusXMLResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\GetFaxImageResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\SendCharFax.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\UploadFileChunk.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\FaxStatusEx.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\SendfaxResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\SendfaxExResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\GetSupportedFileTypesResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\StartFileUpload.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\StartFileUploadResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\UploadFileChunkResponse.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\ReSendFax.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\InterFaxSoap.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\InterFaxSoapStub.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\InterFax.java
[axis-wsdl2java] Generating C:\workspace\InterfaxJavaTutorial\generated\cc\interfax\www\InterFaxLocator.java
compile:
    [javac] Compiling 38 source files to C:\workspace\InterfaxJavaTutorial\build\dist
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
dist:
      [jar] Building jar: C:\workspace\InterfaxJavaTutorial\dist\Interfax.jar
run-get-supported-types-test:
     [java] - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
     [java] ,XML,RTF,DOC,DOT,TXT,PDF,HTM,HTML,TIF,TIFF,GIF,PNG,JPG,JPEG,PS,EPS,URL,XLS,PPT,PCX,SNP,MHT,BMP
BUILD SUCCESSFUL
Total time: 16 seconds

The response from the web service is this String which verifies that PDF is a supported file type, along with many others: ,XML,RTF,DOC,DOT,TXT,PDF,HTM,HTML,TIF,TIFF,GIF,PNG,JPG,JPEG,PS,EPS,URL,
XLS,PPT,PCX,SNP,MHT,BMP

We cam access all of the Interfax web service calls using the Axis-generated stub class. Our ultimate goal is to send a fax and there are various methods in the Interfax web service to do that. Below we'll use SendCharFax and SendFax to fax a simple text message and a PDF document.