Adam, you must keep discussions on the geoserver-users list or purchase a support contract. On-list discussions help the whole community, so community members may answer on-list questions for free. You are better off asking the list because individual members may be unavailable or not have a good answer.
In app-schema, geometries are treated as atomic types and will be converted into GML by the encoder. Use targetAttribute to map the top level geometry property. Change this:
<targetAttribute>/ps:ProtectedSite/ps:geometry/gml:Polygon/gml:exterior/gml:LinearRing/gml:posList</targetAttribute>
to this:
<targetAttribute>ps:geometry</targetAttribute>
The leading slash was also unexpected, and you do not need the target element unless you are addressing its attributes.
Even once you fix your mapping, your request will fail because you are using a GML 3.2.1 application schema but WFS 1.1.0 which defaults to GML 3.1.1, incompatible with your target application schema. See:
http://docs.geoserver.org/latest/en/user/data/app-schema/supported-gml-versions.html#gml-3-2-1
Either specify outputformat=gml32 in your request:
http://localhost:8080/geoserver2/wfs?service=WFS&version=1.1.0&request=GetFeature&typename=ps:ProtectedSite&outputformat=gml32
or use WFS 2.0.0:
http://localhost:8080/geoserver2/wfs?service=WFS&version=2.0.0&request=GetFeature&typenames=ps:ProtectedSite
You are also specifying many unnecessary <FeatureType><schemaUri>; just specify the top-level schemaUri and app-schema will follow any imports/includes. You may need more than one. You certainly go not need to specify GML 3.2.1.
Kind regards,
Ben.
On 14/04/16 01:51, Adam Mydla wrote:
Thank you for your advice,
It was very helpful.
I modified the namespace name, added attributes, in some parts I must
change target attribute for testing responses to requests. Only for example
I am mapped all attributes like INSPIRE ID.
When I send request GetFeature:
http://localhost:8080/geoserver2/wfs?request=GetFeature&version=1.1.0&typeName=ps:ProtectedSite
This is answer:
<ows:ExceptionReport xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ows="
http://www.opengis.net/ows" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance
" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows
http://localhost:8080/geoserver2/schemas/ows/1.0.0/owsExceptionReport.xsd">
<ows:Exception exceptionCode="NoApplicableCode">
<ows:ExceptionText>
java.lang.RuntimeException: Error applying mapping with targetAttribute
ps:geometry/gml:Polygon/gml:exterior/gml:LinearRing/gml:posList Error
applying mapping with targetAttribute
ps:geometry/gml:Polygon/gml:exterior/gml:LinearRing/gml:posList Could not
find working property accessor for attribute (Shape) in object
(SimpleFeatureImpl:chko=[SimpleFeatureImpl.Attribute: the_geom<the_geom
id=chko.1>=MULTIPOLYGON (((48.709917 18.08879, 48.71037 18.089492,
48.710799 18.089892, 48.710175 18.091621, 48.709862 18.091097, 48.709789
18.090894, 48.70971 18.090842, 48.709584 18.090511, 48.709714 18.090136,
48.7094 18.088812, 48.709812 18.089396, 48.709917 18.08879))),
SimpleFeatureImpl.Attribute: OSM_ID<OSM_ID id=chko.1>=81009135,
SimpleFeatureImpl.Attribute: URL<URL id=chko.1>=http://oksovske-duby.oma.sk/,
SimpleFeatureImpl.Attribute: TYP<TYP id=chko.1>=chko,
SimpleFeatureImpl.Attribute: POPIS_MALY<POPIS_MALY id=chko.1>=Chránený
areál rozlohy 1,56 ha, typ chráneného územia Chránený areál,
názvy: Chránený areál, <a href='http://oksovske-duby.oma.sk/'>plná
stránka o Okšovské duby</a>])
</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>
I do not know what's wrong ? Why it seems that GeoServer not followed my
mapping file?
My modified mapping file:
https://drive.google.com/open?id=0B1bulwJXoip1X3ZabTJJN2kzeDg
GeoServer log file:
https://drive.google.com/open?id=0B1bulwJXoip1QkZCYko4VWhONW8
Regards,
Adam
2016-04-07 10:23 GMT+02:00 Ben Caradoc-Davies <ben@anonymised.com>:
Adam,
it looks like your namespaces are incorrect. The ps namespace should be:
http://inspire.ec.europa.eu/schemas/ps/4.0
But below it looks like you have requested type with namespace:
http://inspire.ec.europa.eu/schemas/ps/4.0/ProtectedSite
Your namespace.xml also has a different namespace URI:
http://inspire.ec.europa.eu/schemas/ps
Please check that all your namespaces are correct. You may also need to
create secondary namespaces to ensure that these are defined for the
GeoTools encoder:
http://docs.geoserver.org/latest/en/user/data/app-schema/secondary-namespaces.html
There are also several problems with your mapping file: you use a
namespace prefix "base" that is not defined, and one targetAttribute is
"ps:" (no prefix, missing local name).
It would also be useful to examine the geoserver logs and look for
exception stack traces; sometimes a strange error later may be caused by
earlier exception that has left something in an incomplete state. First fix
your namespaces.
Kind regards,
Ben.
On 07/04/16 19:32, Adam Mydla wrote:
Hi,
I'm working on my diploma thesis with GeoServer and complement application
schema.
When I created data store, and create a new layer program writes an error
in the mapping file:
"Could not list layers for this store, an error occurred retrieving them:
java.util.NoSuchElementException: No top-level element found in Schemes:
{}
http://inspire.ec.europa.eu/schemas/ps/4.0/ProtectedSite ProtectedSite "
I don´t know how to resolve because there isn´t another source
ProtectedSites.xsd scheme download source.
How I can solve this problem ???
here is my mapping file for download:
https://drive.google.com/open?id=0B1bulwJXoip1VHdxSHFyenNXLXM
Adam
------------------------------------------------------------------------------
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
--
Ben Caradoc-Davies <ben@anonymised.com>
Director
Transient Software Limited <http://transient.nz/>
New Zealand
--
Ben Caradoc-Davies <ben@anonymised.com>
Director
Transient Software Limited <http://transient.nz/>
New Zealand