以下WFS GetFeature请求对Geoserver没有任何问题,但在ArcGIS中失败。
JavaScript调用:
jQuery.ajax({
type: "POST",
url: "http://......",
data: "...",
headers: {
'Content-Type': 'application/xml'
},
dataType: 'xml',
error: function (xhr,status,error){
console.debug(status + " - "+ error);
},
success: callBack
});
POST正文(数据):
<GetFeature xmlns="http://www.opengis.net/wfs" service="WFS" version="1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
<Query typeName="WellHole" srsName="EPSG:3857">
<Filter xmlns="http://www.opengis.net/ogc">
<PropertyIsEqualTo>
<PropertyName>OBJECTID</PropertyName>
<Literal>402</Literal>
</PropertyIsEqualTo>
</Filter>
</Query>
</GetFeature>
JavaScript错误(客户端):
XMLHttpRequest cannot load http://..../MapServer/WFSServer. Response for preflight has invalid HTTP status code 400
ArcGIS服务器错误(服务器):
Error handling request to service 'Target/OGDR_Fahud.MapServer'. AutomationException: 0x80070057 - Invalid http method. in '"esriGeoDatabaseDistributed.WFSServer"'
com.esri.arcgis.discovery.ejb.ArcGISServiceException: AutomationException: 0x80070057 - Invalid http method. in '"esriGeoDatabaseDistributed.WFSServer"'
at com.esri.arcgis.discovery.ejb.impl.GenericServerBean.handleRequest(GenericServerBean.java:72)
at sun.reflect.GeneratedMethodAccessor3891.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497) at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:162) at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:144) at org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:164) at org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:92) at sun.reflect.GeneratedMethodAccessor3890.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:162) at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:144) at org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:122) at org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:221) at org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:174) at org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:136) at org.apache.openejb.server.ejbd.EjbRequestHandler.doEjbObject_BUSINESS_METHOD(EjbRequestHandler.java:238) at org.apache.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:129) at org.apache.openejb.server.ejbd.EjbDaemon.processEjbRequest(EjbDaemon.java:196) at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:149) at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:71) at org.apache.openejb.server.ejbd.KeepAliveServer$Session.service(KeepAliveServer.java:213) at org.apache.openejb.server.ejbd.KeepAliveServer.service(KeepAliveServer.java:233) at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:66) at org.apache.openejb.server.ServicePool$2.run(ServicePool.java:91) at org.apache.openejb.server.ServicePool$3.run(ServicePool.java:120) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: com.esri.arcgis.discovery.servicelib.AGSException: AutomationException: 0x80070057 - Invalid http method. in '"esriGeoDatabaseDistributed.WFSServer"' at com.esri.arcgis.discovery.servicelib.impl.RemoteServiceImpl.handleRequest(RemoteServiceImpl.java:98) at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323) at sun.rmi.transport.Transport$1.run(Transport.java:200) at sun.rmi.transport.Transport$1.run(Transport.java:197) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:196) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$256(TCPTransport.java:683) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:276) at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:253) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:162) at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:227) at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:179) at com.sun.proxy.$Proxy43.handleRequest(Unknown Source) at com.esri.arcgis.discovery.ejb.util.EJBBase.handleRequestBase(EJBBase.java:548) at com.esri.arcgis.discovery.ejb.impl.GenericServerBean.handleRequest(GenericServerBean.java:70) ... 29 more Caused by: java.lang.Exception: AutomationException: 0x80070057 - Invalid http method. in '"esriGeoDatabaseDistributed.WFSServer"' at com.esri.arcgis.discovery.servicelib.impl.ServiceImpl.handleRequest(ServiceImpl.java:244) at com.esri.arcgis.discovery.servicelib.impl.RemoteServiceImpl.handleRequest(RemoteServiceImpl.java:92) at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323) at sun.rmi.transport.Transport$1.run(Transport.java:200) at sun.rmi.transport.Transport$1.run(Transport.java:197) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:196) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$256(TCPTransport.java:683) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682) ... 3 more Caused by: AutomationException: 0x0 - null at com.esri.arcgis.interop.NativeObjRef.nativeVtblInvokeNative(Native Method) at com.esri.arcgis.interop.NativeObjRef.nativeVtblInvoke(Unknown Source) at com.esri.arcgis.interop.NativeObjRef.invoke(Unknown Source) at com.esri.arcgis.interop.Dispatch.vtblInvoke(Unknown Source) at com.esri.arcgis.system.IWebRequestHandlerProxy.handleStringWebRequest(Unknown Source) at com.esri.arcgis.discovery.servicelib.impl.SOThread.a(SOThread.java:1010) at com.esri.arcgis.discovery.servicelib.impl.SOThread.a(SOThread.java:692) at com.esri.arcgis.discovery.servicelib.impl.SOThread.run(SOThread.java:446)
我也注意到以下内容:
1)如果我使用上面的POST请求(相同的代码)和Geoserver的TestServlet(Web界面上的演示部分),它就可以工作。
2)以下http GET请求适用于ArcGIS:
http://..../MapServer/WFSServer?service=WFS&request=getfeature&version=1.1.1&typename=wellhole&Filter=%3Cogc:Filter%3E%3Cogc:PropertyIsEqualTo%3E%3Cogc:PropertyName%3EOBJECTID%3C/ogc:PropertyName%3E%3Cogc:Literal%3E402%3C/ogc:Literal%3E%3C/ogc:PropertyIsEqualTo%3E%3C/ogc:Filter%3E
请帮忙。
答案 0 :(得分:-1)
我认为这个问题可能是你的POST请求体中没有命名空间。
也许你可以尝试在每个标签中添加名称空间,如下例所示,让我们知道吗?
<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:cgf="http://www.opengis.net/cite/geometry" outputFormat="GML2" version="1.0.0" service="WFS">
<wfs:Query typeName="esri:we">
<ogc:Filter>
<ogc:BBOX>
<ogc:PropertyName>gml:multiPointProperty</ogc:PropertyName>
<gml:Box xmlns="http://www.opengis.net/cite/spatialTestSuite" srsName="EPSG:4326">
<gml:coordinates>-122.087210506228, 37.208402, -121.813389493772, 37.383473</gml:coordinates>
</gml:Box>
</ogc:BBOX>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>
答案 1 :(得分:-1)
我只是尝试使用命名空间,但我得到了相同的输出。
<wfs:GetFeature xmlns="http://www.opengis.net/wfs"
service="WFS" version="1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
<wfs:Query typeName="WellHole" srsName="EPSG:3857" >
<ogc:Filter xmlns="http://www.opengis.net/ogc">
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>OBJECTID</ogc:PropertyName>
<ogc:Literal>402</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>