Transaction Response

Feedback


Response introduction

In response to a transaction request, a web feature service shall generate an XML document indicating the termination status of the transaction. In addition, if the transaction request includes <Insert> operations, then the web feature service must report the feature identifiers of all newly created features. In the event that the transaction fails to execute, the web feature service shall also indicate this in the response.

The XML encoding of the WFS transaction response is defined by the following XML Schema fragment:

<xsd:element name="WFS_TransactionResponse"

                       type="wfs:WFS_TransactionResponseType"/>

<xsd:complexType name="WFS_TransactionResponseType">

      <xsd:sequence>

            <xsd:element name="InsertResult"

                                   type="wfs:InsertResultType"

                                   minOccurs="0" maxOccurs="unbounded"/>

             <xsd:element name="TransactionResult"

                                    type="wfs:TransactionResultType"/>

      </xsd:sequence>

      <xsd:attribute name="version"

                              type="xsd:string" use="required" fixed="1.0.0"/>

</xsd:complexType>

<xsd:complexType name="TransactionResultType">

      <xsd:sequence>

            <xsd:element name="Status" type="wfs:StatusType"/>

            <xsd:element name="Locator" type="xsd:string" minOccurs="0"/>

            <xsd:element name="Message" type="xsd:string" minOccurs="0"/>

      </xsd:sequence>

      <xsd:attribute name="handle" type="xsd:string" use="optional"/>

</xsd:complexType>

<xsd:complexType name="InsertResultType">

      <xsd:sequence>

            <xsd:element ref="ogc:FeatureId" maxOccurs="unbounded"/>

      </xsd:sequence>

      <xsd:attribute name="handle" type="xsd:string" use="optional"/>

</xsd:complexType>

<xsd:complexType name="StatusType">

     <xsd:choice>

            <xsd:element ref="wfs:SUCCESS"/>

            <xsd:element ref="wfs:FAILED"/>

            <xsd:element ref="wfs:PARTIAL"/>

      </xsd:choice>

</xsd:complexType>

<xsd:element name="SUCCESS" type="wfs:EmptyType"/>

<xsd:element name="FAILED" type="wfs:EmptyType"/>

<xsd:element name="PARTIAL" type="wfs:EmptyType"/>

The <WFS_TransactionResponse> element contains zero or more <InsertResult> elements and a <TransactionResult> element.

The <InsertResult> element contains one or more feature identifiers of newly created feature instances. One <InsertResult> element is reported per <Insert> element in the request. The insert results are reported in the order in which the <Insert> operations were contained in the <Transaction> element. Additionally, they can be correlated using the handle attribute if it was specified.

The overall result of a transaction request is specified using the <TransactionResult> element. The <TransactionResult> element must contain a <Status> element and may contain <Locator> and <Message> elements.

The <Status> element is used to indicate the completion status of the transaction. Transactions can terminate with a status of:

Status Description
SUCCESS The transaction was successfully completed.
FAILED An exception was encountered while processing one or more elements contained in a Transaction request.
PARTIAL The transaction partially succeeded and the data may be in an inconsistent state. For systems that do not support atomic transactions, this outcome is a distinct possibility.

In the event that a transaction request fails, the <Locator> element can be used to indicate which part of the transaction failed. If the element at which the failure occured is labeled using a handle attribute, then a web feature service may report its value to locate the failure. Otherwise, a web feature service may try to identify the failure relative to the beginning of the transaction request, possibly using line numbers or some other convenient mechanism.

The <Message> element is used to report any error messages.

 

Response example

In the response example, the results of adding features, updating features and deleting features are on the following:

  1. When adding features, the server returns the xml document and it shown on the following:

<?xml version="1.0" encoding="UTF-8"?>

<wfs:WFS_TransactionResponse version="1.0.0"

        xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc"

        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

        xsi:schemaLocation="http://www.opengis.net/wfs null">

        <wfs:InsertResult>

                <ogc:FeatureId fid="World.Capitals.164" />

        </wfs:InsertResult>

        <wfs:TransactionResult>

                <wfs:Status>

                        <wfs:SUCCESS />

                </wfs:Status>

        </wfs:TransactionResult>

</wfs:WFS_TransactionResponse>

  1. When updating features, the server returns the xml document and it shown on the following:

<?xml version="1.0" encoding="UTF-8"?>

<wfs:WFS_TransactionResponse version="1.0.0"

xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://www.opengis.net/wfs http://localhost:8090/iserver/services/data-changchun/wfs100?request=getschema&file=wfs,1.0.0,WFS-transaction.xsd">

<wfs:TransactionResult>

<wfs:Status>

<wfs:SUCCESS />

</wfs:Status>

</wfs:TransactionResult>

</wfs:WFS_TransactionResponse>

  1. When deleting features, the server returns the xml document and it shown on the following:

<?xml version="1.0" encoding="UTF-8"?>

<wfs:WFS_TransactionResponse version="1.0.0"

        xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc"

        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

        xsi:schemaLocation="http://www.opengis.net/wfs null">

        <wfs:TransactionResult>

                <wfs:Status>

                        <wfs:SUCCESS />

                </wfs:Status>

        </wfs:TransactionResult>

</wfs:WFS_TransactionResponse>