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.
By default, Character Set Encoding field will display 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 encoding in the Character Set Encoding field.
Select weather you want to publish the REST Provider as a Process Flow or a Template.
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 have published the REST Provider as a Template.
Select Enable SSL check box if you want the REST Provider service to offer a SSL security.
Select the port from the Select Port field.
This Web Service will be published over SSL and will use SSL configuration (KeyStore, TrustStore etc) defined for this selected port in the server.xml file. In case you want to change this SSL configuration or you want to define a new port then you need to edit/add port in server.xml file. Click here to get more details.
Type API Version, for example, your API version can be 1.1.
Type the resource end path URL in the Resource End Path field.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 {}.
Select the process flow name to trigger with the web service from the Process Flow Name field.
This field is available only when you have published 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.
To define the resource parameters, type the name, default value, and style of the parameters in the Name, Default Value, and Style fields.
For the parameters that you want to pass as a part of HTTP header, select Header corresponding to the parameters in the Style field.
To add methods to your activity, click Add Method and do the following.
Select the type of method from the Method Type field. Depending upon the selection of the method type, the content of the Presentation table appears.
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 table, define the method parameters. Type the name, default value, and style of the parameters in the Name, Default Value, and Style fields.
For the parameters that you want to pass as a part of HTTP header, select the Header option in the Style field.
In the Presentationtable, set the Media Type as application/text, application/xml, or application/json. If you set media type as XML or json, select Request layout for the selected media type.
Set the Status Codecorresponding to the types.
In the Response Headers table, define your own headers. Type the name and values in the Name and Value fields.
Click Save.
Select the security policy from the Security Policy field.
The RESTful Web Service Provider supports both basic and API authentication.
Expand the Advanced Properties section and select the project from the Project field.
Click Save.
The REST provider once published as a template can be used as a Source in a Template . For more details, refer to the pageUsing REST Webhook in a Template.
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.