You can execute a valid ruleset by creating an XML or a
JSON request and using the POST method.
About this task
To execute a deployed ruleset by using the REST service,
you generate the XML or JSON payload and post the request. You can
also generate a WADL representation of request and response elements.
See Generating a WADL representation.In your client, you construct
the request message as an XML or JSON packet, which depends on the
XML signature in WADL format of the REST service. The client must
specify the web service URL, pass in the request, and specify a variable
to hold the response from the service.
Procedure
-
Generate an XML or JSON fragment by posting your request to the following URI.
http://{host}:{port}/DecisionService/rest/v1/{rulesetPath}/{format}
Example:
GET http://localhost:9080/DecisionService/rest/v1/miniloanruleapp/1.0/miniloanrules/1.0/xml
Then, you can use the result as a starting point to write an XML or JSON request.
-
Validate the XML structure of the request by posting your request to the following URI.
http://{host}:{port}/DecisionService/rest/v1/{rulesetPath}/validate
Example:
POST http://localhost:9080/DecisionService/rest/v1/miniloanruleapp/1.0/miniloanrules/1.0/validate
Validation (/validate) is not available for the JSON format.
-
Post the execution request to the following URI:
http://{host}:{port}/DecisionService/rest/v1/{rulesetPath}
REST
requests for execution use the POST method. The request body contains the XML or JSON
payload.
Example:
POST http://localhost:9080/DecisionService/rest/v1/miniloanruleapp/1.0/miniloanrules/1.0
The execution response is sent in the same format as the request.