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've been working through a few tutorial/starter map samples on the OpenGeo and GeoExt websites and have come upon a problem I cannot solve. I'm trying to load a list of layers from my GeoServer into a GridPanel using GeoExt.data.WMSCapabilitiesStore. No matter what I try, I cannot get anything to show in the GridPanel. I thought I had cross domain issues at first, but the problem persists even when the webpage and the GeoServer data are on the same server.

Here's a link to my very barren looking web map: http://24.105.210.45/OpenGeoGeoExtMap1.html.

Here's the JavaScript that's supposed to access the wms and load the layer list:

    Ext.onReady(function() {
var grid = new Ext.grid.GridPanel({
    title: "Available WMS Layers",
    region: "north",
    height: 150,
    viewConfig: {forceFit: true},
    store: new GeoExt.data.WMSCapabilitiesStore({
        url: "http://24.105.210.45:8080/geoserver/wms?service=wms&version=1.1.1&request=GetCapabilities",
        autoLoad: true
        }),
        columns: [
            {header: "Name", dataIndex: "name", sortable: true},
            {header: "Title", dataIndex: "title", sortable: true},
            {header: "Abstract", dataIndex: "abstract"}
            ],

Any help with this, or just ideas of where to look next would be greatly appreciated.

share|improve this question
    
I get a 404 not found from 24.105.210.45/geoserver/… –  geographika Mar 18 '11 at 17:08
    
The full URL to the wms would be: 24.105.210.45:8080/geoserver/… –  Don Meltz Mar 18 '11 at 17:23
    
24.105.210.45/geoserver/… isn't returning a capabilities file - which is what your page is asking for. –  iant Mar 18 '11 at 17:38
    
iant - see my comment above –  Don Meltz Mar 18 '11 at 17:40
add comment

1 Answer

up vote 2 down vote accepted

Different port numbers are considered as different domains - even if the rest of the URL is the same. So if your main site is running on:

http://24.105.210.45:80

You would need a proxy to access:

http://24.105.210.45:8080/geoserver/wms?service=wms&version=1.1.1&request=GetCapabilities

So the proxy FAQ below applies in your case:

http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#ProxyHost

Why can't you run both your web application and Geoserver on the same port?

Update:

You can also get around the same domain policy using YQL - http://geographika.co.uk/accessing-cross-domain-data-with-yql

share|improve this answer
    
I'm running GeoServer and IIS 7.5. Neither will let me set their port to the others port. –  Don Meltz Mar 18 '11 at 18:45
    
@don You'll need a proxy, host the web site with GeoServer (on Apache), or you could try a URL rewrite approach - serverfault.com/questions/216004/… –  geographika Mar 18 '11 at 18:51
    
Thanks geographika - I'm struggling with understanding how proxies work and how to set them up, and with the URL rewrite option. I'm thinking it might be easier to just move everything on to Apache. –  Don Meltz Mar 18 '11 at 22:50
    
Unless you are using .NET in your web application, moving to Apache would be easier. If you need a proxy have a look at geographika.co.uk/a-proxy-for-iis-and-net - I think this should work with ports –  geographika Mar 18 '11 at 23:07
add comment

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.