Openlayers 3 openlayers 3 ol.format.WFS writeTransaction为简单更新事务生成不正确的XML

Openlayers 3 openlayers 3 ol.format.WFS writeTransaction为简单更新事务生成不正确的XML,openlayers-3,Openlayers 3,我已成功使用ol.format.WFS#writeTransaction方法将插入操作的WFS-t XML序列化到GeoServer,但当我尝试对更新操作执行相同操作时,该方法会生成无效的WFS-t请求。是否可能是我错误地初始化了ol.format.WFS对象?或者可能我将错误的选项传递给writeTransaction方法?或者可能是OpenLayers3中的一个bug 以下是我的Javascript的要点: var wfst = new ol.format.WFS({ feature

我已成功使用ol.format.WFS#writeTransaction方法将插入操作的WFS-t XML序列化到GeoServer,但当我尝试对更新操作执行相同操作时,该方法会生成无效的WFS-t请求。是否可能是我错误地初始化了ol.format.WFS对象?或者可能我将错误的选项传递给writeTransaction方法?或者可能是OpenLayers3中的一个bug

以下是我的Javascript的要点:

var wfst = new ol.format.WFS({
    featureNS: "mypoints",
    featureType: "test_points"
});
var options = {
    gmlOptions: {srsName: "EPSG:3857"}, 
    featureNS: "mypoints",
    featureType: "test_points"
};
var node = wfst.writeTransaction(null, [thePoint], null, options);
var shouldBeValidXML = new XMLSerializer().serializeToString(node)
下面是一个生成以下内容的XML示例:

<Transaction xmlns="http://www.opengis.net/wfs" service="WFS" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Update typeName="feature:test_points" xmlns:feature="mypoints">
    <Property>
      <Name>geometry</Name>
      <Value>
        <Point xmlns="http://www.opengis.net/gml" srsName="EPSG:3857"><pos>-10606301.721251432 4226568.758428884</pos></Point>
      </Value>
    </Property>
    <Filter xmlns="http://www.opengis.net/ogc">
      <FeatureId fid="test_points.fid--62e21e8_153971e1869_-7ffe"/>
    </Filter>
  </Update>
</Transaction>

几何学
-10606301.721251432 4226568.758428884
问题在第2行,它说:

<Update typeName="feature:test_points" xmlns:feature="mypoints">

这使得GeoServer抛出一个NoApplicationCodeException,它又与一个通用的java.lang.NullPointerException相关但是,当我用以下内容替换该行时,请求运行良好:

<Update typeName="mypoints:test_points">

我的具体问题如下:

  • typeName=“mypoints:test\u points”
    实际上是形成请求的正确方法吗
  • 如果是这样的话,我用ol.format.WFS获取这种糟糕的XML有什么不对?
    功能从哪里来

提前谢谢你

功能:“mypoints”
是错误的,您应该使用URI来代替

谢谢!这正是问题所在。