Stambia Published Web Services support defining and retrieving URL Path Parameters at invocation.
URL Path parameters correspond to dynamic information values which are part of a URL Path.
For instance, with the following URL, "id", and "2" are URL Path Parameters: http://stambia:42200/rest/StambiaDeliveryService/2/myDelivery/id/3
They can be defined, retrieved at invocation and used in web service flow as explained below
Prerequisites:
- This is only available for the HTTP REST API
- Stambia DI Runtime S17.3.0 or higher
Configuration of the Web Service Process
Creation of Process Parameters
First, create a Process Parameter that will receive the value which will be sent when invoking the web service.
Specify a default value to avoid the case where it wouldn't be provided at invocation.
Then specifies that this is an Input Parameter in Publication tab:
Configuration of the META-INF
Next, lead to the Process Properties, and open Meta-Inf tab.
This is where we are going to specify that previously created Process Parameter will receive the value which will be sent at invocation at a particular position in URL.
There are two methods to configure this.
Method 01 - through dedicated nodes
Add in Meta-Inf tab the following sample of code and replace it with your own settings:
<httpRestWebServiceProperties> <urlPartMapper urlPartPosition="1" parameterName="My_Url_Parameter_01"/> </httpRestWebServiceProperties>
Attribute | Description | Example |
urlPartPosition | Position of the Process Parameter in the URL. | In provided URL example, a position of '1' would retrieve the 'id' value, and a position of the '2' the '3' value. |
parameterName | Name of the Process Parameter which will receive the value. | My_Url_Parameter_01 |
You can put as many <urlPartMapper /> node as needed:
<httpRestWebServiceProperties> <urlPartMapper urlPartPosition="1" parameterName="My_Url_Parameter_01"/> <urlPartMapper urlPartPosition="2" parameterName="My_Url_Parameter_02"/> <urlPartMapper urlPartPosition="3" parameterName="My_Url_Parameter_03"/> </httpRestWebServiceProperties>
Method 02 - through a mask in invocation path
Process Parameter name created before is defined directly in invocation path at expected position and surrounded with brackets.
Add in Meta-Inf the following sample of code and replace it with your own settings:
<httpRestWebServiceProperties path="user/defined/path/{My_Url_Parameter_01}">
</httpRestWebServiceProperties>
You can put as many parameters as you want:
<httpRestWebServiceProperties path="user/defined/path/{My_Url_Parameter_01}/{My_Url_Parameter_01}/{My_Url_Parameter_03}">
</httpRestWebServiceProperties>
Prerequisites:
- Stambia DI Runtime S17.6.6 or higher
For further information about path attribute, refer to following article.
Using the parameters in the Process
From now at each invocation defined Process Parameters will be filled with values sent by the user invoking the web service.
You can then use those values through corresponding Process Parameters, as you would do for any other Process Parameter.
For further information about syntaxes to use Process Parameters, refer to following article.