Error Handling

If the input content type for the service is application/xml and the received payload is not compliant with the specified XSD a generic error code indicating the syntactical error will be reported. In all other error scenarios, a specific error code will be returned. To facilitate a standard mechanism for error handling for the service consumers, all services will include the following XML block in their response indicating the status of invoking the service.

The schema for the above type is shown below:

<xs:complexType name="AbstractOutputType">
    <xs:sequence>
        <xs:element name="status"  >
            <xs:complexType>
                <xs:sequence>
          <xs:element name="error" minOccurs="0" maxOccurs="unbounded">
            <xs:complexType>
              <xs:simpleContent>
                <xs:extension base="xs:string">
                  <xs:attribute name="code" use="required"/>
                </xs:extension>
              </xs:simpleContent>
            </xs:complexType>
          </xs:element>
        </xs:sequence>
        <xs:attribute name="success" type="xs:boolean" use="required"/>
      </xs:complexType>
    </xs:element>
  </xs:sequence>
</xs:complexType>

If the service invocation was successful, the status fragment will have a single Boolean attribute success indicating true. If the invocation failed, the success attribute will have a value of false, and there will be one or more error elements, with the codes and a meaningful description. If the service failed schema validation, the error code will be ER001.
The listing below shows the status block when the invocation is successful:

<status success="true" />

In case of an schema validation error, the status block will be similar to:

<status success="false">
    <error code="ER-0001">** Parsing error, line 29, The content of element type "slide" must match ...</error>
</status>

The content of the error element will vary based on the exact validation error that occurred. In case of a semantic validation error, a more specific error code and message as listed in the Error Messages will be returned as shown below:

<status success="false">
    <error code="ER-1001">The country code of the remitter is not a valid ISO country code</error>
    <error code="ER-1011">The payment currency code is not available for use</error>
</status>

Depending on the validation errors, the service may return one or more error elements within the status element.


Did this page help you?