简体   繁体   English

通过HTTP POST的WFS GetFeature请求不适用于ArcGIS

[英]WFS GetFeature request via http POST does not work with ArcGIS

The following WFS GetFeature request works with no problem with Geoserver but it fails with ArcGIS. 以下WFS GetFeature请求对于Geoserver而言没有问题,但对于ArcGIS则失败。

JavaScript call: 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 body (data): 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 error (client): JavaScript错误(客户端):

XMLHttpRequest cannot load http://..../MapServer/WFSServer. Response for preflight has invalid HTTP status code 400

ArcGIS server error (server): ArcGIS Server错误(服务器):

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)

And I have also noticed the following: 而且我还注意到以下几点:

1) If I use the POST request above (same code) with Geoserver's TestServlet (demo section on the web interface) it works. 1)如果我将上面的POST请求(相同的代码)与Geoserver的TestServlet(Web界面上的演示部分)一起使用,则它可以工作。

2) The following http GET request works with ArcGIS: 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

Please help. 请帮忙。

I think this problem could be missing namespace in your POST request body. 我认为此问题可能是您的POST请求正文中缺少名称空间。

Maybe you could try to add namespace in each tag like following example and let us know? 也许您可以尝试像下面的示例一样在每个标签中添加名称空间,并告诉我们?

<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>

I just tried with namespaces but I got the same output. 我只是尝试使用名称空间,但是得到了相同的输出。

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM