Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am using ExtJS ajax to send a data request to geoserver (which is in another domain different from web server), codes are as follows:

Ext.Ajax.request({ //send data request
        url : '../proxy.py?url=' + dataUrl,
        method : 'GET',
        headers: {
            'Content-Type': 'application/json'
        },
        success : function(response, opts) {
            var eventData = Ext.decode(response.responseText); //decode into JSON

            //parse eventData
        },
        failure: function(response, opts){
            Ext.Msg.alert("Failure", "Failed to retrieve event, please check service connection at " + dataUrl);                                    
        }
    });

since it relates to cross-domain issue, we employed a python proxy at web server, and put the GeoServer domain into the accessible list. If I put the request url in browser then I can get the JSON response; however by using ajax call in code, we got following error:

    <ows:Exception exceptionCode="MissingParameterValue" locator="request"> 
<ows:ExceptionText>Could not determine geoserver request from http request GET /geoserver/ows?service=WFS HTTP/1.1 
    Accept-Encoding: identity&#xd; 
    Host: XXXX&#xd; 
    Connection: close&#xd; 
    User-Agent: Python-urllib/2.5&#xd; &#xd; 
    </ows:ExceptionText> </ows:Exception>

I searched online, somebody said it's an issue related with proxy and the request headers. however, no detailed solution is found yet. I hope someone here can help me out.

thanks a lot!

UPDATE: using escape() to escape the request URL!

share|improve this question

1 Answer 1

up vote 2 down vote accepted

If you send in URL only:

/geoserver/ows?service=WFS

you get this error. Minimal URL should be:

/geoserver/ows?service=wfs&request=GetCapabilities

if you need capabilities call with this params. If you need GeoJSON request for layer URL should be like this:

http://localhost:8090/geoserver/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=topp:states&maxFeatures=50&outputFormat=json

UPDATE

in JS you should use encodeURIComponent to encode URL. escape() function shouldn't be used to encode URIs.

share|improve this answer
    
thanks for your reply. it turns out that I need to escape the URL, at least to escape the '?', '&' etc. So I use escape() and it's done. I don't know network request much, so really don't understand why this happens. –  Simon Nov 15 '11 at 22:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.