我曾嘗試複製涉及WFS請求(this one)的GWT開放層展示示例之一。我不停的代碼,只是修改了它是一個簡單的組合,而不是一個抽象的例子,像這樣:IE11中來自GWT開放層的格式錯誤的WFS XMLHttpRequest
public class Example extends Composite {
public Example() {
buildPanel();
}
public void buildPanel() {
OpenLayers.setProxyHost("olproxy?targetURL=");
//create some MapOptions
MapOptions defaultMapOptions = new MapOptions();
defaultMapOptions.setNumZoomLevels(16);
MapWidget mapWidget = new MapWidget("500px", "500px", defaultMapOptions);
Map map = mapWidget.getMap();
WMSParams wmsParams = new WMSParams();
wmsParams.setFormat("image/png");
wmsParams.setLayers("topp:states");
wmsParams.setStyles("");
WMSOptions wmsLayerParams = new WMSOptions();
wmsLayerParams.setUntiled();
wmsLayerParams.setTransitionEffect(TransitionEffect.RESIZE);
String wmsUrl = "http://demo.opengeo.org/geoserver/wms";
WMS wmsLayer = new WMS("Basic WMS", wmsUrl, wmsParams, wmsLayerParams);
//Create a WFS layer
WFSProtocolOptions wfsProtocolOptions = new WFSProtocolOptions();
wfsProtocolOptions.setUrl("http://demo.opengeo.org/geoserver/wfs");
wfsProtocolOptions.setFeatureType("states");
wfsProtocolOptions.setFeatureNameSpace("http://www.openplans.org/topp");
//if your wms is in a different projection use wfsProtocolOptions.setSrsName(LAMBERT72);
WFSProtocol wfsProtocol = new WFSProtocol(wfsProtocolOptions);
VectorOptions vectorOptions = new VectorOptions();
vectorOptions.setProtocol(wfsProtocol);
vectorOptions.setStrategies(new Strategy[]{new BBoxStrategy()});
//if your wms is in a different projection use vectorOptions.setProjection(LAMBERT72);
final Vector wfsLayer = new Vector("wfsExample", vectorOptions);
wfsLayer.setFilter(new FeatureIdFilter(new String[]{"states.30"}));
//note that you can request the FID of a VectorFeature using getFID()
map.addLayer(wmsLayer);
map.addLayer(wfsLayer);
//Lets add some default controls to the map
map.addControl(new LayerSwitcher()); //+ sign in the upperright corner to display the layer switcher
map.addControl(new OverviewMap()); //+ sign in the lowerright to display the overviewmap
map.addControl(new ScaleLine()); //Display the scaleline
//Center and zoom to a location
map.setCenter(new LonLat(-100, 40), 4);
initWidget(mapWidget);
mapWidget.getElement().getFirstChildElement().getStyle().setZIndex(0); //force the map to fall behind popups
}
}
我部署包含此面板我的GWT應用程序,並運行它在Internet Explorer 11使用的開發工具,我檢查了WFS XMLHttpRequest,要求使用指定的id的功能。 XML請求如下:
<wfs:GetFeature 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">
<wfs:Query typeName="feature:states" xmlns:NS1="" NS1:xmlns:feature="http://www.openplans.org/topp">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:And>
<ogc:FeatureId fid="states.30" />
<ogc:BBOX>
<ogc:PropertyName>the_geom</ogc:PropertyName>
<gml:Box xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326">
<gml:coordinates decimal="." cs="," ts=" ">-143.9453125,-3.9453125 -56.0546875,83.9453125</gml:coordinates>
</gml:Box>
</ogc:BBOX>
</ogc:And>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>
同一請求,始發從陳列櫃例如,是這樣的,而不是:
<wfs:GetFeature 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">
<wfs:Query typeName="feature:states" xmlns:feature="http://www.openplans.org/topp">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:And>
<ogc:FeatureId fid="states.30"/>
<ogc:BBOX>
<ogc:PropertyName>the_geom</ogc:PropertyName>
<gml:Box xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326">
<gml:coordinates decimal="." cs="," ts=" ">-143.9453125,-3.9453125 -56.0546875,83.9453125</gml:coordinates>
</gml:Box>
</ogc:BBOX>
</ogc:And>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>
它們是相同的,除了用於該位第2行:。 ... xmlns:NS1 =「」NS1:xmlns:feature = ... 這是一個問題,因爲它使得我的請求無法被Geoserver解析(它說org.xml.sax.SAXParseException:屬性的值「prefix =」xmlns「,localpart =」ns1「,rawname =」xmlns:ns1「」無效。前綴名稱空間綁定可能不爲空)。 這似乎也發生在不同種類的WFS特徵過濾器(即邏輯)上。 此外,這隻發生在IE11上。在Firefox和Chrome上運行時請求已正確構建。我正在使用GWT 2.5.1和GWT-openlayers 1.0。
我需要使它工作,但我無法找出是什麼原因導致這種IE上的異常行爲...
thanx,這對我的情況也有幫助,也許你應該在你的回答中引用解決方法代碼,以防鏈接不再可用 – denu