I think you have to use a proxy because that's how WFS works, that will end up making any request you use through openlayers go through a proxy also. I am sort of new to openlayers as well and just figure stuff out from their examples and experimentation. I just plug in urls in openlayers to my rails server and then see what kinds of requests openlayers sends out that come out in the console or log and try to figure out how to handle them etc. They have some examples on the proxy. I think they have a perl cgi example. What is your web server ? Are you use PHP, Java, etc ? <br>
<br><div class="gmail_quote">On Wed, Dec 9, 2009 at 4:04 AM, Damith Amarasena <span dir="ltr"><<a href="mailto:amarasenadamith@gmail.com">amarasenadamith@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Lammie,<br><br>Thanks
for your reply. You have mentioned about a proxy here. Does that mean I
have to use one? Sorry if you feel this as a dumb question, but I'm new
to openlayers and whole GIS stuff. Please guide me on this.<br>
<br>Regards,<br>damith<br><br><div class="gmail_quote"><div><div class="h5">On Wed, Dec 9, 2009 at 2:02 AM, Lammie Jonson <span dir="ltr"><<a href="mailto:jrubiando@gmail.com" target="_blank">jrubiando@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div class="h5">
// Here's is how I did this. <br><br>// You need to use the openlayers proxy:<br><br> OpenLayers.ProxyHost="proxy.cgi?url=";<br><br>// WFS layer points to geoserver or your host<br><br> state_layer = new OpenLayers.Layer.WFS( "States WFS",<br>
"<a href="http://yourhost:8080/geoserver/wfs" target="_blank">http://yourhost:8080/geoserver/wfs</a>",<br> { typename: 'topp:states'} );<br><br>===============<br><br>
I'm using rails, so I create a sort of fake proxy in config/routes.rb<br>
<br> map.connect '/proxy.cgi',<br> :controller => 'wfs',<br> :action => 'myproxy'<br><br>Then inside the myproxy() action:<br><br>if url =~ /geoserver/<br> # geo server WFS data<br>
uri = URI.parse(url)<br> resp = Net::HTTP.get_response(uri)<br> send_data(resp.body, :type => 'text/xml')<br> end<br>
<br></div></div>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@openlayers.org" target="_blank">Users@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
<br></blockquote></div><br>
</blockquote></div>