Hi,
I made some tests with Geoserver 2.6-RC1 and curl with partial success. Just
like you I could create a new wmsstore (named "wmsStore") with REST. My command
was:
curl -v -u admin:geoserver -XPUT -H "Content-type: text/xml" -d @wmsput.xml
http://localhost:8080/geoserver/rest/workspaces/topp/wmsstores/wmsStore/wmsstore.xml
I did not manage to create a new cascaded WMS layer with REST. However, after I
had created a new cascaded WMS layer (named "new_WMS") with the admin utility
and new directory with "layer.xml" and "wmslayer.xml" appeared I could edit the
settings of this WMS layer with REST with a command like this:
curl -v -u admin:geoserver -XPUT -H "Content-type: text/xml" -d
@wmslayerput.xml
http://localhost:8080/geoserver/rest/workspaces/topp/wmsstores/wmsStore/wmslayers/new_WMS.xml
Input files "wmsput.xml" and "wmslayerput.xml" are annexed as renamed into
.txt. Now it is developers turn either to say that WMS layers can't be created
with REST or show us the command to use. I suggest to use layer "top:states"
from http://demo.opengeo.org/geoserver/wms as an example. I had to make my
tests with local Mapserver because I do not know how to make Jetty to go
through our proxy server.
-Jukka Rahkonen-
Allen Huang wrote:
Thank for replying
I uses python and the httplib library and not cURL and this is what I did.
This is what I use the setup wms store. This got this part by imitating the xml
that create datastore from postgis. Creating wms store. This will create a wms
store
XML
<wmsStore>
<name>aWMSstore</name>
<type>WMS</type>
<enabled>true</enabled>
<capabilitiesURL>http://demo.opengeo.org/geoserver/wms
?request=GetCapabilites</capabilitiesURL>
<user>username</user>
<password>password</password>
<metadata>
<entry key="useConnectionPooling">true</entry>
</metadata>
<maxConnections>6</maxConnections>
<connectTimeout>30</connectTimeout>
<readTimeout>60</readTimeout>
</wmsStore>
the REST url using http POST method
http://localhost:8080/geoserver/rest/workspaces/topp/wmsstores.xml
Now, this is what I did to create wms layer. This didn't work
XML
<wmsLayer>
<name>states</name>
<nativeName>states</nativeName>
<enabled>true</enabled>
<nativeCRS>EPSG:4326</nativeCRS>
<srs>EPSG:4326</srs>
<projectionPolicy>FORCE_DECLARED</projectionPolicy>
<keywords>
<string>states</string>
<string>features</string>
</keywords>
</wmsLayer>
the REST url using http POST method
http://localhost:8080/geoserver/rest/workspaces/topp/wmsstores/aWMSstore/wmslayers.xml
This is exactly what I did. Pretty standard. Hope you have better luck than me.
Allen
On Saturday, September 6, 2014 1:27 AM, Rahkonen Jukka (Tike)
<[email protected]<mailto:[email protected]>> wrote:
Hi,
I don't know if there are special limitations for WMS stores in REST or not but
you can read this Stackexchange question
http://gis.stackexchange.com/questions/112599/geoserver-datastore-property-update-via-rest-api/112612#112612.
Use it as an example and send us the complete REST requests which you used so
that we can repeat everything by copy-paste. Use localhost:8080 as host and
http://demo.opengeo.org/geoserver/wms as WMS and topp:states as layer to
cascade.
-Jukka Rahkonen-
________________________________
Allen Huang wrote:
> Is there a rest api for wmsstore or wmslayer? I don't think there is a page
> for it in the Geoserver documentation. I thought it would work the same as
> normal stores and featuretype/coverages and I was able to add a wmsstore with
> xml but that's it. Can't modify or delete wmsstore or even add wmslayer.
Allen
<wmsLayer>
<name>new_WMS</name>
<nativeName>new_WMS</nativeName>
<namespace>
<name>topp</name>
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate"
href="http://localhost:8080/geoserver/rest/namespaces/topp.xml"
type="application/xml"/>
</namespace>
<title>new_WMS_title</title>
<nativeCRS class="projected">PROJCS["WGS 84 / Pseudo-Mercator",

GEOGCS["WGS 84", 
DATUM["World Geodetic System 1984", 
SPHEROID["WGS 84", 6378137.0, 298.257223563,
AUTHORITY["EPSG","7030"]], 
AUTHORITY["EPSG","6326"]], 
PRIMEM["Greenwich", 0.0,
AUTHORITY["EPSG","8901"]], 
UNIT["degree", 0.017453292519943295], 
AXIS["Geodetic longitude", EAST], 
AXIS["Geodetic latitude", NORTH], 
AUTHORITY["EPSG","4326"]], 
PROJECTION["Popular Visualisation Pseudo Mercator",
AUTHORITY["EPSG","1024"]], 
PARAMETER["semi_minor", 6378137.0], 
PARAMETER["latitude_of_origin", 0.0], 
PARAMETER["central_meridian", 0.0], 
PARAMETER["scale_factor", 1.0], 
PARAMETER["false_easting", 0.0], 
PARAMETER["false_northing", 0.0], 
UNIT["m", 1.0], 
AXIS["Easting", EAST], 
AXIS["Northing", NORTH], 
AUTHORITY["EPSG","3857"]]</nativeCRS>
<srs>EPSG:3857</srs>
<nativeBoundingBox>
<minx>-1.97524E7</minx>
<maxx>1.9981E7</maxx>
<miny>6092560.0</miny>
<maxy>6.92711E7</maxy>
<crs class="projected">EPSG:3857</crs>
</nativeBoundingBox>
<latLonBoundingBox>
<minx>-180.0</minx>
<maxx>180.0</maxx>
<miny>47.914</miny>
<maxy>89.9978</maxy>
<crs>GEOGCS["WGS84(DD)", 
DATUM["WGS84", 
SPHEROID["WGS84", 6378137.0, 298.257223563]], 
PRIMEM["Greenwich", 0.0], 
UNIT["degree", 0.017453292519943295], 
AXIS["Geodetic longitude", EAST], 
AXIS["Geodetic latitude", NORTH]]</crs>
</latLonBoundingBox>
<projectionPolicy>FORCE_DECLARED</projectionPolicy>
<enabled>true</enabled>
<store class="wmsStore">
<name>wmsStore</name>
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate"
href="http://localhost:8080/geoserver/rest/workspaces/topp/wmsstores/wmsStore.xml"
type="application/xml"/>
</store>
</wmsLayer><wmsStore>
<name>wmsStore</name>
<type>WMS</type>
<enabled>true</enabled>
<metadata>
<entry key="useConnectionPooling">true</entry>
</metadata>
<__default>false</__default>
<capabilitiesURL>http://localhost:8060/cgi-bin/mapserv.exe?map=/ms4w/apps/cascade.map&service=wms&version=1.1.1&request=getcapabilities</capabilitiesURL>
<maxConnections>6</maxConnections>
<readTimeout>60</readTimeout>
<connectTimeout>30</connectTimeout>
</wmsStore>------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce.
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users