Thanks a lot.<br><br><div class="gmail_quote">On Sun, Apr 18, 2010 at 1:11 AM, Gabriel Nolasco <span dir="ltr"><<a href="mailto:nolasco_gabriel@yahoo.com.br">nolasco_gabriel@yahoo.com.br</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font: inherit;" valign="top">Hi,<br><br>You must install a proxy script to retrieve information from remote domains via an XMLHttpRequest.<br><br><a href="http://trac.openlayers.org/wiki/FrequentlyAskedQuestions#ProxyHost" target="_blank">http://trac.openlayers.org/wiki/FrequentlyAskedQuestions#ProxyHost</a><br>
<br>Then you can use the class OpenLayers.Format.WMSCapabilities to parse the response like this:<br><br>var capabilitiesRequest = OpenLayers.Request.GET({<div class="im"><br> url: "<a href="http://labs.metacarta.com/wms/vmap0?request=GetCapabilities&service=WMS" target="_blank">http://labs.metacarta.com/wms/vmap0?request=GetCapabilities&service=WMS</a>",<br>
</div> success: parseWmsCapabilities,<br> failure: function(response) {}<br>});<br><br>var parseWmsCapabilities = function(response) {<br> var wmsParser = new OpenLayers.Format.WMSCapabilities();<br> var wmsCapabilities = wmsParser.read(response.responseText);<br>
for(var i=0; i<wmsCapabilities.capability.layers.length;
++i) { <br> alert(wmsCapabilities.capability.layers[i].name);<br> }<br>} <br><br>Best regards,<br><font color="#888888">Gabriel Nolasco</font><div><div></div><div class="h5"><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;">
<div>Hi all,<br>I want to get WMSGetCapabilites from server. The URL is<br><a href="http://labs.metacarta.com/wms/vmap0?request=GetCapabilities&service=WMS" target="_blank">http://labs.metacarta.com/wms/vmap0?request=GetCapabilities&service=WMS</a> and<br>
works fine.<br><br>But when I "execute" the next code the request never ends or returns me a<br>empty response.<br><br>Anybody can help me clarifiying me how to get wms capabilities and later get<br>the available layer names?<br>
<br>Thanks in advance.<br><br> <html><br> <head><br>
<title></title><br> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><br> <script type="text/javascript" src='./js/ol/OpenLayers.js'></script><br>
<script type="text/javascript"><br> request = OpenLayers.Request.GET({<br> url: "<br><a href="http://labs.metacarta.com/wms/vmap0?request=GetCapabilities&service=WMS" target="_blank">http://labs.metacarta.com/wms/vmap0?request=GetCapabilities&service=WMS</a>",<br>
success: function(request){<br> alert(request.responseText);<br> },<br> failure:
function(request){<br> alert('BOOOOOO!');<br> }<br><br> });<br> </script><br><br> </head><br> <body><br> the body content<br> </body><br>
</html><br></div></blockquote></div></div></td></tr></tbody></table><br>
</blockquote></div><br><br clear="all"><br>-- <br>|-----------------------------------------------------------<br>| <a href="http://www.astracanada.net">http://www.astracanada.net</a><br>| <a href="http://acuriousanimal.orggeo.net">http://acuriousanimal.orggeo.net</a><br>
|-----------------------------------------------------------<br>| <a href="http://acuriousanimal.blogspot.com">http://acuriousanimal.blogspot.com</a><br>| <a href="http://theballoonproject.blogspot.com">http://theballoonproject.blogspot.com</a><br>
|-----------------------------------------------------------<br>| _ __ <br>| /_| ( _ _/'_ _ <br>|( |. __)(//)//(/(/() <br>| _/ <br>|-----------------------------------------------------------<br>