Following the post has this address, http://www.nabble.com/Getmap-with-Http-Post-do-not-go-tf4421060.html#a12610269,
I reformulate my request.
To send a request Getmap Post without parameter to the address
“http://127.0.0.1:8080/geoserver/wms", I use the method xmlhttprequest. In
return, one recoit of the text or xml and not an image.
By using the servlet “TestWfsPost” which requires in entry 2 parameters: URL
and body, it is possible to obtain an image but in another window but not in
a beacon <image>
When you send a posted xml GetMap document to the WMS, the *direct* response
is a PNG 'stream'.
So in your response to your xmlhttprequest, you have the actual binary
representation of a PNG (or gif, or whatever) file.
I'm not personally aware of any javascript code that can take the
byte-by-byte representation of an image file, and turn that into a displayed
image...but it's possible that there's something deep in the guts of ActiveX
or some other microsoft-tech-in-javascript technology that might make this
possible. Firefox allows some javascript->java binding, as well, which
might make something like this do-able.
My advice is the following:
Re-formulate your XML-POST request as a KVP-GET request, but taking the SLD
and putting it into the SLD_BODY parameter, and re-encoding the other
non-sld params as their various key-value pairs.
Then set this to be the src of the tag you're interested in (using
javascript) and you should be golden.
good luck!
--saul
Pouldu wrote:
Following the post has this address, http://www.nabble.com/Getmap-with-Http-Post-do-not-go-tf4421060.html#a12610269,
I reformulate my request.
To send a request Getmap Post Getmap without parameter to the address
“http://127.0.0.1:8080/geoserver/wms", I use the method xmlhttprequest. In
return, one recoit of the text or xml and not an image.
By using the servlet “TestWfsPost” which requires in entry 2 parameters:
URL and body, it is possible to obtain an image but in another window but
not in a beacon <image>
My question is: it is possible to recover the response of a request wms
post with code Javascript.
Thank you
unfortunately your issue seems to be a recurrent one, as afaik there's no way
of taking the binary image response from the getmap request and set it as the
source of an html <img> element.
One way to solve that, given you're already doing "ajax", would be to add a
custom response format to geoserver, which instead of returning the image
itself, stores it on a temporary directory and returns an xml document where
you can grab the image url from, and now you can set that url as the src
attribute in your <img> tag.
But it has its implicancies. Each time you do something like that, you're kind
of tieing yourself to the vendor (i.e. your client would only work with
geoserver as long as its the only wms that implements that response type).
So I would suggest you to do some server side programming yourself and
implement some proxying script that do the above, redirects to the WMS, gets
the image, stores it on a temporary directory and returns you an xml like
<wmsResponse><img src="http://myserver/tmp/abcd.png"/></wmsResponse>\.
Then you can get it and set it with a couple javascript, and still be able of
being backed by geoserver, mapserver, whatever.
my 2c.
gabriel
On Wednesday 12 September 2007 14:29:43 Pouldu wrote:
Following the post has this address, http://www.nabble.com/Getmap-with-Http-Post-do-not-go-tf4421060.html#a12610
269, I reformulate my request.
To send a request Getmap Post without parameter to the address
“http://127.0.0.1:8080/geoserver/wms", I use the method xmlhttprequest. In
return, one recoit of the text or xml and not an image.
By using the servlet “TestWfsPost” which requires in entry 2 parameters:
URL and body, it is possible to obtain an image but in another window but
not in a beacon <image>
My question is: it is possible to recover the response of a request wms
post with code Javascript.
Thank you
Thank you for your answers.
I will try solution SLD URL but with obligation to pass by php.
The Javascript will create the sld which will be put on the waiter with php
and a connection will be established towards SLD=http//toto.sld