Exception reporting |
In the event that a web feature service encounters an error while processing a request or receives an unrecognized request, it shall generate an XML document indicating that an error has occurred.
OGC-exception.xsd is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
targetNamespace="http://www.opengis.net/ogc"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:element name="ServiceExceptionReport">
<xsd:annotation>
<xsd:documentation>
The ServiceExceptionReport element contains one
or more ServiceException elements that describe
a service exception.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ServiceException"
type="ogc:ServiceExceptionType"
minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
The Service exception element is used to describe
a service exception.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="version" type="xsd:string" fixed="1.2.0"/>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="ServiceExceptionType">
<xsd:annotation>
<xsd:documentation>
The ServiceExceptionType type defines the ServiceException
element. The content of the element is an exception message
that the service wished to convey to the client application.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="code"type="xsd:string">
<xsd:annotation>
<xsd:documentation>
A service may associate a code with an exception
by using the code attribute.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="locator"type="xsd:string">
<xsd:annotation>
<xsd:documentation>
The locator attribute may be used by a service to
indicate to a client where in the client's request
an exception was encountered. If the request included
a 'handle' attribute, this may be used to identify the
offending component of the request. Otherwise the
service may try to use other means to locate the
exception such as line numbers or byte offset from the
begining of the request, etc...
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:schema>
A <ServiceExceptionReport> element can contain one or more WFS processing exceptions. The mandatory version attribute is used to indicate the version of the service exception report schema. For this version of the specification, this value is fixed at 1.2.0.
Individual exception messages are contained within the <ServiceException> element. The optional code attribute may be used to associate an exception code with the accompanying message. The optional locator attribute may be used to indicate where an exception was encountered in the request that generated the error. A number of elements defined in this document include a handle attribute that can be used to associate a mnemonic name with the element. If such a handle exists, its value may be reported using the locator attribute of the <ServiceException> element. If the handle attribute is not specified, then a web feature server implementation may attempt to locate the error using other means such as line numbers, etc...
The following is an example of an exception report. This exception indicates that the first insert statement failed because of a missing closing XML tag in the request.
<?xmlversion="1.0"?>
<ServiceExceptionReport
version="1.2.0"
xmlns="http://www.opengis.net/ogc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/ogc../wfs/1.0.0/OGC-exception.xsd">
<ServiceException code="999" locator="INSERTSTMT01">
parse error: missing closing tag for element WKB_GEOM
</ServiceException>
</ServiceExceptionReport>