DAP4 Error Response: Difference between revisions

From OPeNDAP Documentation
⧼opendap2-jumptonavigation⧽
(Created page with "=== DAP4 Error Response === The DAP4 protocol returns error information using an Error response. If a request for any of the three basic responses cannot be completed then ...")
 
Line 1: Line 1:
=== [[DAP4 Error Response]]  ===
== [[DAP4 Error Response]]  ==


The DAP4 protocol returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.
The DAP4 protocol returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.
Line 5: Line 5:
The normative XML representation for the Error Response is defined by the following RELAX-NG schema.
The normative XML representation for the Error Response is defined by the following RELAX-NG schema.
<font size="2">
<font size="2">
<pre>
<source lang="xml">
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
                xmlns:doc="http://www.example.com/annotation"
<grammar xmlns="http://relaxng.org/ns/structure/1.0" xmlns:doc="http://www.example.com/annotation" datatypeLibrary="http://xml.opendap.org/datatypes/dap4" ns="http://xml.opendap.org/ns/DAP/4.0#">
                datatypeLibrary="http://xml.opendap.org/datatypes/dap4"
    <start>
                ns="http://xml.opendap.org/ns/DAP/4.0#"
        <ref name="errorresponse"/>
                >
    </start>
&lt;start&gt;
    <define name="errorresponse">
  &lt;ref name="errorresponse"/&gt;
        <element name="Error">
&lt;/start&gt;
            <optional>
&lt;define name="errorresponse"&gt;
                <element name="code">
  &lt;element name="Error"&gt;
                    <attribute name="protocol">
    &lt;optional&gt;
                        <data type="text"/>
      &lt;attribute name="httpcode"&gt;&lt;data type="dap4_integer"/&gt;&lt;/attribute&gt;
                    </attribute>
    &lt;/optional&gt;
                    <data type="dap4_integer"/>
    &lt;optional&gt;
                </element>
      &lt;interleave&gt;
            </optional>
        &lt;element name = "Message"&gt;&lt;text/&gt;&lt;/Message&gt;
            <optional>
        &lt;element name = "Context"&gt;&lt;text/&gt;&lt;/Message&gt;
                <interleave>
        &lt;element name = "OtherInformation"&gt;&lt;text/&gt;&lt;/Message&gt;
                    <element name="Message">
      &lt;/interleave&gt;
                        <text/>
    &lt;/optional&gt;
                    </element>
  &lt;/element&gt;
                    <element name="Context">
&lt;/define&gt;
                        <text/>
</pre>
                    </element>
                    <element name="OtherInformation">
                        <text/>
                    </element>
                </interleave>
            </optional>
        </element>
    </define>
</grammar></source>
</font>
</font>


Line 35: Line 43:
The body of the &lt;Error&gt; element may contain any or all of the following
The body of the &lt;Error&gt; element may contain any or all of the following
inner elements each containing arbitrary text.
inner elements each containing arbitrary text.
# &lt;code&gt; &mdash; An numerically valued error code. For this code to have any real meaning to must be associated with a protocol, such as HTTP, via the protocol attribute.
# &lt;Message&gt; &mdash; A short informative message describing the error.
# &lt;Message&gt; &mdash; A short informative message describing the error.
# &lt;Context&gt; &mdash; Information describing the context in which the error occurred: position of a parse error in a constraint expression, for example.
# &lt;Context&gt; &mdash; Information describing the context in which the error occurred: position of a parse error in a constraint expression, for example.
# &lt;OtherInformation&gt; &mdash; Arbitrary additional text information: a Java stack trace, for example.
# &lt;OtherInformation&gt; &mdash; Arbitrary additional text information: a Java stack trace, for example.


==== Error Response Resource Role ====
=== Error Response Resource Role ===


DAP4 Error Responses are identified by the resource role:
DAP4 Error Responses are identified by the resource role:
Line 45: Line 54:
: '''<font size="2"><code><nowiki>http://services.opendap.org/dap4/error</nowiki></code></font>'''
: '''<font size="2"><code><nowiki>http://services.opendap.org/dap4/error</nowiki></code></font>'''


==== Normative Encoding of the Error Response ====
=== Normative Encoding of the Error Response ===


The normative XML representation for the Error Response is defined in Appendix x "Normative XML Encoding of the Error Response". The media type for the normative XML representation is:
The normative XML representation for the Error Response is defined in Appendix x "Normative XML Encoding of the Error Response". The media type for the normative XML representation is:


: <font size="2"><code>'''application/vnd.opendap.dap4.error.xml'''</code></font>
: <font size="2"><code>'''application/vnd.opendap.dap4.error.xml'''</code></font>
=== Examples ===
; Not Found
<font size="2">
<source lang="xml">
<?xml version="1.0" encoding="UTF-8"?>
<dap4:Error xmlns:dap4="http://xml.opendap.org/ns/DAP/4.0#">
    <code protocol="http">404</code>
    <Message>Unable to locate requested resource</Message>
</dap4:Error>
</source>
</font>

Revision as of 04:45, 20 November 2013

DAP4 Error Response

The DAP4 protocol returns error information using an Error response. If a request for any of the three basic responses cannot be completed then an Error response is returned in its place.

The normative XML representation for the Error Response is defined by the following RELAX-NG schema.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0" xmlns:doc="http://www.example.com/annotation" datatypeLibrary="http://xml.opendap.org/datatypes/dap4" ns="http://xml.opendap.org/ns/DAP/4.0#">
    <start>
        <ref name="errorresponse"/>
    </start>
    <define name="errorresponse">
        <element name="Error">
            <optional>
                <element name="code">
                    <attribute name="protocol">
                        <data type="text"/>
                    </attribute>
                    <data type="dap4_integer"/>
                </element>
            </optional>
            <optional>
                <interleave>
                    <element name="Message">
                        <text/>
                    </element>
                    <element name="Context">
                        <text/>
                    </element>
                    <element name="OtherInformation">
                        <text/>
                    </element>
                </interleave>
            </optional>
        </element>
    </define>
</grammar>

The Error element has one optional attribute: the httpcode which is a standard HTTP protocol return code indicating the general class of error. When possible, this code should match the return code in the HTTP headers for the response.

The body of the <Error> element may contain any or all of the following inner elements each containing arbitrary text.

  1. <code> — An numerically valued error code. For this code to have any real meaning to must be associated with a protocol, such as HTTP, via the protocol attribute.
  2. <Message> — A short informative message describing the error.
  3. <Context> — Information describing the context in which the error occurred: position of a parse error in a constraint expression, for example.
  4. <OtherInformation> — Arbitrary additional text information: a Java stack trace, for example.

Error Response Resource Role

DAP4 Error Responses are identified by the resource role:

http://services.opendap.org/dap4/error

Normative Encoding of the Error Response

The normative XML representation for the Error Response is defined in Appendix x "Normative XML Encoding of the Error Response". The media type for the normative XML representation is:

application/vnd.opendap.dap4.error.xml

Examples

Not Found

<?xml version="1.0" encoding="UTF-8"?>
<dap4:Error xmlns:dap4="http://xml.opendap.org/ns/DAP/4.0#">
    <code protocol="http">404</code>
    <Message>Unable to locate requested resource</Message>
</dap4:Error>