Skip to content

Home

Introduction

Development

IDEs

Services

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 simpler, 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 apis.service.HelloYouService.gloop.

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 as many requests against the endpoints to confirm their availability.

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

 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.

REST API

Request

To test the REST endpoint, send a GET request to /api/sample/hello/${name}1. For example:

1
2
3
4
curl -X GET \
  http://<integrate-host>/api/sample/hello/world \
  -H 'Cache-Control: no-cache' \
  -H 'Postman-Token: 8ccefb43-45ac-44d3-b594-402b65f28209'

Response

The response should look something like:

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

SOAP API

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
12
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>
             <!--Optional:-->
             <name>world</name>
          </glo:HelloYouServiceInput>
       </soapenv:Body>
    </soapenv:Envelope>'

Response

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 in fact) via Gloop APIs. To create one, simply call the Gloop API wizard. After creating and configuring your API via the wizard, Martini will pick up the mappings and your API should then be available for use.


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