geosolutions-it / geoserver-manager

Java client library for GeoServer
MIT License
255 stars 192 forks source link

create "WMS - Cascades a remote Web Map Service" store #49

Open kissmd opened 12 years ago

kissmd commented 12 years ago

lets take this one step even further:

i also would like to register a new layer through the rest api which mirrors an already existing wms layer from another geoserver.

the web interface has it: geoserver /stores /add new store /"WMS - Cascades a remote Web Map Service"

is there any possibility for that?

as i see even the geoserver rest api does not provide an option for that, does it? is there any plan, you will add a new call to the geoserver-manager?

thx!

kissmd commented 12 years ago

am i right, if i post the proper xml-s (for creating a wms store and a layer in it) to the rest api, it will automatically register the layer for me? should i give it a try?

ccancellieri commented 12 years ago

Yes we are missing this feature and The rest documentation is also not very clear about this type of store. We have not planned to work on this in the short length plan but we will evaluate patches to add support for this format if you provide a pull request.

kissmd commented 11 years ago

hi i had some time to work on this, but i am stucked.

i try to post to

http://10.0.8.241:8080/geoserver_212/rest/workspaces/misu5/datastores/

this xml:

<wmsStore>
    <name>FL1029</name>
    <type>WMS</type>
    <description>Forwarded layer 1029</description>
    <enabled>true</enabled>
    <__default>false</__default>
    <capabilitiesURL>http://10.0.8.241:8080/geoserver_212/Pilot/wms?service=WMS&amp;version=1.1.0&amp;layers=Pilot:HouseNumbers_point_wgs84&amp;styles=&amp;width=512&amp;height=465&amp;srs=EPSG:4326&amp;format=image/png&amp;transparent=true&amp;REQUEST=GetCapabilities
    </capabilitiesURL>
    <user>misu</user>
    <password>misu</password>
    <maxConnections>6</maxConnections>
    <connectTimeout>30</connectTimeout>
    <readTimeout>60</readTimeout>
    <workspace>
        <name>misu5</name>
        <link xmlns="atom" rel="alternate"
            href="http://10.0.8.241:8080/geoserver_212/rest/workspaces/misu5.xml"
            type="application/xml" />
    </workspace>
    <metadata>
        <entry key="useConnectionPooling">true</entry>
    </metadata>
</wmsStore>

but the geoserver log shows:

24 Jan 10:42:06 INFO [org.geoserver] - Loaded store 'FL1029', enabled
24 Jan 10:42:06 ERROR [org.geoserver.rest] -
java.lang.ClassCastException
        at java.lang.Class.cast(Class.java:2990)
        at org.geoserver.config.util.XStreamPersister.load(XStreamPersister.java:507)
        at org.geoserver.catalog.rest.AbstractCatalogResource$1.read(AbstractCatalogResource.java:50)
        at org.geoserver.rest.format.StreamDataFormat.toObject(StreamDataFormat.java:33)
        at org.geoserver.rest.ReflectiveResource.handlePost(ReflectiveResource.java:117)
        at org.restlet.Finder.handle(Finder.java:296)
        at org.geoserver.rest.BeanDelegatingRestlet.handle(BeanDelegatingRestlet.java:37)
        at org.restlet.Filter.doHandle(Filter.java:105)
        at org.restlet.Filter.handle(Filter.java:134)
        at org.restlet.Router.handle(Router.java:444)
        at org.geoserver.rest.RESTDispatcher$1.handle(RESTDispatcher.java:204)
        at com.noelios.restlet.ext.servlet.ServletConverter.service(ServletConverter.java:129)
        at org.geoserver.rest.RESTDispatcher.handleRequestInternal(RESTDispatcher.java:86)
        at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
        at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)

if i compare this with a manually registered wmsstore only the wmsLayers tag is missing, but i think this should be added later .

what am i missing? what should i do different?

(the urls and names are correct)

thx. misu

ccancellieri commented 11 years ago

Hi Misu, GeoServer may supports this functionality since 2.1 but GeoServer Manager still doesn't. I encourage you to write about these problems on the GeoServer users mailing lists (http://geoserver.org/display/GEOS/Mailing+Lists). Cheers, Carlo

2013/1/24 kissmd notifications@github.com

hi i had some time to work on this, but i am stucked.

i try to post to

http://10.0.8.241:8080/geoserver_212/rest/workspaces/misu5/datastores/

this xml:

FL1029 WMS Forwarded layer 1029 true <__default>false http://10.0.8.241:8080/geoserver_212/Pilot/wms?service=WMS&version=1.1.0&layers=Pilot:HouseNumbers_point_wgs84&styles=&width=512&height=465&srs=EPSG:4326&format=image/png&transparent=true&REQUEST=GetCapabilities http://10.0.8.241:8080/geoserver_212/Pilot/wms?service=WMS&version=1.1.0&layers=Pilot:HouseNumbers_point_wgs84&styles=&width=512&height=465&srs=EPSG:4326&format=image/png&transparent=true&REQUEST=GetCapabilities misu misu 6 30 60 misu5 true

but the geoserver log shows:

24 Jan 10:42:06 INFO [org.geoserver] - Loaded store 'FL1029', enabled 24 Jan 10:42:06 ERROR [org.geoserver.rest] - java.lang.ClassCastException at java.lang.Class.cast(Class.java:2990) at org.geoserver.config.util.XStreamPersister.load(XStreamPersister.java:507) at org.geoserver.catalog.rest.AbstractCatalogResource$1.read(AbstractCatalogResource.java:50) at org.geoserver.rest.format.StreamDataFormat.toObject(StreamDataFormat.java:33) at org.geoserver.rest.ReflectiveResource.handlePost(ReflectiveResource.java:117) at org.restlet.Finder.handle(Finder.java:296) at org.geoserver.rest.BeanDelegatingRestlet.handle(BeanDelegatingRestlet.java:37) at org.restlet.Filter.doHandle(Filter.java:105) at org.restlet.Filter.handle(Filter.java:134) at org.restlet.Router.handle(Router.java:444) at org.geoserver.rest.RESTDispatcher$1.handle(RESTDispatcher.java:204) at com.noelios.restlet.ext.servlet.ServletConverter.service(ServletConverter.java:129) at org.geoserver.rest.RESTDispatcher.handleRequestInternal(RESTDispatcher.java:86) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)

if i compare this with a manually registered wmsstore only the wmsLayers tag is missing, but i think this should be added later .

what am i missing? what should i do different?

(the urls and names are correct)

thx. misu

— Reply to this email directly or view it on GitHubhttps://github.com/geosolutions-it/geoserver-manager/issues/49#issuecomment-12644414.

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more

information.

Dott. Carlo Cancellieri @cancellieric Software Engineer

GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 mobile: +39 3371094494 fax: +39 0584 962313

http://www.geo-solutions.it http://twitter.com/geosolutions_it