[Geoserver-users] POST XML document/WMS

Dear All

I am studying with UNIGIS in the UK and for my dissertation I am looking
at different Open Source web mapping products.

I have become a little stuck in my research and I was wondering if
anybody could help.

I am looking at how GeoServer meets the WMS specifications and I have
been looking at SLD. I have started reading the OGC specification and
have reached a point where I cannot go any further due to a lack of
understanding.

I understand that a HTTP POST request is more efficient that a HTTP GET
with regard to including an SLD xml document (the xml document wouldn't
need to be either stored elsewhere on the web or including in the URL).
I have spotted the following line at:
http://docs.codehaus.org/display/GEOSDOC/WMS

c) (http post) WMS GetMap 1.2 Send the SLD (and other request
parameters) in a POST XML document. This is how the SLD spec says you
should do it.

I have also experimented with a HTML form (I attach as a text document)

I have realised that I can get the GetMap request to work on the NASA
wms server 'http://wms.jpl.nasa.gov/wms.cgi?’ using a HTML form, the URL
being the action and all the parameters being held in hidden inputs.
This works with both 'GET' and 'POST' actions - which I am not sure what
this means exactly!.

What I don't understand is how I would put this request into a XML
document and use the HTTP POST methodology to send it to the server and
hence, in theory, be able to incorporate a SLD. I have been looking on
the internet and have come across many technologies/specifications and
more (e.g. xml, xml http request object, soap).
Can you send a XML document via HTTP post using an internet browser or
does it require specialised software?

I was hoping that somebody would be able to direct me as to what I would
need to study in a logical order to understand this subject or even to
offer some explanation. I am not quite sure how big a subject I am
trying to broach.

I wish to understand this as I am surmising that what the WMS server
offers in terms of how the data is requested will affect the WMS client
software it can be linked to (for example MapBuilder,MapBender).

I found an OpenGIS discussion paper covering this but I couldn't make
much sense of it. I attach the paper.

Whilst I am here, I have some another query for anybody who has got this
far!
'All Registered Products' on the OGC website:
http://www.opengeospatial.org/resource/products
Does anybody know what criteria need to be met to be compliant (green)
or implementing (blue)?

Any help that anybody could give would be very gratefully received.

Many Thanks

John

WMS_Part2.pdf (179 KB)

nasa.html (665 Bytes)

I have spotted the following line at:
http://docs.codehaus.org/display/GEOSDOC/WMS

c) (http post) WMS GetMap 1.2 Send the SLD (and other request
parameters) in a POST XML document. This is how the SLD spec says you
should do it.

I have also experimented with a HTML form (I attach as a text document)

I have realised that I can get the GetMap request to work on the NASA
wms server 'http://wms.jpl.nasa.gov/wms.cgi?’ using a HTML form, the URL
being the action and all the parameters being held in hidden inputs.
This works with both 'GET' and 'POST' actions - which I am not sure what
this means exactly!.

Yeah, people can be unclear on this particular topic, and tend to shorthand inaccurately.

Here's the deal with WMS requests via GET vs. WMS requests via POST.

There are two styles in which you can request a map from a WMS. One is to encode your request parameters in a Key-Value-Pair style (KVP). So, for example, "bbox=12,12,24,24", "layers=myns:MyLayer1,myns:MyLayer2)". If you were to encode a WMS request in a KVP style, you would take all the various KVPs (each of which is defined in the WMS spec), stick ampersands between them and submit the whole long KVP string to the server via *either* HTTP-GET or HTTP-POST. HTTP-GET will put the KVPs in the URL string, while HTTP-POST puts them in the body of the HTTP request. Either way, what's important about this is that you're encoding your WMS request as a KEY-VALUE-PAIR WMS request.

HTML pages using the <form> element (and without using any fancy javascript) *always* encoding things in KVP style. In fact, it's probably the case that the WMS modeled its KVP style of encoding on HTML <form> semantics, because all browsers act this way and WMS wanted to be easily callable from an HTML form.

Separate from the KVP encodings, a quasi-official 'extension' of the WMS specification (discussion paper: http://portal.opengeospatial.org/files/?artifact_id=1118) defines a DIFFERENT way to encode WMS requests. Rather than KVPs, this paper defines a raw XML-document format, which should be sent as the SOLE content of the body of an HTTP-POST request. Unlike the above KVP via HTTP-POST request (where the POST body was a bunch of Key-Value pairs), the body of an HTTP-POST with XML request is ONLY THE XML. No equals signs, no "xml=" parameter and nothing extra in the url.

This definition is not particularly compatible with standard non-javascript HTML forms, and I don't think you can have a browser POST (via a <form action="mywms"> tag) an all-XML WMS request without the use of javascript. I'll continue below.

What I don't understand is how I would put this request into a XML
document and use the HTTP POST methodology to send it to the server and
hence, in theory, be able to incorporate a SLD. I have been looking on
the internet and have come across many technologies/specifications and
more (e.g. xml, xml http request object, soap).
Can you send a XML document via HTTP post using an internet browser or
does it require specialised software?

It turns out that the WMS and WFS specifications aren't the only technologies in the entire world that want to use the body of an HTTP-POST request as the transport for XML messages or documents (without any KVPs at all, remember!) For example, SOAP does this, as do many of the google apis, yahoo apis and innumerable other web-based apis.

So what is a web developer to do? We'd love to be able to send raw XML requests as the body of an HTTP-POST request, but there's no way to do it from HTML! Well, the folks at microsoft, mozilla, apple and opera all came up with remarkably similar ways of doing this using a special javascript object. Generically, the technology is called 'XMLHttpObject', and while the specific implementations and javascript calls that you have to make differ from browser to browser (making web developers around the world sigh in pain), there is a way to use javascript inside a web-browser to craft just these sorts of HTTP-POST requests with XML inside them.

In addition, many 'heavierweight' technologies have supported direct XML POST for a long time. Java clients, .Net clients, python, php, perl...pretty much any real programming language can do it easily. It just took the javascript vendors (MS, Mozilla, Apple, Opera, etc.) a long time to get an almost-consistent implementation into their browsers.

All of this, by the way, applies just as accurately to WFS as well. Except WFS has had the XML-POST stuff built in to the spec from the very beginning, whereas the WMS had it 'tacked on' later.

Hopefully that helps a bit. I'd suggest looking at XMLHttpObject if you're married to the idea of using javascript in a web-browser to access a WMS via HTTP-XML POST. That said, what you get back from a WMS is generally a raw image stream, so I'm not sure you'd have a lot of luck getting the image into the web page (anyone know if you can do this?).

One thing that strikes me about your email is the following sentence:

> to send it to the server and
> hence, in theory, be able to incorporate a SLD.

If your concern is that you want to incorporate an SLD into your WMS request, you can do so while still using the KVP encoding style (which can be much more browser friendly). Simply craft your SLD, and add it as yet another Key-Value-Parameter:

http://server/geoserver/wms?request=getmap&...&SLD=&lt;my&gt;&lt;sld&gt;&lt;goes&gt;&lt;here&gt;&lt;/here&gt;&lt;/goes&gt;&lt;/sld&gt;&lt;/my&gt;

This way you get the full expressiveness of SLD, and you can load your image simply by using that URL as the value of an <img src="http://url…"> parameter.

Good luck!
--saul

I was hoping that somebody would be able to direct me as to what I would
need to study in a logical order to understand this subject or even to
offer some explanation. I am not quite sure how big a subject I am
trying to broach.

I wish to understand this as I am surmising that what the WMS server
offers in terms of how the data is requested will affect the WMS client
software it can be linked to (for example MapBuilder,MapBender).

I found an OpenGIS discussion paper covering this but I couldn't make
much sense of it. I attach the paper.

Whilst I am here, I have some another query for anybody who has got this
far!
'All Registered Products' on the OGC website:
http://www.opengeospatial.org/resource/products
Does anybody know what criteria need to be met to be compliant (green)
or implementing (blue)?

Any help that anybody could give would be very gratefully received.

Many Thanks

John

------------------------------------------------------------------------

------------------------------------------------------------------------

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

------------------------------------------------------------------------

_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

...

Whilst I am here, I have some another query for anybody who has got this
far!
'All Registered Products' on the OGC website:
http://www.opengeospatial.org/resource/products
Does anybody know what criteria need to be met to be compliant (green)
or implementing (blue)?

Compliant means you've passed the CITE tests (http://cite.opengeospatial.org/), so you're officially 'interopertable' according to the standards of the OGC. Blue basically just means that you think you implement the spec. Some may be really close - just haven't gotten around to passing the tests to be sure - some may be really far. Any one can say that they're implementing the spec, so it's not the _best_ indication of interoperability. After you pass the tests you also get to put the logos on your homepage.

And that reminds me, GeoServer is WMS compliant, I need to get that page upgraded to reflect it.

best regards,

Chris

Any help that anybody could give would be very gratefully received.

Many Thanks

John

!DSPAM:1003,44ca47f7155881425493344!

------------------------------------------------------------------------

------------------------------------------------------------------------

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

!DSPAM:1003,44ca47f7155881425493344!

------------------------------------------------------------------------

_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:1003,44ca47f7155881425493344!

--
Chris Holmes
The Open Planning Project
http://topp.openplans.org