The various request and response types

Corticon accommodates many request variations from SOAP and WSDL defined XML requests to loosely defined JSON and nativeJSON. That means that various users of one decision service can be sending requests in different formats.
Note: You can set vocabulary elements to map to accept unacceptable characters by mapping them to acceptable Corticon names. For example, embedded spaces are replaced with the underscore character: A B maps to A_B.

A request must state which decision service to use. The major and minor version are optional. If you omit them, the decision service will assign the highest major and minor version that is found. If just the major version is declared, then the highest minor version of that major version is assigned.

SOAP and XML

The following examples are the output you get when you are editing a Ruletest. Click anywhere in the Input column, and then choose one of the Ruletest > Export options.
An exported SOAP header is in the form:
<?xml version="1.0" encoding="UTF-8"?>
		<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
  							xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
							  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
		<SOAP-ENV:Body>
		<CorticonRequest xmlns="urn:Corticon" 
							xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
							decisionServiceName="InsertDecisionServiceName">
		<WorkDocuments>
While the corresponding XML header is simply:
<?xml version="1.0" encoding="UTF-8"?>
<CorticonRequest xmlns="urn:Corticon" 
				   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
					decisionServiceName="InsertDecisionServiceName">
<WorkDocuments>

JSON

When you export a request's input as JSON it might look like this:
{
    "__metadataRoot": {"#locale": ""},
    "Objects": [
        {
            "volume": 10,
            "container": null,
            "weight": 1000,
            "__metadata": {
                "#type": "Cargo",
                "#id": "Cargo_id_1"
            }
        },
        {...}
        }
    ],
    "name": "InsertDecisionServiceName"
}
Notice that the DecisionServiceName says Insert Decision Service Name. Change it to Cargo.

That's not important in Ruletests, but when you try external requests it is vital. It need not be the name of the project or the Ruletest. You could name it Freight or Shipping. Just know that when you want that Decision Service, you need to use the name you assigned.

For example, using the Tutorial Ruleflow namedtutorial_example.erf, when you start the packaging process, it looks like this:

Rename the Decision Service to Cargo:

When you use the Web Console, you can see how various names and versions match up for comprehensive testing.

Native JSON

Native JSON adds another level of simplicity to JSON by leaving off the metadata altogether, and expecting that the request carries the parameters for at least the decision service name. For example, where the request carries the major and minor version:
http://localhost/axis/corticon/execute/nativejson?
       name=Cargo&majorVersion=7&minorVersion=242
The request body can then be very simple:
        {
            "volume": 10,
            "container": null,
            "weight": 1000
        }

But if you get too simple, the algorithm that tries to compensate for the strictness in other formats can cause processing overhead. For example, if you have dozens of entities, many with an attribute item, you could cause delays as the algorithm discovers the right one by evaluating the other attributes. Try to keep attribute names unique, or express the entity as __metadata in the native JSON file.