Web Service

Introduction

Hop has a simple way of exposing data through a servlet.

For more information on configuring the Hop server check the Hop Server docs

Web Service Metadata

Screenshot

Web Service metadata example

Options

OptionDescription

Name

The name of the web service. This is the name that is passed into the webService URL.

Enabled

Enables or disabled the web service

Filename on the server

This is the filename on the server. Make sure that the pipeline you want to execute is available on the server.

Output transform

The name of the transform from which this service will take the output row(s).

Output field

The output field from which this service will take data from, convert it to a String and output it

Content type

The content type which will get reported by the webService servlet

List status on server

Enable this option if you want the executions of the web service pipeline to be listed in the status of the server.

Hop Server configuration

Your Hop Server needs to know about the metadata you defined. As stated above you need to make sure the server has access to the pipeline(s) you want to execute as well as the server metadata.

The best way to do this is to set the following option in your XML configuration file:

  1. <metadata_folder>/path/to/your/metadata</metadata_folder>

A simple example would be:

  1. <hop-server-config>
  2. <hop-server>
  3. <name>8181</name>
  4. <hostname>localhost</hostname>
  5. <port>8181</port>
  6. </hop-server>
  7. <metadata_folder>/home/hop/project/services/metadata</metadata_folder>
  8. </hop-server-config>

Using the service

Base request

  1. http://<hop-server-url>/hop/webService

Request parameters

ParameterDescription

service

The name of the service. This corresponds to the Web Service metadata object.

Any parameter name

Any parameter can be set simply by passing the value through the request URL

Any variable name

Any variable can be set simply by passing the value through the request URL

Request example

The following executes Hop Web Service test as seen in the screenshot above. It passes a parameter B and a variable A and outputs JSON produced by a JSON Output transform.

  1. http://localhost:8181/hop/webService/?service=test&A=valueA&B=valueB

The web service pipeline looks like this:

Web Service pipeline example