Skip to content

Home

Development

IDEs

API Explorer

Releases

Release notes

Martini Runtime

Martini Desktop

Martini Online

Feature requests

Bug reports

examples package: Gloop REST and SOAP APIs

Martini offers a simple, graphical way to expose APIs: Gloop APIs. Gloop REST APIs allow developers to easily expose RESTful web services to their clients; and likewise, Gloop SOAP APIs are available for easily exposing SOAP web services.

The examples package shows how Gloop REST and SOAP APIs can be used in order to make services (a Gloop service in this example) available over HTTP. These Gloop APIs are named apis.restApi.HelloYou.api and apis.soapApi.HelloYouSOAP.api, respectively. Both use and expose the apis.service.HelloYouService.gloop service.

Related articles

Please see the following articles for more information:

Try it!

For the provided examples to work, the package must be running, and the APIs must be enabled. As long as these requirements are satisfied, you can execute requests against the published web services to confirm their availability.

If you would like to inspect and/or further configure the APIs, go to the Navigator, expand the examples package, navigate to the code folder, then expand the apis package. This package will contain the Gloop REST and SOAP API files, and the service they both expose over HTTP:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
examples
├── ...
└── code
    └── apis
        ├── rest
           └── HelloYou.api
        ├── service
           └── HelloYouService.api
        └── soap
            └── HelloYouSOAP.api

Open the .api files to inspect the details of the REST and SOAP APIs. Edit these APIs' fields as you see fit and save to apply customizations.

Sending a REST request

To test the published RESTful web service, send a GET request to /api/sample/hello/${name}1. There are multiple ways you can do this.

You can execute the following cURL command in your terminal:

1
2
3
curl -X GET \
  http://<integrate-host>/api/sample/hello/world \
  -H 'Cache-Control: no-cache' \

You can create and send a request through Martini Desktop's HTTP Client using these steps:

Creating and sending a request using the HTTP Client

  1. Open the apis.restApi.HelloYou.api file.
  2. Click the Operations tab in the Gloop REST API editor.
  3. Right click the operation, and then select Invoke in HTTP Client from the appearing context menu.
  4. Click Send.

You can create and send a request through API Explorer using these steps:

Creating and sending a request using API Explorer

  1. Open the apis.restApi.HelloYou.api file.
  2. Click the Operations tab in the Gloop REST API editor.
  3. Click the API Explorer button from the toolbar.
  4. Expand the "Hello You" API on the left-hand side.
  5. Select the "GET /hello/{name}" operation.
  6. Click on the Try It Out! button.
  7. Click Execute.

If you have Postman installed, you can use it to invoke the REST API as follows:

Importing and sending a request in Postman

  1. Open the apis.restApi.HelloYou.api file
  2. Click on the Preview tab in the REST API editor.
  3. Select "postman.json" from the drop-down on the drop right.
  4. Right click on the provided URL, and select Copy Link.
  5. Open Postman, and click Import on the top-left.
  6. Select Import from Link, paste the URL, and then click Import.
  7. Open the newly imported operation, and click Send.

And the server will return a response similar to the following:

1
2
3
{
    "message": "Hello John Doe"
}
1
2
3
4
<?xml version="1.0"?>
<output>
    <message>Hello John Doe</message>
</output>

Sending a SOAP request

To test the SOAP endpoint, send a POST request to /soap/apis.soapApi.HelloYouSOAP.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
curl -X POST http://<host>:<port>/soap/apis.soapApi.HelloYouSOAP \
-H 'Content-Type: application/xml' \
-H 'SOAPAction: apis.service.HelloYouService' \
-d '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:glo="http://gloop.toro.io">
       <soapenv:Header/>
       <soapenv:Body>
          <glo:HelloYouServiceInput>
             <name>world</name>
          </glo:HelloYouServiceInput>
       </soapenv:Body>
    </soapenv:Envelope>'

The response will look something like:

1
2
3
4
5
6
7
8
<?xml version="1.0"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
        <HelloYouServiceOutput>
            <response>Hello world</response>
        </HelloYouServiceOutput>
    </soapenv:Body>
</soapenv:Envelope>

No error message

There are no configured error responses for both REST and SOAP APIs in this example.

Explanation

You can easily expose Gloop services (and other types of services) via Gloop APIs. To create one, simply open the Gloop API wizard. After creating and configuring and saving your API, Martini will detect the mappings and your API will then be available for use.


  1. ${name} is a path parameter and must be given a value.