Search code examples
javascriptrequestopenlayers

Send a request with openlayers


I am trying to make a request to a SOS service using Openlayers like this (part of the code):

            var params = {'service':'SOS','version':'1.0.0','request':'getCapabilities'};
            var paramString = OpenLayers.Util.getParameterString(params);
            url = OpenLayers.Util.urlAppend(this.url, paramString);

            OpenLayers.Request.GET({url: url,
                success: this.parseSOSCaps, scope: this,
                failure: alert(url)});
        }

For some reason the url that I produced in this code is not correct. The failure function, alerts this url:

           http://cawa.gfz-potsdam.de:8080/SOS/sos?service=SOS&version=1.0.0&request=getCapabilities

I also tried manually, through my browser to send the request (using the above url) but it doesn't work. I am sure that the host server is correct.

My questions are: what am I doing wrong? Is the above format of the url wrong? What would be the alternative? Perhaps to send the request in XML format?

Thanks Dimitris


Solution

  • After all I managed to make the above code to work. There is not a bug in the code. The problem was that I haven't included in the allowedHosts of the proxy.cgi (wamp\bin\apache\apache2.2.22\cgi-bin\proxy.cgi) file, the host of the service. After I did it was working perfectly.