How to correctly request a geoserver WFS via POST? -


I have an example that includes our data, through this request GET fixes all rights and the expected results gives. But unfortunately it does not work with the post.

Geoserver / wfs? Service = wfs and version = 1.1.0 and request = GetCapabilities

I test it with wget, so the command looks like this:

  Wget -o wfs' http: // myserver: 8080 / geoserver / wfs? Service = wfs and version = 1.1.0 and request = GetCapabilities'   

Now I try the capabilities - Request with POST. I create a file with the following content request (designated request):

  & amp; Lt; GetCapabilities Service = "WFS" xmlns = "http://www.opengis.net/wfs" xmlns: Xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: schema location = "http: //www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1./wfs.xsd "/>   

I run it against Geoserver with the following wget:

  wget -O wfs --post-file = request 'http: // myserver : 8080 / geographic / wfs'   

But now I get the OWS-exception:

  & lt; Ows: ExceptionReport xmlns: ows = "http: //www.opengis.net/ows/1.1" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" version = "2.0.0" XSI: Schema location = "http: //www.opengis .net / ows / 1.1 http: // moa: 8080 / geoserver / schemas / ows / 1.1.0 / owsAll.xsd" & gt; & Lt; Ows: exception exception code = "missing criminal value" locator = "request" & gt; & Lt; Ows: ExceptionText & gt; Could not determine geoserver request from http request. Org.geoserver.platform.AdvancedDispatchFilter$AdvancedDispatchHttpRequest@1e5c2cc< / Ows: ExceptionText> & Lt; / Ows: exceptions & gt; & Lt; / Ows: ExceptionReport & gt;   

It seems that no post-body has been sent or it has not been ignored. What's wrong with me here?


Edit : Okay, I fixed the problem. The problem is that Geoserver expects a content-type-header to post an XML-file, so the correct request looks like the following:

  wget -o wfs --header = 'Content-Type: Text / xml' --post-file = request.xml 'http: // myserver: 8080 / geographic / wfs'   

This gives the expected results.

I tried to check in your case but I have no server, so I

Received the exam: http: //demo.opengeo. Org / geoserver / wfs? Service = wfs and version = 1.1.0 and request = GetCapabilities

I got a full response like you

POST test: I used the http://www.hurl.it/ because I'm on a Windows computer with the following parameters: < / P>

  • URL:
  • Parameter: Add Body & gt; Like you:

    & amp; Lt; GetCapabilities Service = "WFS" xmlns = "http://www.opengis.net/wfs" xmlns: xsi = "http: //www.w3.org/2001/XMLSchema-instance" xsi: schema location = "http: //www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"/>

    And I got a similar response to the GET version.

    Can you try the same test with this demo server?


    UPDATE

    After chatting some comments, OP detects the solution itself to POST calls The content-type-header information is missing in it which is mandatory.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -