Martini Invoking Services via HTTP
This section provides a step-by-step guide on how to invoke Martini services via HTTP using the Martini environment. The process is streamlined to support both simple and complex service invocations, including those with inputs and outputs.
Invoking a Service without Inputs
- Open the Service in Martini: Navigate to the service you want to invoke within the Martini interface.
- Invoke the Service: Right-click the service and select INVOKE in http client. This action opens the service in the integrated HTTP client.
- Send the Request: With the service opened in the HTTP client, and assuming no inputs are required, click the send button to execute the service.
- View the Response: After sending the request, the HTTP client will display the response indicating that the service has been invoked successfully. Additionally, you can check the console for any messages printed by the service.
Adding Inputs and Outputs to the Service
To enhance the service invocation process by including inputs and outputs:
-
Define Inputs and Outputs:
- Add a new string input to the service and name it
message
. - Create a data model for the output, naming it
response
with a string property calledmessage
.
- Add a new string input to the service and name it
-
Update the Service Logic:
- Remove any print line functions previously used for debugging.
- Implement a map step to assign the input message to the output response message.
Invoking the Service with Inputs
- Reopen the Service in HTTP Client: Close any previously opened requests in the HTTP client and invoke the service again as described earlier.
-
Configure the Request:
- The HTTP client automatically configures the request to include the necessary inputs as form data.
- Fill in the
message
input field with the desired value, leaving other parameters at their default settings.
-
Send the Request:
- Ensure the request is set to return the response in JSON format.
- Click the send button to execute the service with the input provided.
-
View the Output:
- The service's output will be displayed in the HTTP client, formatted as specified (in this case, JSON).
- The response will include the processed message, demonstrating the successful invocation and processing by the service.