Transaction Request |
Transaction operation implements adding features, updating features and deleting features three functions. The format is XML and the node features introduction is on the following:
Table 1 Node features for the Transaction operation
Request parameters | Required/Optional | Description |
<Transaction> | Mandatory |
A Transaction feature includes zero or multiple features that used to add, update and delete. Allows the <Transaction> is null , namely it does not contain other elements and the Transaction operation is meaningless. |
<Insert> | Optional | Requires when adding features. The inserted feature should be described by <feature> with the format GML. And it may add several features in a <Insert>. |
<Update> | Optional | Requires when updating features. typeName is used to specifies the type of updating feature. A <Update> contains one or multiple <Property> that used to specify the Name and Value. The property is null when do not have <Value>element. <Update> element also contains <Filter> that is to limit the range of updating element. Please refer to request example to see the result. |
<Delete> | Optional | Requires when deleting features. typeName is used to specifies the type of deleting feature. A <Filter> element specify the one or multiple deleting features. |
This examples perform 3 action to the WFS service data-world/wfs100. First add a new feature. Second update the feature and then delete it. That is performing POST request to http://localhost:8090/iserver/services/data-world/wfs100?request=Transaction and sending the following request body:
Performs POST request and the request body is showing below:
<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs"
service="WFS" version="1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd http://www.supermap.com/World http://localhost:8090/iserver/services/data-World/wfs100?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&TYPENAME=World:Capitals">
<wfs:Insert>
<World:Capitals xmlns:World="http://www.supermap.com/World">
<World:CAPITAL>testCapital</World:CAPITAL>
<World:COUNTRY>testCountry</World:COUNTRY>
<World:the_geom>
<gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326">
<gml:coordinates>143.09,35.57</gml:coordinates>
</gml:Point>
</World:the_geom>
</World:Capitals>
</wfs:Insert>
</wfs:Transaction>
After adding the feature, please refer to Response example.
Performs POST request and the request body is showing below:
<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs"
service="WFS" version="1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd http://www.supermap.com/World http://localhost:8090/iserver/services/data-world/wfs100?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&TYPENAME=World:Capitals">
<wfs:Update typeName="World:Capitals" xmlns:World="http://www.supermap.com/World">
<wfs:Property>
<wfs:Name>CAPITAL</wfs:Name>
<wfs:Value>otherCapital</wfs:Value>
</wfs:Property>
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>COUNTRY</ogc:PropertyName>
<ogc:Literal>testCountry</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
</wfs:Update>
</wfs:Transaction>
After updating the feature, please refer to Response example.
Perform the POST request. Delete the otherCapital feature in World:Capitals layer, and the request body is:
<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs"
service="WFS" version="1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd http://www.supermap.com/World http://localhost:8090/iserver/services/data-world/wfs100?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&TYPENAME=World:Capitals">
<wfs:Delete typeName="feature:Capitals" xmlns:feature="http://www.supermap.com/World">
xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc"
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:PropertyIsEqualTo>
<ogc:Literal>otherCapital</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
</wfs:Delete>
</wfs:Transaction>
After deleting the feature, please refer to Response example.