Exceptions in REST Processing

An exception that occurs during the execution of a JadeRestService method results in a Fault object being returned in XML format, by default.

From version 2018.0.01, you can specify the required JadeRestService class OutputFormat_ constant value in the exceptionFormat property (for example, in the create method of your JadeRestService subclass) if you want to change the exception output format at run time. The class constant values for the exception output format are listed in the following table.

JadeRestService Class Constant Value Exceptions are in...
OutputFormat_Json 0 JSON (Microsoft JSON) format
OutputFormat_Xml 1 XML format (the default)
OutputFormat_Json_NewtonSoft 2 JSONN (NewtonSoft JSON) format

Any other value (for example, -1) means that exceptions are returned in the format controlled by the received URL.

The following example displays the XML that is returned if exception 1035 (String too long) is raised.

<?xml version="1.0" encoding="UTF-8"?>
<Fault>
    <errorCode>1035</errorCode>
    <errorItem>NormalException</errorItem>
    <errorText>String too long</errorText>
</Fault>

From version 2018.0.01, an exception that occurs during the execution of a JadeRestService method results in a Fault object being returned formatted in the style specified in the URL. When the output format is:

The following example displays the JSON XML that is returned if exception 1035 (String too long) is raised.

<?xml version="1.0" encoding="UTF-8"?>
<Fault>
    <errorCode>1035</errorCode>
    <errorItem>NormalException</errorItem>
    <errorText>String too long</errorText>
</Fault>

There are a number of exceptions that are specific to the processing of a REST request. The following example displays the XML that is returned if the JSON request contains the wrong number of parameters; in this example, two primitive parameters were supplied instead of one.

<?xml version="1.0" encoding="UTF-8"?>
<Fault>
    <errorCode>11106</errorCode>
    <errorItem>The signature of Method 'RestService::getClient' does not match
               the url data provided: (2) primitive parameters.</errorItem>
    <errorText>The signature of the called Rest Services method does not match
               the supplied url entities</errorText>
</Fault>

For more details about the exceptions that are specific to Jade REST requests, see "11100 Through 11199 - Jade Rest Service Errors", in the Error Messages and System Messages document.