On the Corticon Server for .NET, you can use REST to execute a JSON-formatted Corticon Request by specifying the target Decision Service. The REST method supported is HTTP POST in the form:
HTTP POST:base/axis/corticon/execute
where base is the Corticon Server for .NET's IP or DNS-resolvable name and port. The Decision Service payload is enclosed in the request message's body as a JSON string. The following is the header of an HTTP request defined for executing Decision Service ProcessOrder on a local base:
The POST request does not require the header to carry information about the Decision Service. Those parameters can be set as fields inside the JSON object to specify the Decision Service, shown in the following example for ProcessOrder v1.16:
Evaluation of a request will look first for the message body, and if not found, it will look for it as an HTTP header.
Success and error responses
The response returned by the server has two parts:
A HTTP status code
An HTTP header containing message execution info
Success response - In addition to the processed request, when execution is successful, the response message's body contains the updated JSON string. A successful execution's status and header are, for example:
200 The Decision Service executed
HTTP/1.1 200 OK Content-Length: 1397 Content-Type: application/json Server: Microsoft-IIS/7.5 X-AspNet-Version: 4.0.30319 Set-Cookie: ASP.NET_SessionId=wfjtuzcvwvz55c1qyw4q4kym; path=/; HttpOnly X-Powered-By: ASP.NET
Common error behavior
For all REST executions, there is a common error behavior. The error response has an HTTP status code other than 200, and a user-friendly error message in the header. For example:
400 Bad Request
HTTP/1.1 400 Null value for Header attribute 'dsName'. Value cannot be null. Server: Microsoft-IIS/7.5 Connection: close X-AspNet-Version: 4.0.30319 error: Null value for Header attribute 'dsName'. Value cannot be null. Set-Cookie: ASP.NET_SessionId=dyt1gckr5ph13t1h5q5llbqx; path=/; HttpOnly Content-Length: 0