Skip to content

Toro Cloud Dev Center

Quick start tutorial: Invoking a service over HTTP

Estimated time to complete: 1 minute

In the previous tutorial page, you learned how to create and run a service in Martini. Running a service in the IDE is typically done by developers whilst writing and testing a service. In the real world however, services are often invoked over HTTP.

There are several different ways to invoke a service over HTTP in Martini, such as:

This tutorial will discuss how to invoke a service over HTTP using the service invoker. The service invoker is also typically used during development in order to simulate an HTTP call. To do this:

  1. Right click on your service from the Navigator, then select Invoke in Browser (or Invoke in New Tab in Martini Online) from the appearing context menu. This will open a new tab showing the service invoker user interface.

    Invoking a service in browser

    Invoking a service in browser

  2. Provide the required service inputs using the service invoker form.

    Service invoker form

  3. Click Invoke.

Upon clicking the Invoke button, the service will be executed and its output will be returned as the response. The response will be displayed in the browser according to the selected format.

If you invoke the hello service, you'll notice the response will be in plain text. This is because the service output is just a single string property.

Hello, Bob

If a service's return value has multiple properties, or is wrapped in a model, the response returned will be in JSON or XML, depending on the selected response type. For example:

    "greeting": "Hello, Bob",
    "farewell": "Goodbye, Bob"

You can learn more about how Martini and Gloop write responses here.