- Created by Akash Kumar Jaiswal, last modified by Rohan Dhanwade on Mar 14, 2022
You are viewing an old version of this page. View the current version.
Compare with Current View Page History
« Previous Version 2 Next »
This section explains the process of creating web service provider service for RESTful Web Service.
Follow the steps below to create a REST Provider:
Click Configure > WEB SERVICES > REST Provider.
- Click Create REST Provider.
In Create REST Provider window, type the name and description of the new Web Service Provider service in the Name and Description fields respectively.
In the Character Set Encoding field, enter the character set encoding for the REST Provider that you are creating.
By default, this field displays the character set encoding that you have defined at the application level. In case the character set encoding for the REST Provider that you are creating is other than the default one (UTF-8), you can change this in the Character Set Encoding field.Select either Process Flow or Template based on how you want to publish this REST Provider.
The REST providers that are published as Process Flows and set to be executed in Sync mode bypass the queue and get executed immediately.Select the Asynchronous check box if you want the Transaction based on this Template (with REST Webhook as a source) to be asynchronous.
This field is available only when you publish the REST Provider as a Template.Select Enable SSL check box if you want the REST Provider service to offer a SSL security.
If you select Enable SSL, this REST provider will be published over SSL and use SSL configuration (KeyStore, TrustStore etc.) defined for the port that you select in the next step.In the Select Port field, select the port on which you want to publish the REST provider.
All the ports that are available on API Gateway will be visible in this field. You can also define/edit/delete a custom port through an environment variable in values.yaml file. Click here to know how to configure the ports.- In the API Version field, enter the API Version. For example, your API version can be 1.1.
In the Resource End Path field, enter the resource end path URL. The URL can be static or dynamic.
Static URL example: /rest/WeatherForecast
Dynamic URL example: /rest/{ServiceName} where service name is a variable, for example, WeatherForecast.The variable name in the Dynamic URL must be in the curly braces {}.In the Process Flow Name field, select a Process Flow to trigger with the REST provider.
This field is available only when you publish the REST Provider as a Process Flow.- The selected Process Flow must have Context Source and Context Target activity – GET and DELETE can only have Context Target, whereas PUT and POST can have both Context Source and Context Target activity.
- The parameterName attribute of the Context Source should be restRequest.
- The parameterName attribute of the Context Target should be restResponse.
In the Resource Parameter section, enter the name, default value, and style in the respective fields to define the parameters that you want to pass.
To pass a parameter as a part of HTTP header, select Header in the Style field corresponding to that parameter.Click Add Method.
In the window that opens on your browser, do the followings to add a method to your activity.
In the Method Type field, select the type of method.
When the REST Providers is published as a Process Flow, all the method types PUT, GET, POST, and DELETE are available.
When the REST Provider is published as a Template, only PUT and POST method types are available.
In the Method Parameter section, define the method parameters. Enter the name, default value, and style in the respective fields.
To pass a method parameter as a part of HTTP header, select Header in the Style field corresponding to that parameter.- In the Presentation section, set the Media Type as application/text, application/xml, or application/json based on your requirement. If you set the Media Type as xml or json, select a Layout (Schema) for the respective media type.
- Set the Status Code for Request, Response, and Fault.
- In the Response Header section, define the headers. Type the response header names and values in the respective fields.
- Click Save.
This will add the method in Method Parameter section in the Create REST Provider page.
In the Security Policy field, select a security policy .
For information on how to create a Security Policy, refer to Creating Security Policy for Web Service.
The RESTful Web Service Provider supports both basic and API authentication.
Expand the Advanced Properties section
Select a project from the Project field.
Click Save.
After you have finished creating the REST Provider:
- You can see its type (Template or Process Flow) under the TYPE column on the REST Provider manage page.
- You can also publish or unpublish the REST Provider from the same page, click here for more details.
- You can add the API Documentation.
When a RESTFul web service is invoked by a Consumer, following information is saved in the Process Flow context:
Variable Name | Description |
---|---|
InvokedURL | URL which has been hit by the consumer |
InvokedMethod | Method through which the Web Service has been invoked – GET, POST, PUT, DELETE |
InvokedResourceEndPath | Contains the actual ResourceEndPath from the invoked URL |
You can view the value of these variables in Process Flow context, within Process Flow Logs.
You can also view these variables within your Process Flow using put-context-var action.
- No labels