[Geoserver-users] REST AND WFS

Hello,

I insert a new layer (postgis table) with rest api for using it in wfs-t but when I try to make a getFeature I an error.

The WMS request work but not the wfs.

This is my request :

http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer&srs=EPSG:27572

And I have :

<ows:ExceptionReport version=“1.0.0” xsi:schemaLocation=“http://www.opengis.net/ows http://localhost:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd”>

<ows:Exception exceptionCode=“NoApplicableCode”>

ows:ExceptionText
java.lang.RuntimeException: Could not find element declaration: (http://www.openplans.org/topp, layer )
Could not find element declaration: (http://www.openplans.org/topp, layer )
</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>

If I restart geoserver the request work and I don’t know why :(.

Thanks

Jim

Hi Jimmy,

I have verified the issue. I have filed a bug report for this one:

http://jira.codehaus.org/browse/GEOS-3103

The problem only persists until the next time the user interface is saved or loaded. So a workaround is to add your feature type, go to the ui and "Load", and then do the GetFeature. Not ideal I know :frowning:

-Justin

Jimmy Aumard wrote:

Hello,

I insert a new layer (postgis table) with rest api for using it in wfs-t but when I try to make a getFeature I an error.

The WMS request work but not the wfs.

This is my request :

http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer&srs=EPSG:27572

And I have :

<ows:ExceptionReport version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://localhost:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd&quot;&gt;

<ows:Exception exceptionCode="NoApplicableCode">

<ows:ExceptionText>
java.lang.RuntimeException: Could not find element declaration: (http://www.openplans.org/topp, layer )
Could not find element declaration: (http://www.openplans.org/topp, layer )
</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>

If I restart geoserver the request work and I don't know why :(.

Thanks

Jim

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Hello justin,

My wfs layer doesn’t work but the wfs-t work it’s possible to add a feature on my layer but not to see it because I have the error:

java.lang.RuntimeException: Could not find element declaration: (http://www.openplans.org/topp, layer )
Could not find element declaration: (http://www.openplans.org/topp, layer )

It’s very important for my project to create layer with REST for make wfs-t.

Thanks

Jim

Hi Jim,

You will need to give me more information. Paritcularily:

1. What exact version of GeoServer you using, if it is a nightly build please give me the date stamp on it.

2. What exact version of the REST plugin you are using.

3. The exact WFS requests you are making

And I don't quite understand. You say that WFS-T requests work, but a regular WFS request does not work?

With more info, hopefully i can help.

-Justin

Jimmy Aumard wrote:

Hello justin,

My wfs layer doesn't work but the wfs-t work it's possible to add a feature on my layer but not to see it because I have the error:

java.lang.RuntimeException: Could not find element declaration: (http://www.openplans.org/topp, layer )
Could not find element declaration: (http://www.openplans.org/topp, layer )

It's very important for my project to create layer with REST for make wfs-t.

Thanks

Jim

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

For request I modify the name for the mail it’s my mistake sorry it’s not layer it’s destroyjim.
I try to download the last version today and test.

Do you have the link please to download geoserver and rest plugin?

It’s possible to use a new geoserver with the data_dir of my old geoserver?

Thanks

Jim

2009/6/17 Justin Deoliveira <jdeolive@anonymised.com>

Please keep your replies on the public list. Use reply-all, not reply.

Jimmy Aumard wrote:

My version of geoserver is 1.7.5SNAPSHOT and for the pluging rest-1.7.5-SNAPSHOT.jar and restconfig-1.7.5-SNAPSHOT.jar

Do you know the date you downloaded the builds? There have been a few fixes related to this latey, so i am not sure if you have them or not.

The request WFS are:

http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer <http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer>

Looking at the request it references the type name “topp:layer”. Is this a mistake? Because according to the transaction it should be “topp:destroyjim”.

and this one work (send by openlayers):

<wfs:Transaction xmlns:wfs=“http://www.opengis.net/wfs” service=“WFS” version=“1.1.0” xsi:schemaLocation

=“http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd” xmlns:xsi="http://www.w3.org

/2001/XMLSchema-instance">wfs:Insert<feature:destroyjim xmlns:feature=“http://www.openplans.org/topp

feature:the_geom<gml:MultiSurface xmlns:gml=“http://www.opengis.net/gml” srsName=“EPSG:900913”><gml

:surfaceMember>gml:Polygongml:exteriorgml:LinearRinggml:posList362005.7659082 6188341.8091064
-68487.577333984 6168773.9298682 190786.82257324 5527925.8848145 1169180.7844873 6330208.933584 352221

.82628906 6452508.1788232 190786.82257324 6339992.8732031 362005.7659082 6188341.8091064</gml:posList

</gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember></gml:MultiSurface></feature:the_geom

</feature:destroyjim></wfs:Insert></wfs:Transaction>

Thanks for your help

Jim

2009/6/17 Justin Deoliveira <jdeolive@anonymised.com mailto:[jdeolive@anonymised.com](mailto:jdeolive@anonymised.com)>

Hi Jim,

You will need to give me more information. Paritcularily:

  1. What exact version of GeoServer you using, if it is a nightly
    build please give me the date stamp on it.

  2. What exact version of the REST plugin you are using.

  3. The exact WFS requests you are making

And I don’t quite understand. You say that WFS-T requests work, but
a regular WFS request does not work?

With more info, hopefully i can help.

-Justin

Jimmy Aumard wrote:

Hello justin,

My wfs layer doesn’t work but the wfs-t work it’s possible to
add a feature on my layer but not to see it because I have the
error:

java.lang.RuntimeException: Could not find element declaration:
(http://www.openplans.org/topp, layer )
Could not find element declaration:
(http://www.openplans.org/topp, layer )

It’s very important for my project to create layer with REST for
make wfs-t.

Thanks

Jim

– Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.


Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Jimmy Aumard wrote:

For request I modify the name for the mail it's my mistake sorry it's not layer it's destroyjim.

Ok, thought it might be.

I try to download the last version today and test.

Do you have the link please to download geoserver and rest plugin?

You can grab the latest versions:

http://gridlock.openplans.org/geoserver/1.7.x/geoserver-1.7.x-061809-bin.zip
http://gridlock.openplans.org/geoserver/1.7.x/ext-061809/geoserver-1.7.5-SNAPSHOT-restconfig-plugin.zip

It's possible to use a new geoserver with the data_dir of my old geoserver?

Yes, just move your data dir somewhere on your system, and then set the GEOSERVER_DATA_DIR environment variable to point to it. See:

http://docs.geoserver.org/1.7.4/user/data-directory/data-dir-setting.html

Thanks

Jim

2009/6/17 Justin Deoliveira <jdeolive@anonymised.com <mailto:jdeolive@anonymised.com>>

    Please keep your replies on the public list. Use reply-all, not reply.

    Jimmy Aumard wrote:

        My version of geoserver is 1.7.5SNAPSHOT and for the pluging
        rest-1.7.5-SNAPSHOT.jar and restconfig-1.7.5-SNAPSHOT.jar

    Do you know the date you downloaded the builds? There have been a
    few fixes related to this latey, so i am not sure if you have them
    or not.

        The request WFS are:

        http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer
        <http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer&gt;
        <http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer
        <http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer&gt;&gt;

    Looking at the request it references the type name "topp:layer". Is
    this a mistake? Because according to the transaction it should be
    "topp:destroyjim".

        and this one work (send by openlayers):

        <wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs&quot;
        service="WFS" version="1.1.0" xsi:schemaLocation

        ="http://www.opengis.net/wfs
        http://schemas.opengis.net/wfs/1.1.0/wfs.xsd&quot;
        xmlns:xsi="http://www.w3.org

        /2001/XMLSchema-instance"><wfs:Insert><feature:destroyjim
        xmlns:feature="http://www.openplans.org/topp&quot;

            <feature:the_geom><gml:MultiSurface
            xmlns:gml="http://www.opengis.net/gml&quot;
            srsName="EPSG:900913"><gml

        :surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList>362005.7659082
        6188341.8091064
         -68487.577333984 6168773.9298682 190786.82257324
        5527925.8848145 1169180.7844873 6330208.933584 352221

        .82628906 6452508.1788232 190786.82257324 6339992.8732031
        362005.7659082 6188341.8091064</gml:posList

            </gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember></gml:MultiSurface></feature:the_geom

            </feature:destroyjim></wfs:Insert></wfs:Transaction>

        Thanks for your help

        Jim

        2009/6/17 Justin Deoliveira <jdeolive@anonymised.com
        <mailto:jdeolive@anonymised.com> <mailto:jdeolive@anonymised.com
        <mailto:jdeolive@anonymised.com>>>

           Hi Jim,

           You will need to give me more information. Paritcularily:

           1. What exact version of GeoServer you using, if it is a nightly
           build please give me the date stamp on it.

           2. What exact version of the REST plugin you are using.

           3. The exact WFS requests you are making

           And I don't quite understand. You say that WFS-T requests
        work, but
           a regular WFS request does not work?

           With more info, hopefully i can help.

           -Justin

           Jimmy Aumard wrote:

               Hello justin,

               My wfs layer doesn't work but the wfs-t work it's possible to
               add a feature on my layer but not to see it because I
        have the
               error:

               java.lang.RuntimeException: Could not find element
        declaration:
               (http://www.openplans.org/topp, layer )
               Could not find element declaration:
               (http://www.openplans.org/topp, layer )

               It's very important for my project to create layer with
        REST for
               make wfs-t.

               Thanks

               Jim

           -- Justin Deoliveira
           OpenGeo - http://opengeo.org
           Enterprise support for open source geospatial.

    -- Justin Deoliveira
    OpenGeo - http://opengeo.org
    Enterprise support for open source geospatial.

------------------------------------------------------------------------

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects

------------------------------------------------------------------------

_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Thanks I have test the version behind but that doesn’t work :frowning:

My table it’s create with this:

CREATE TABLE layer
(
gid serial NOT NULL,
the_geom geometry,
CONSTRAINT layer_pkey PRIMARY KEY (gid),
CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2),
CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = (27572))
)
WITH (OIDS=FALSE);
ALTER TABLE layer OWNER TO jim;

I make an insert :

INSERT INTO layer (the_geom) VALUES (‘0106000020B46B00000100000001030000000100000004000000469CE4BD983A12C1CAA6B06A4ED540415E8F0E6D973A12C10C017BB94CD540415E8F0E6D973A12C10C017BB94CD54041469CE4BD983A12C1CAA6B06A4ED54041’)

And after I import the table on geoserver with curl and php

$data = “layer”;

$curl = curl_init();

$headers = array(
“Content-Type: text/xml”,
“charset="UTF-8"”

);

curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);

curl_setopt($curl, CURLOPT_URL, $urlGeoserver);
curl_setopt($curl, CURLOPT_USERPWD, $userPassGeo);

curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_exec($curl);

but I have

java.lang.RuntimeException: Could not find element declaration: (http://www.openplans.org/topp, layer )
Could not find element declaration: (http://www.openplans.org/topp, layer )

If I restart geoserver I have:

<wfs:FeatureCollection numberOfFeatures=“1” timeStamp=“2009-06-18T17:15:35.523+02:00” xsi:schemaLocation=“http://www.openplans.org/topp http://localhost:8080/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=topp:layer http://www.opengis.net/wfs http://localhost:8080/geoserver/schemas/wfs/1.1.0/wfs.xsd”>

gml:boundedBy

<gml:Envelope srsName=“urn:x-ogc:def:crs:EPSG:27572”>
gml:lowerCorner-298662.18544239213 2206361.449066287</gml:lowerCorner>
gml:upperCorner-298661.8565008546 2206364.8335159766</gml:upperCorner>
</gml:Envelope>
</gml:boundedBy>

gml:featureMembers

<topp:layer gml:id=“layer.1”>

gml:boundedBy

<gml:Envelope srsName=“urn:x-ogc:def:crs:EPSG:27572”>
gml:lowerCorner-298662.18544239213 2206361.449066287</gml:lowerCorner>
gml:upperCorner-298661.8565008546 2206364.8335159766</gml:upperCorner>
</gml:Envelope>
</gml:boundedBy>

topp:the_geom

<gml:MultiSurface srsName=“urn:x-ogc:def:crs:EPSG:27572”>

gml:surfaceMember

gml:Polygon

gml:exterior

gml:LinearRing

gml:posList
-298662.18544239213 2206364.8335159766 -298661.8565008546 2206361.449066287 -298661.8565008546 2206361.449066287 -298662.18544239213 2206364.8335159766
</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
</gml:MultiSurface>
</topp:the_geom>
</topp:layer>
</gml:featureMembers>
</wfs:FeatureCollection>

Where are my errors? :frowning:

2009/6/18 Justin Deoliveira <jdeolive@anonymised.com>

Jimmy Aumard wrote:

For request I modify the name for the mail it’s my mistake sorry it’s not layer it’s destroyjim.

Ok, thought it might be.

I try to download the last version today and test.

Do you have the link please to download geoserver and rest plugin?

You can grab the latest versions:

http://gridlock.openplans.org/geoserver/1.7.x/geoserver-1.7.x-061809-bin.zip
http://gridlock.openplans.org/geoserver/1.7.x/ext-061809/geoserver-1.7.5-SNAPSHOT-restconfig-plugin.zip

It’s possible to use a new geoserver with the data_dir of my old geoserver?

Yes, just move your data dir somewhere on your system, and then set the GEOSERVER_DATA_DIR environment variable to point to it. See:

http://docs.geoserver.org/1.7.4/user/data-directory/data-dir-setting.html

Thanks

Jim

2009/6/17 Justin Deoliveira <jdeolive@anonymised.com mailto:[jdeolive@anonymised.com](mailto:jdeolive@anonymised.com)>

Please keep your replies on the public list. Use reply-all, not reply.

Jimmy Aumard wrote:

My version of geoserver is 1.7.5SNAPSHOT and for the pluging
rest-1.7.5-SNAPSHOT.jar and restconfig-1.7.5-SNAPSHOT.jar

Do you know the date you downloaded the builds? There have been a
few fixes related to this latey, so i am not sure if you have them
or not.

The request WFS are:

http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer
<http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer>
<http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer
<http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer>>

Looking at the request it references the type name “topp:layer”. Is
this a mistake? Because according to the transaction it should be
“topp:destroyjim”.

and this one work (send by openlayers):

<wfs:Transaction xmlns:wfs=“http://www.opengis.net/wfs
service=“WFS” version=“1.1.0” xsi:schemaLocation

=“http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.1.0/wfs.xsd
xmlns:xsi="http://www.w3.org

/2001/XMLSchema-instance">wfs:Insert<feature:destroyjim
xmlns:feature=“http://www.openplans.org/topp

feature:the_geom<gml:MultiSurface
xmlns:gml=“http://www.opengis.net/gml
srsName=“EPSG:900913”><gml

:surfaceMember>gml:Polygongml:exteriorgml:LinearRinggml:posList362005.7659082
6188341.8091064
-68487.577333984 6168773.9298682 190786.82257324
5527925.8848145 1169180.7844873 6330208.933584 352221

.82628906 6452508.1788232 190786.82257324 6339992.8732031
362005.7659082 6188341.8091064</gml:posList

</gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember></gml:MultiSurface></feature:the_geom

</feature:destroyjim></wfs:Insert></wfs:Transaction>

Thanks for your help

Jim

2009/6/17 Justin Deoliveira <jdeolive@anonymised.com

mailto:[jdeolive@anonymised.com](mailto:jdeolive@anonymised.com.) <mailto:jdeolive@anonymised.com

mailto:[jdeolive@anonymised.com](mailto:jdeolive@anonymised.com.)>>

Hi Jim,

You will need to give me more information. Paritcularily:

  1. What exact version of GeoServer you using, if it is a nightly
    build please give me the date stamp on it.

  2. What exact version of the REST plugin you are using.

  3. The exact WFS requests you are making

And I don’t quite understand. You say that WFS-T requests
work, but
a regular WFS request does not work?

With more info, hopefully i can help.

-Justin

Jimmy Aumard wrote:

Hello justin,

My wfs layer doesn’t work but the wfs-t work it’s possible to
add a feature on my layer but not to see it because I
have the
error:

java.lang.RuntimeException: Could not find element
declaration:
(http://www.openplans.org/topp, layer )
Could not find element declaration:
(http://www.openplans.org/topp, layer )

It’s very important for my project to create layer with
REST for
make wfs-t.

Thanks

Jim

– Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

– Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.



Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects



Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel


Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Rectification :

When I start geoserver the first layer who is import with rest work but not the next layer.

Only the first layer work and after I have the error

java.lang.RuntimeException: Could not find element declaration: (http://www.openplans.org/topp
, layer )
Could not find element declaration: (http://www.openplans.org/topp, layer )

Thanks

Jim

2009/6/18 Jimmy Aumard <jimmy.aumard@anonymised.com>

Thanks I have test the version behind but that doesn’t work :frowning:

My table it’s create with this:

CREATE TABLE layer
(
gid serial NOT NULL,
the_geom geometry,
CONSTRAINT layer_pkey PRIMARY KEY (gid),
CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2),
CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = (27572))
)
WITH (OIDS=FALSE);
ALTER TABLE layer OWNER TO jim;

I make an insert :

INSERT INTO layer (the_geom) VALUES (‘0106000020B46B00000100000001030000000100000004000000469CE4BD983A12C1CAA6B06A4ED540415E8F0E6D973A12C10C017BB94CD540415E8F0E6D973A12C10C017BB94CD54041469CE4BD983A12C1CAA6B06A4ED54041’)

And after I import the table on geoserver with curl and php

$data = “layer”;

$curl = curl_init();

$headers = array(
“Content-Type: text/xml”,
“charset="UTF-8"”

);

curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);

curl_setopt($curl, CURLOPT_URL, $urlGeoserver);
curl_setopt($curl, CURLOPT_USERPWD, $userPassGeo);

curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_exec($curl);

but I have

java.lang.RuntimeException: Could not find element declaration: (http://www.openplans.org/topp, layer )
Could not find element declaration: (http://www.openplans.org/topp, layer )

If I restart geoserver I have:

<wfs:FeatureCollection numberOfFeatures=“1” timeStamp=“2009-06-18T17:15:35.523+02:00” xsi:schemaLocation=“http://www.openplans.org/topp http://localhost:8080/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=topp:layer http://www.opengis.net/wfs http://localhost:8080/geoserver/schemas/wfs/1.1.0/wfs.xsd”>

gml:boundedBy

<gml:Envelope srsName=“urn:x-ogc:def:crs:EPSG:27572”>
gml:lowerCorner-298662.18544239213 2206361.449066287</gml:lowerCorner>
gml:upperCorner-298661.8565008546 2206364.8335159766</gml:upperCorner>
</gml:Envelope>
</gml:boundedBy>

gml:featureMembers

<topp:layer gml:id=“layer.1”>

gml:boundedBy

<gml:Envelope srsName=“urn:x-ogc:def:crs:EPSG:27572”>
gml:lowerCorner-298662.18544239213 2206361.449066287</gml:lowerCorner>
gml:upperCorner-298661.8565008546 2206364.8335159766</gml:upperCorner>
</gml:Envelope>
</gml:boundedBy>

topp:the_geom

<gml:MultiSurface srsName=“urn:x-ogc:def:crs:EPSG:27572”>

gml:surfaceMember

gml:Polygon

gml:exterior

gml:LinearRing

gml:posList

-298662.18544239213 2206364.8335159766 -298661.8565008546 2206361.449066287 -298661.8565008546 2206361.449066287 -298662.18544239213 2206364.8335159766
</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
</gml:MultiSurface>

</topp:the_geom>
</topp:layer>
</gml:featureMembers>
</wfs:FeatureCollection>

Where are my errors? :frowning:

2009/6/18 Justin Deoliveira <jdeolive@anonymised.com>

Jimmy Aumard wrote:

For request I modify the name for the mail it’s my mistake sorry it’s not layer it’s destroyjim.

Ok, thought it might be.

I try to download the last version today and test.

Do you have the link please to download geoserver and rest plugin?

You can grab the latest versions:

http://gridlock.openplans.org/geoserver/1.7.x/geoserver-1.7.x-061809-bin.zip
http://gridlock.openplans.org/geoserver/1.7.x/ext-061809/geoserver-1.7.5-SNAPSHOT-restconfig-plugin.zip

It’s possible to use a new geoserver with the data_dir of my old geoserver?

Yes, just move your data dir somewhere on your system, and then set the GEOSERVER_DATA_DIR environment variable to point to it. See:

http://docs.geoserver.org/1.7.4/user/data-directory/data-dir-setting.html

Thanks

Jim

2009/6/17 Justin Deoliveira <jdeolive@anonymised.com mailto:[jdeolive@anonymised.com](mailto:jdeolive@anonymised.com)>

Please keep your replies on the public list. Use reply-all, not reply.

Jimmy Aumard wrote:

My version of geoserver is 1.7.5SNAPSHOT and for the pluging
rest-1.7.5-SNAPSHOT.jar and restconfig-1.7.5-SNAPSHOT.jar

Do you know the date you downloaded the builds? There have been a
few fixes related to this latey, so i am not sure if you have them
or not.

The request WFS are:

http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer
<http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer>
<http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer
<http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer>>

Looking at the request it references the type name “topp:layer”. Is
this a mistake? Because according to the transaction it should be
“topp:destroyjim”.

and this one work (send by openlayers):

<wfs:Transaction xmlns:wfs=“http://www.opengis.net/wfs
service=“WFS” version=“1.1.0” xsi:schemaLocation

=“http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.1.0/wfs.xsd
xmlns:xsi="http://www.w3.org

/2001/XMLSchema-instance">wfs:Insert<feature:destroyjim
xmlns:feature=“http://www.openplans.org/topp

feature:the_geom<gml:MultiSurface
xmlns:gml=“http://www.opengis.net/gml
srsName=“EPSG:900913”><gml

:surfaceMember>gml:Polygongml:exteriorgml:LinearRinggml:posList362005.7659082
6188341.8091064
-68487.577333984 6168773.9298682 190786.82257324
5527925.8848145 1169180.7844873 6330208.933584 352221

.82628906 6452508.1788232 190786.82257324 6339992.8732031
362005.7659082 6188341.8091064</gml:posList

</gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember></gml:MultiSurface></feature:the_geom

</feature:destroyjim></wfs:Insert></wfs:Transaction>

Thanks for your help

Jim

2009/6/17 Justin Deoliveira <jdeolive@anonymised.com

mailto:[jdeolive@anonymised.com](mailto:jdeolive@anonymised.com.) <mailto:jdeolive@anonymised.com

mailto:[jdeolive@anonymised.com](mailto:jdeolive@anonymised.com.)>>

Hi Jim,

You will need to give me more information. Paritcularily:

  1. What exact version of GeoServer you using, if it is a nightly
    build please give me the date stamp on it.

  2. What exact version of the REST plugin you are using.

  3. The exact WFS requests you are making

And I don’t quite understand. You say that WFS-T requests
work, but
a regular WFS request does not work?

With more info, hopefully i can help.

-Justin

Jimmy Aumard wrote:

Hello justin,

My wfs layer doesn’t work but the wfs-t work it’s possible to
add a feature on my layer but not to see it because I
have the
error:

java.lang.RuntimeException: Could not find element
declaration:
(http://www.openplans.org/topp, layer )
Could not find element declaration:
(http://www.openplans.org/topp, layer )

It’s very important for my project to create layer with
REST for
make wfs-t.

Thanks

Jim

I followed these steps but I could not replicate the problem. Here is
what I did:

1. Added a new datastore for my postgis database
2. Created the table "layer" given the SQL you gave me
3. Created a second table "layer2", which was identical to the first
4. Added the layer feature type via a REST call:

curl -u admin:geoserver -XPOST -H 'Content-type: text/xml' -d
'<featureType><name>layer2</name></featureType>'
http://localhost:8080/geoserver/rest/workspaces/topp/datastores/skunk/featuretypes

5. Did a get feature request against layer:

curl -G
"http://localhost:8080/geoserver/wfs?request=getfeature&typename=topp:layer&quot;

And it worked ok, i get back the following:

<wfs:FeatureCollection numberOfFeatures="1"
timeStamp="2009-06-18T12:55:44.051-06:00"
xsi:schemaLocation="http://www.openplans.org/topp
http://localhost:8080/geoserver/wfs?service=WFS&amp;version=1.1.0&amp;request=DescribeFeatureType&amp;typeName=topp:layer

http://www.opengis.net/wfs
http://localhost:8080/geoserver/schemas/wfs/1.1.0/wfs.xsd&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;
xmlns:tiger="http://www.census.gov"
xmlns:wfs="http://www.opengis.net/wfs&quot;
xmlns:topp="http://www.openplans.org/topp&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xmlns:sf="http://www.openplans.org/spearfish&quot;
xmlns:ows="http://www.opengis.net/ows&quot;
xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:xlink="http://www.w3.org/1999/xlink&quot;&gt;
  <gml:featureMembers>
   <topp:layer gml:id="layer.1">
    <topp:the_geom>
     <gml:MultiSurface
srsName="http://www.opengis.net/gml/srs/epsg.xml#27572&quot;&gt;
      <gml:surfaceMember>
       <gml:Polygon>
        <gml:exterior>
         <gml:LinearRing>
          <gml:posList>-298662.18544239213 2206364.8335159766
-298661.8565008546 2206361.449066287 -298661.8565008546
2206361.449066287 -298662.18544239213 2206364.8335159766</gml:posList>
         </gml:LinearRing>
        </gml:exterior>
       </gml:Polygon>
      </gml:surfaceMember>
     </gml:MultiSurface>
    </topp:the_geom>
   </topp:layer>
  </gml:featureMembers>
</wfs:FeatureCollection>

6. I added the layer2 feature type via rest:

curl -u admin:geoserver -XPOST -H 'Content-type: text/xml' -d
'<featureType><name>layer2</name></featureType>'
http://localhost:8080/geoserver/rest/workspaces/topp/datastores/skunk/featuretypes

7. I then did a get feature against that:

curl -G
"http://localhost:8080/geoserver/wfs?request=getfeature&typename=topp:layer2&quot;

And the result:

<wfs:FeatureCollection numberOfFeatures="1"
timeStamp="2009-06-18T12:51:19.127-06:00"
xsi:schemaLocation="http://www.openplans.org/topp
http://localhost:8080/geoserver/wfs?service=WFS&amp;version=1.1.0&amp;request=DescribeFeatureType&amp;typeName=topp:layer2

http://www.opengis.net/wfs
http://localhost:8080/geoserver/schemas/wfs/1.1.0/wfs.xsd&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;
xmlns:tiger="http://www.census.gov"
xmlns:wfs="http://www.opengis.net/wfs&quot;
xmlns:topp="http://www.openplans.org/topp&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xmlns:sf="http://www.openplans.org/spearfish&quot;
xmlns:ows="http://www.opengis.net/ows&quot;
xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:xlink="http://www.w3.org/1999/xlink&quot;&gt;
  <gml:featureMembers>
   <topp:layer2 gml:id="layer2.nfm--2b3194f9_121f4b52525_-7ffe">
    <topp:gid>1</topp:gid>
    <topp:the_geom>
     <gml:MultiSurface
srsName="http://www.opengis.net/gml/srs/epsg.xml#27572&quot;&gt;
      <gml:surfaceMember>
       <gml:Polygon>
        <gml:exterior>
         <gml:LinearRing>
          <gml:posList>-298662.18544239213 2206364.8335159766
-298661.8565008546 2206361.449066287 -298661.8565008546
2206361.449066287 -298662.18544239213 2206364.8335159766</gml:posList>
         </gml:LinearRing>
        </gml:exterior>
       </gml:Polygon>
      </gml:surfaceMember>
     </gml:MultiSurface>
    </topp:the_geom>
   </topp:layer2>
  </gml:featureMembers>
</wfs:FeatureCollection>

I did not have to restart geoserver at all. So I am not sure what in
your environment is causing the problem. Are you 100% sure you are
running the correct version of geoserver and the plugin i sent you links for?

Maybe it is something in your environment...

* What O/S are you running
* Are you running the binary release of geoserver, or the war?
* You are sure their is no other version of geoserver or anything running?

Jimmy Aumard wrote:

Rectification :

When I start geoserver the first layer who is import with rest work but not the next layer.

Only the first layer work and after I have the error

java.lang.RuntimeException: Could not find element declaration: (http://www.openplans.org/topp
, layer )
Could not find element declaration: (http://www.openplans.org/topp, layer )

Thanks

Jim

2009/6/18 Jimmy Aumard <jimmy.aumard@anonymised.com <mailto:jimmy.aumard@anonymised.com>>

    Thanks I have test the version behind but that doesn't work :frowning:

    My table it's create with this:

    CREATE TABLE layer
    (
      gid serial NOT NULL,
      the_geom geometry,
      CONSTRAINT layer_pkey PRIMARY KEY (gid),
      CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2),
      CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = (27572))
    )
    WITH (OIDS=FALSE);
    ALTER TABLE layer OWNER TO jim;

    I make an insert :

    INSERT INTO layer (the_geom) VALUES
    ('0106000020B46B00000100000001030000000100000004000000469CE4BD983A12C1CAA6B06A4ED540415E8F0E6D973A12C10C017BB94CD540415E8F0E6D973A12C10C017BB94CD54041469CE4BD983A12C1CAA6B06A4ED54041')

    And after I import the table on geoserver with curl and php

     $data = "<featureType><name>layer</name></featureType>";

        $curl = curl_init();

        $headers = array(
     "Content-Type: text/xml",
     "charset=\"UTF-8\""

        );

        curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);

        curl_setopt($curl, CURLOPT_URL, $urlGeoserver);
        curl_setopt($curl, CURLOPT_USERPWD, $userPassGeo);

        curl_setopt($curl, CURLOPT_POST, TRUE);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
        curl_exec($curl);

    but I have

    java.lang.RuntimeException: Could not find element declaration:
    (http://www.openplans.org/topp, layer )
    Could not find element declaration: (http://www.openplans.org/topp,
    layer )

    If I restart geoserver I have:

    <wfs:FeatureCollection numberOfFeatures="1"
    timeStamp="2009-06-18T17:15:35.523+02:00"
    xsi:schemaLocation="http://www.openplans.org/topp
    http://localhost:8080/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=topp:layer
    <http://localhost:8080/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=topp:layer&gt;
    http://www.opengis.net/wfs
    http://localhost:8080/geoserver/schemas/wfs/1.1.0/wfs.xsd&quot;&gt;
    −
    <gml:boundedBy>
    −
    <gml:Envelope srsName="urn:x-ogc:def:crs:EPSG:27572">
    <gml:lowerCorner>-298662.18544239213 2206361.449066287</gml:lowerCorner>
    <gml:upperCorner>-298661.8565008546 2206364.8335159766</gml:upperCorner>
    </gml:Envelope>
    </gml:boundedBy>
    −
    <gml:featureMembers>
    −
    <topp:layer gml:id="layer.1">
    −
    <gml:boundedBy>
    −
    <gml:Envelope srsName="urn:x-ogc:def:crs:EPSG:27572">
    <gml:lowerCorner>-298662.18544239213 2206361.449066287</gml:lowerCorner>
    <gml:upperCorner>-298661.8565008546 2206364.8335159766</gml:upperCorner>
    </gml:Envelope>
    </gml:boundedBy>
    −
    <topp:the_geom>
    −
    <gml:MultiSurface srsName="urn:x-ogc:def:crs:EPSG:27572">
    −

    <gml:surfaceMember>
    −
    <gml:Polygon>
    −
    <gml:exterior>
    −
    <gml:LinearRing>
    −
    <gml:posList>
    -298662.18544239213 2206364.8335159766 -298661.8565008546
    2206361.449066287 -298661.8565008546 2206361.449066287
    -298662.18544239213 2206364.8335159766

    </gml:posList>
    </gml:LinearRing>
    </gml:exterior>
    </gml:Polygon>
    </gml:surfaceMember>
    </gml:MultiSurface>
    </topp:the_geom>
    </topp:layer>
    </gml:featureMembers>
    </wfs:FeatureCollection>

    Where are my errors? :frowning:

    2009/6/18 Justin Deoliveira <jdeolive@anonymised.com
    <mailto:jdeolive@anonymised.com>>

        Jimmy Aumard wrote:

            For request I modify the name for the mail it's my mistake
            sorry it's not layer it's destroyjim.

        Ok, thought it might be.

            I try to download the last version today and test.

            Do you have the link please to download geoserver and rest
            plugin?

        You can grab the latest versions:

        http://gridlock.openplans.org/geoserver/1.7.x/geoserver-1.7.x-061809-bin.zip
        http://gridlock.openplans.org/geoserver/1.7.x/ext-061809/geoserver-1.7.5-SNAPSHOT-restconfig-plugin.zip

            It's possible to use a new geoserver with the data_dir of my
            old geoserver?

        Yes, just move your data dir somewhere on your system, and then
        set the GEOSERVER_DATA_DIR environment variable to point to it. See:

        http://docs.geoserver.org/1.7.4/user/data-directory/data-dir-setting.html

            Thanks

            Jim

            2009/6/17 Justin Deoliveira <jdeolive@anonymised.com
            <mailto:jdeolive@anonymised.com> <mailto:jdeolive@anonymised.com
            <mailto:jdeolive@anonymised.com>>>

               Please keep your replies on the public list. Use
            reply-all, not reply.

               Jimmy Aumard wrote:

                   My version of geoserver is 1.7.5SNAPSHOT and for the
            pluging
                   rest-1.7.5-SNAPSHOT.jar and restconfig-1.7.5-SNAPSHOT.jar

               Do you know the date you downloaded the builds? There
            have been a
               few fixes related to this latey, so i am not sure if you
            have them
               or not.

                   The request WFS are:

                              http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer
            <http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer&gt;
                              <http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer
            <http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer&gt;&gt;
                              <http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer
            <http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer&gt;
                              <http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer
            <http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:layer&gt;&gt;&gt;

               Looking at the request it references the type name
            "topp:layer". Is
               this a mistake? Because according to the transaction it
            should be
               "topp:destroyjim".

                   and this one work (send by openlayers):

                   <wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs&quot;
                   service="WFS" version="1.1.0" xsi:schemaLocation

                   ="http://www.opengis.net/wfs
                   http://schemas.opengis.net/wfs/1.1.0/wfs.xsd&quot;
                   xmlns:xsi="http://www.w3.org

                   /2001/XMLSchema-instance"><wfs:Insert><feature:destroyjim
                   xmlns:feature="http://www.openplans.org/topp&quot;

                       <feature:the_geom><gml:MultiSurface
                       xmlns:gml="http://www.opengis.net/gml&quot;
                       srsName="EPSG:900913"><gml

                              :surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList>362005.7659082
                   6188341.8091064
                    -68487.577333984 6168773.9298682 190786.82257324
                   5527925.8848145 1169180.7844873 6330208.933584 352221

                   .82628906 6452508.1788232 190786.82257324 6339992.8732031
                   362005.7659082 6188341.8091064</gml:posList

                                  </gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember></gml:MultiSurface></feature:the_geom

                       </feature:destroyjim></wfs:Insert></wfs:Transaction>

                   Thanks for your help

                   Jim

                   2009/6/17 Justin Deoliveira <jdeolive@anonymised.com
            <mailto:jdeolive@anonymised.com>
                   <mailto:jdeolive@anonymised.com
            <mailto:jdeolive@anonymised.com>> <mailto:jdeolive@anonymised.com
            <mailto:jdeolive@anonymised.com>

                   <mailto:jdeolive@anonymised.com
            <mailto:jdeolive@anonymised.com>>>>

                      Hi Jim,

                      You will need to give me more information.
            Paritcularily:

                      1. What exact version of GeoServer you using, if
            it is a nightly
                      build please give me the date stamp on it.

                      2. What exact version of the REST plugin you are
            using.

                      3. The exact WFS requests you are making

                      And I don't quite understand. You say that WFS-T
            requests
                   work, but
                      a regular WFS request does not work?

                      With more info, hopefully i can help.

                      -Justin

                      Jimmy Aumard wrote:

                          Hello justin,

                          My wfs layer doesn't work but the wfs-t work
            it's possible to
                          add a feature on my layer but not to see it
            because I
                   have the
                          error:

                          java.lang.RuntimeException: Could not find element
                   declaration:
                          (http://www.openplans.org/topp, layer )
                          Could not find element declaration:
                          (http://www.openplans.org/topp, layer )

                          It's very important for my project to create
            layer with
                   REST for
                          make wfs-t.

                          Thanks

                          Jim

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

I remove all versions of geoserver except yours and I try the same step but for layer2 I have an exception :@

I work on Linux Etch and I try on Linux leny but I have the same error.
I use binary release of geoserver and I have only the version you send me.

I don’t understand…

2009/6/18 Justin Deoliveira <jdeolive@anonymised.com>

I followed these steps but I could not replicate the problem. Here is
what I did:

  1. Added a new datastore for my postgis database
  2. Created the table “layer” given the SQL you gave me
  3. Created a second table “layer2”, which was identical to the first
  4. Added the layer feature type via a REST call:

curl -u admin:geoserver -XPOST -H ‘Content-type: text/xml’ -d
‘layer2’
http://localhost:8080/geoserver/rest/workspaces/topp/datastores/skunk/featuretypes

  1. Did a get feature request against layer:

curl -G
http://localhost:8080/geoserver/wfs?request=getfeature&typename=topp:layer

And it worked ok, i get back the following:

<wfs:FeatureCollection numberOfFeatures=“1”
timeStamp=“2009-06-18T12:55:44.051-06:00”

xsi:schemaLocation="http://www.openplans.org/topp

http://localhost:8080/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=topp:layer

http://www.opengis.net/wfs
http://localhost:8080/geoserver/schemas/wfs/1.1.0/wfs.xsd"

xmlns:ogc=“http://www.opengis.net/ogc
xmlns:tiger=“http://www.census.gov

xmlns:wfs=“http://www.opengis.net/wfs

xmlns:topp=“http://www.openplans.org/topp

xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance

xmlns:sf=“http://www.openplans.org/spearfish
xmlns:ows=“http://www.opengis.net/ows

xmlns:gml=“http://www.opengis.net/gml

xmlns:xlink=“http://www.w3.org/1999/xlink”>

gml:featureMembers
<topp:layer gml:id=“layer.1”>

topp:the_geom
<gml:MultiSurface

srsName=“http://www.opengis.net/gml/srs/epsg.xml#27572”>

gml:surfaceMember
gml:Polygon
gml:exterior
gml:LinearRing
gml:posList-298662.18544239213 2206364.8335159766
-298661.8565008546 2206361.449066287 -298661.8565008546
2206361.449066287 -298662.18544239213 2206364.8335159766</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
</gml:MultiSurface>
</topp:the_geom>
</topp:layer>
</gml:featureMembers>
</wfs:FeatureCollection>

  1. I added the layer2 feature type via rest:

curl -u admin:geoserver -XPOST -H ‘Content-type: text/xml’ -d
‘layer2’
http://localhost:8080/geoserver/rest/workspaces/topp/datastores/skunk/featuretypes

  1. I then did a get feature against that:

curl -G
http://localhost:8080/geoserver/wfs?request=getfeature&typename=topp:layer2

And the result:

<wfs:FeatureCollection numberOfFeatures=“1”
timeStamp=“2009-06-18T12:51:19.127-06:00”

xsi:schemaLocation="http://www.openplans.org/topp

http://localhost:8080/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=topp:layer2

http://www.opengis.net/wfs
http://localhost:8080/geoserver/schemas/wfs/1.1.0/wfs.xsd"

xmlns:ogc=“http://www.opengis.net/ogc
xmlns:tiger=“http://www.census.gov

xmlns:wfs=“http://www.opengis.net/wfs

xmlns:topp=“http://www.openplans.org/topp

xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance

xmlns:sf=“http://www.openplans.org/spearfish
xmlns:ows=“http://www.opengis.net/ows

xmlns:gml=“http://www.opengis.net/gml

xmlns:xlink=“http://www.w3.org/1999/xlink”>
gml:featureMembers
<topp:layer2 gml:id=“layer2.nfm–2b3194f9_121f4b52525_-7ffe”>
topp:gid1</topp:gid>

topp:the_geom
<gml:MultiSurface

srsName=“http://www.opengis.net/gml/srs/epsg.xml#27572”>

gml:surfaceMember
gml:Polygon
gml:exterior
gml:LinearRing
gml:posList-298662.18544239213 2206364.8335159766
-298661.8565008546 2206361.449066287 -298661.8565008546
2206361.449066287 -298662.18544239213 2206364.8335159766</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
</gml:MultiSurface>
</topp:the_geom>

</topp:layer2>
</gml:featureMembers>
</wfs:FeatureCollection>

I did not have to restart geoserver at all. So I am not sure what in
your environment is causing the problem. Are you 100% sure you are
running the correct version of geoserver and the plugin i sent you links for?

Maybe it is something in your environment…

  • What O/S are you running
  • Are you running the binary release of geoserver, or the war?
  • You are sure their is no other version of geoserver or anything running?

Hmmm... I am sort of stumped, I am not sure how I can replicate this. The only other thing I can think of is sending me the exact sequence of calls you are making with curl. Or if it is a php script send me that. So what I need:

* scripts to set up the tables (i should already have this)
* any REST calls to create the data store (or if you did with the UI tell me)
* any REST calls to register the feature types
* any WFS calls you make

I know I have all the bits of info now, but I need to replicate the *exact* sequence.

Jimmy Aumard wrote:

I remove all versions of geoserver except yours and I try the same step but for layer2 I have an exception :@

I work on Linux Etch and I try on Linux leny but I have the same error.
I use binary release of geoserver and I have only the version you send me.

I don't understand...

2009/6/18 Justin Deoliveira <jdeolive@anonymised.com <mailto:jdeolive@anonymised.com>>

    I followed these steps but I could not replicate the problem. Here is
    what I did:

    1. Added a new datastore for my postgis database
    2. Created the table "layer" given the SQL you gave me
    3. Created a second table "layer2", which was identical to the first
    4. Added the layer feature type via a REST call:

    curl -u admin:geoserver -XPOST -H 'Content-type: text/xml' -d
    '<featureType><name>layer2</name></featureType>'
    http://localhost:8080/geoserver/rest/workspaces/topp/datastores/skunk/featuretypes

    5. Did a get feature request against layer:

    curl -G
    "http://localhost:8080/geoserver/wfs?request=getfeature&typename=topp:layer
    <http://localhost:8080/geoserver/wfs?request=getfeature&typename=topp:layer&gt;&quot;

    And it worked ok, i get back the following:

    <wfs:FeatureCollection numberOfFeatures="1"
    timeStamp="2009-06-18T12:55:44.051-06:00"

    xsi:schemaLocation="http://www.openplans.org/topp
    http://localhost:8080/geoserver/wfs?service=WFS&amp;version=1.1.0&amp;request=DescribeFeatureType&amp;typeName=topp:layer
    <http://localhost:8080/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=topp:layer&gt;

    http://www.opengis.net/wfs
    http://localhost:8080/geoserver/schemas/wfs/1.1.0/wfs.xsd&quot;
    xmlns:ogc="http://www.opengis.net/ogc&quot;
    xmlns:tiger="http://www.census.gov"

    xmlns:wfs="http://www.opengis.net/wfs&quot;
    xmlns:topp="http://www.openplans.org/topp&quot;

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
    xmlns:sf="http://www.openplans.org/spearfish&quot;
    xmlns:ows="http://www.opengis.net/ows&quot;

    xmlns:gml="http://www.opengis.net/gml&quot;
    xmlns:xlink="http://www.w3.org/1999/xlink&quot;&gt;

     <gml:featureMembers>
     <topp:layer gml:id="layer.1">
      <topp:the_geom>
       <gml:MultiSurface
    srsName="http://www.opengis.net/gml/srs/epsg.xml#27572&quot;&gt;

        <gml:surfaceMember>
         <gml:Polygon>
          <gml:exterior>
           <gml:LinearRing>
            <gml:posList>-298662.18544239213 2206364.8335159766
    -298661.8565008546 2206361.449066287 -298661.8565008546
    2206361.449066287 -298662.18544239213 2206364.8335159766</gml:posList>
           </gml:LinearRing>
          </gml:exterior>
         </gml:Polygon>
        </gml:surfaceMember>
       </gml:MultiSurface>
      </topp:the_geom>
     </topp:layer>
     </gml:featureMembers>
    </wfs:FeatureCollection>

    6. I added the layer2 feature type via rest:

    curl -u admin:geoserver -XPOST -H 'Content-type: text/xml' -d
    '<featureType><name>layer2</name></featureType>'
    http://localhost:8080/geoserver/rest/workspaces/topp/datastores/skunk/featuretypes

    7. I then did a get feature against that:

    curl -G
    "http://localhost:8080/geoserver/wfs?request=getfeature&typename=topp:layer2
    <http://localhost:8080/geoserver/wfs?request=getfeature&typename=topp:layer2&gt;&quot;

    And the result:

    <wfs:FeatureCollection numberOfFeatures="1"
    timeStamp="2009-06-18T12:51:19.127-06:00"

    xsi:schemaLocation="http://www.openplans.org/topp
    http://localhost:8080/geoserver/wfs?service=WFS&amp;version=1.1.0&amp;request=DescribeFeatureType&amp;typeName=topp:layer2
    <http://localhost:8080/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=topp:layer2&gt;

    http://www.opengis.net/wfs
    http://localhost:8080/geoserver/schemas/wfs/1.1.0/wfs.xsd&quot;
    xmlns:ogc="http://www.opengis.net/ogc&quot;
    xmlns:tiger="http://www.census.gov"

    xmlns:wfs="http://www.opengis.net/wfs&quot;
    xmlns:topp="http://www.openplans.org/topp&quot;

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
    xmlns:sf="http://www.openplans.org/spearfish&quot;
    xmlns:ows="http://www.opengis.net/ows&quot;

    xmlns:gml="http://www.opengis.net/gml&quot;
    xmlns:xlink="http://www.w3.org/1999/xlink&quot;&gt;
     <gml:featureMembers>
     <topp:layer2 gml:id="layer2.nfm--2b3194f9_121f4b52525_-7ffe">
      <topp:gid>1</topp:gid>

      <topp:the_geom>
       <gml:MultiSurface
    srsName="http://www.opengis.net/gml/srs/epsg.xml#27572&quot;&gt;

        <gml:surfaceMember>
         <gml:Polygon>
          <gml:exterior>
           <gml:LinearRing>
            <gml:posList>-298662.18544239213 2206364.8335159766
    -298661.8565008546 2206361.449066287 -298661.8565008546
    2206361.449066287 -298662.18544239213 2206364.8335159766</gml:posList>
           </gml:LinearRing>
          </gml:exterior>
         </gml:Polygon>
        </gml:surfaceMember>
       </gml:MultiSurface>
      </topp:the_geom>
     </topp:layer2>
     </gml:featureMembers>
    </wfs:FeatureCollection>

    I did not have to restart geoserver at all. So I am not sure what in
    your environment is causing the problem. Are you 100% sure you are
    running the correct version of geoserver and the plugin i sent you
    links for?

    Maybe it is something in your environment...

    * What O/S are you running
    * Are you running the binary release of geoserver, or the war?
    * You are sure their is no other version of geoserver or anything
    running?

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Hello Justin,

I use a php script to set up the table and make REST calls, I use the UI to create the data strore.

This is my php script:

<?php $userPassGeo="admin:geoserver"; $user=""; $pass=""; $bdd=""; $name=""; if (isset($_POST['user'])){ $user = $_POST['user']; $pass = $_POST['mdp']; $bdd = $_POST['bdd']; $name = $_POST['name']; $geobdd=$_POST['geobdd']; // echo $user.$pass.$bdd.$name; $urlGeoserver="[http://localhost:8080/geoserver/rest/workspaces/topp/datastores/](http://localhost:8080/geoserver/rest/workspaces/topp/datastores/)".$geobdd."/featuretypes/"; $db_conn = pg_Connect("host=localhost user=".$user." password=".$pass." dbname=".$bdd); if (!$db_conn){ echo "connection failed!"; } // pg_exec ($db_conn, "begin transaction"); pg_exec ($db_conn, "CREATE TABLE ".$name." ( gid serial NOT NULL, the_geom geometry, CONSTRAINT ".$name."_pkey PRIMARY KEY (gid), CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2), CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = 27572) ) WITH (OIDS=FALSE); ALTER TABLE ".$name." OWNER TO ".$user.";"); pg_exec ($db_conn, "INSERT INTO ".$name." (the_geom) VALUES ('0106000020B46B00000100000001030000000100000004000000469CE4BD983A12C1CAA6B06A4ED540415E8F0E6D973A12C10C017BB94CD540415E8F0E6D973A12C10C017BB94CD54041469CE4BD983A12C1CAA6B06A4ED54041')"); pg_exec ($db_conn, "INSERT INTO ".$name." (the_geom) VALUES ('0106000020B46B00000100000001030000000100000005000000F0736A63D53CE8C054F66D97A15E4441B40D9941FF5504C1A773BA2E99803A4110317A6037B03541A9BFB338281F3841607459E2A41D3441F64C8514EF704641F0736A63D53CE8C054F66D97A15E4441')"); pg_close ($db_conn); $data = "".$name.""; $curl = curl_init(); $headers = array( "Content-Type: text/xml", "charset=\"UTF-8\"" ); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_URL, $urlGeoserver); curl_setopt($curl, CURLOPT_USERPWD, $userPassGeo); curl_setopt($curl, CURLOPT_POST, TRUE); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); curl_exec($curl); $ret = curl_getinfo($curl, CURLINFO_HTTP_CODE); echo $ret; if ($ret==201){ curl_setopt($curl, CURLOPT_URL, "[http://localhost:8080/geoserver/admin/loadFromXML.do](http://localhost:8080/geoserver/admin/loadFromXML.do)"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); curl_exec($curl); curl_close($curl); } else{ $resultDesc = "Erreur creation"; echo "erreur"; } } ?>

I try curl REST call:
curl -u admin:geoserver -XPOST -H “Content-type: text/xml” -d ““name of my layer”” http://localhost:8080/geoserver/rest/workspaces/topp/datastores/“name of my data store”/featuretypes

And finaly the WFS request:
http://localhost:8080/geoserver/wfs?request=GetFeature&typename=topp:“name of my layer”&srs=EPSG:27572

if the layer has already been registered, then delete, when I recreate it I have no problème.
Exemple:

I create a layer with REST “toto”
I make a WFS request ( I have an error)
I restart geoserver
I make a WFS request (it’s works)
I delete “toto”
I recreate “toto” with REST
I make a WFS request (it’s works)

Thanks for your help!

Jim

2009/6/21 Justin Deoliveira <jdeolive@anonymised.com>

Hmmm… I am sort of stumped, I am not sure how I can replicate this. The only other thing I can think of is sending me the exact sequence of calls you are making with curl. Or if it is a php script send me that. So what I need:

  • scripts to set up the tables (i should already have this)
  • any REST calls to create the data store (or if you did with the UI tell me)
  • any REST calls to register the feature types
  • any WFS calls you make

I know I have all the bits of info now, but I need to replicate the exact sequence.

bddCurl.php (2.27 KB)