Welcome Guest! Log in


This article explains how to configure your Stambia Published Web Services to receive and / or send an HTTP Body.

The HTTP Body is the main part of a Web Service invocation, containing the body of the request.

Stambia Web Services can be configured to retrieve the HTTP Body provided by the user at invocation, and return, if needed, another HTTP Body to the user at the end of the invocation.

 

Prerequisites:
  • This is only available for the HTTP REST API
  • Stambia DI Runtime S17.3.0 or higher

 

Note:

This should be used to retrieve and return raw data, like plain text.

For structured data, such as JSON or XML, prefer using dedicated Metadata for input / Output.

To return a specific HTTP response code, please refer to this article.

 

Configuration of the Input HTTP Body

To retrieve the raw HTTP Body sent by the user invoking the Web Service, the idea is to store it in a Process Parameter.

It will next be available as usual in the Process.

 

Creation of the Process Parameters

First, create the Process Parameter that will receive the value of the HTTP Body.

Design it as usual, and optionally set a default value to avoid the case where it wouldn't be provided by the user.

requestBodyParameter

 

Configuration of the META-INF

Next, lead to the main Process Properties, and open the Meta-Inf tab.

Add in the box the following sample of code and replace it with your own settings:

<httpRestWebServiceProperties extractRequestInfo="false">
    <requestBodyMapper parameterName="requestBody" charset="UTF-8"/>    
</httpRestWebServiceProperties>

 

Attribute Description Example
parameterName The name of the Process Parameter in which the body will be stored requestBody
charset Charset used for the returned body UTF-8

 

Using the parameter in the Process

That's it, you can now publish the Process as a Web Service.

At each invocation, the Process Parameter defined here will be filled with the HTTP Body provided by the user calling the Web Service.

You can use the Process Parameters as usual in your flow.

 

Configuration of the Output HTTP Body

When the invocation of the Web Service is finished, there is the possibility to return a raw HTTP Body to the user.

As for the input HTTP Body, the idea is to return the value of a Process Parameter.

 

Creation of the Process Parameter

First, create the Process Parameters that will contain the value of the HTTP Body to return to the user.

Design it as usual, and optionally set a default value to avoid the case where it wouldn't be filled during the Process.

responseBodyParameter

 

Configuration of the META-INF

Next, lead to the main Process Properties, and open the Meta-Inf tab.

Add in the box the following sample of code and replace it with your own settings:

<httpRestWebServiceProperties extractRequestInfo="false">
    <responseBodyMapper parameterName="responseBody" charset="UTF-8"/>    
</httpRestWebServiceProperties>

 

Attribute Description Example
parameterName The name of the Process Parameter that will contain the HTTP Header value. responseBody
charset Charset used for the returned body UTF-8

 

Usage

At the end of the Web Service invocation, the HTTP Body specified will be sent back to the user.

The value sent is the value of the corresponding Process Parameter, which should be filled during the Process execution.

 

Remarks

If you are mixing Input / Output HTTP Body, make sure to put all the nodes under the same <httpRestWebServiceProperties /> root node.

For instance:

<httpRestWebServiceProperties extractRequestInfo="false">
    <requestBodyMapper parameterName="requestBody" charset="UTF-8"/>    
    <responseBodyMapper parameterName="responseBody" charset="UTF-8"/>    
</httpRestWebServiceProperties>

 

You have no rights to post comments

Articles

Suggest a new Article!