You are here: FME Server Developer's Guide > Developing with the Web Services > REST Service > Java Quick Start

Java Quick Start

The REST API can be browsed through a web browser at http://<host>:<port>/fmerest/.

Setting up a Java Project Using Eclipse and Apache HTTP Client

  1. Visit http://hc.apache.org to download the Apache HTTP Client.
  2. You will also need the following dependencies:

    commons-codec

    commons-logging

    junit

    Refer to http://hc.apache.org/httpclient-3.x/dependencies.html for details.

  3. Unzip the downloaded file.
  4. You should see in the lib folder containing several JAR files.

  5. Start Eclipse.
  6. Choose File > New > Project and select Java Project.
  7. Enter FMEServerRESTAPIDemo for the project name.
  8. In the Java Settings dialog under the Libraries tab, click on Add External JARs button and select the commons-httpclient, commons-codec, and commons-logging JAR files in the Apache HTTP Client lib folder to add to your project.
  9. The names may be different depending on version. You may also select all JARs in the folder.

  10. Now add a Java Class file and import the Apache HTTP Client namespace.
  11. This, for example, can be done with the following line of code:

    import org.apache.commons.httpclient.*;

Running the API Sample demo

A sample command-line demo application illustrating the use of the FME Server REST API is available in Java and JavaScript versions. The JavaScript version, however, has limited functionality due to security issues.

This demo can be used to ensure that everything has been setup properly, and contains code that may be useful for your development process. (More in-depth coverage can be found in the later sections.)

The Java command-line application requires two parameters: the FME Server host and FME Server port.

The Java source code was developed using Java JDK V1.5 and is located in:

<FMEServerDir>\Server\sdk\doc\java\FMEServerRESTAPIdemo.java

Add the source code to your project, and run.

Usage: FMEServerRESTAPIDemo <fmeServerHost> <fmeServerPort>

Note:  <fmeServerHost> represents the name of the host on which the Web Server is running.

<fmeServerPort> represents the TCP/IP port number the Web Server is listening on for requests. The default value is 80 and this is usually correct for most FME Server installations.

Safe Software Inc. www.safe.com