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[&quot;WGS 84 / Pseudo-Mercator&quot;, 
&#xd;
  GEOGCS[&quot;WGS 84&quot;, &#xd;
    DATUM[&quot;World Geodetic System 1984&quot;, &#xd;
      SPHEROID[&quot;WGS 84&quot;, 6378137.0, 298.257223563, 
AUTHORITY[&quot;EPSG&quot;,&quot;7030&quot;]], &#xd;
      AUTHORITY[&quot;EPSG&quot;,&quot;6326&quot;]], &#xd;
    PRIMEM[&quot;Greenwich&quot;, 0.0, 
AUTHORITY[&quot;EPSG&quot;,&quot;8901&quot;]], &#xd;
    UNIT[&quot;degree&quot;, 0.017453292519943295], &#xd;
    AXIS[&quot;Geodetic longitude&quot;, EAST], &#xd;
    AXIS[&quot;Geodetic latitude&quot;, NORTH], &#xd;
    AUTHORITY[&quot;EPSG&quot;,&quot;4326&quot;]], &#xd;
  PROJECTION[&quot;Popular Visualisation Pseudo Mercator&quot;, 
AUTHORITY[&quot;EPSG&quot;,&quot;1024&quot;]], &#xd;
  PARAMETER[&quot;semi_minor&quot;, 6378137.0], &#xd;
  PARAMETER[&quot;latitude_of_origin&quot;, 0.0], &#xd;
  PARAMETER[&quot;central_meridian&quot;, 0.0], &#xd;
  PARAMETER[&quot;scale_factor&quot;, 1.0], &#xd;
  PARAMETER[&quot;false_easting&quot;, 0.0], &#xd;
  PARAMETER[&quot;false_northing&quot;, 0.0], &#xd;
  UNIT[&quot;m&quot;, 1.0], &#xd;
  AXIS[&quot;Easting&quot;, EAST], &#xd;
  AXIS[&quot;Northing&quot;, NORTH], &#xd;
  AUTHORITY[&quot;EPSG&quot;,&quot;3857&quot;]]</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[&quot;WGS84(DD)&quot;, &#xd;
  DATUM[&quot;WGS84&quot;, &#xd;
    SPHEROID[&quot;WGS84&quot;, 6378137.0, 298.257223563]], &#xd;
  PRIMEM[&quot;Greenwich&quot;, 0.0], &#xd;
  UNIT[&quot;degree&quot;, 0.017453292519943295], &#xd;
  AXIS[&quot;Geodetic longitude&quot;, EAST], &#xd;
  AXIS[&quot;Geodetic latitude&quot;, 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&amp;service=wms&amp;version=1.1.1&amp;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

Reply via email to