Opened 14 years ago

Closed 12 years ago

#1421 closed enhancement (fixed)

OGC WFS 1.1.0 Support

Reported by: liuar Owned by: liuar
Priority: medium Milestone:
Component: WFS Interface Version:
Severity: minor Keywords: WFS
Cc: External ID:

Description

Enhance the WFS 1.1.0 implmentation of MapGuide according to OGC WFS 1.1.0 specification. The goal is to make sure MapGuide could pass the OGC certification for WFS 1.1.0 and 1.0.0.
This is a relevate ticket for RFC106

Change History (17)

comment:1 by liuar, 14 years ago

Type: defectenhancement
  1. Add WFS 1.1.0 to the supported version list in WFS config file.
  1. Add following definition items which are defined WFS 1.1.0 specification: ProviderName, ProviderSite, HoursOfService, !Role
<Define item="Service.Contact.ProviderName"></Define>
<Define item="Service.Contact.ProviderSite"></Define>
<Define item="Service.Contact.HoursOfService">24x7</Define>
<Define item="Role"></Define>
  1. Update the definition of Service.Keywords from multiple items to one item with multiple space seperated words.
  1. Add a definition item ServiceTypeVersion.xml which enumerates the supported versions and be used in ServiceIdentification section
  1. Add following items in ServiceIdentification section
<ows:ProviderName>&Service.Contact.ProviderName;</ows:ProviderName>
<ows:ProviderSite>&Service.Contact.ProviderSite;</ows:ProviderSite>
<ows:HoursOfService>&Service.Contact.HoursOfService;</ows:HoursOfService>
<ows:Role>&Service.Contact.Role;</ows:Role>

Changeset [5080] by liuar

comment:2 by liuar, 14 years ago

Enhance the Feature Service interfaces DescribeWfsFeatureType and GetWfsFeature by adding a parameter to specify the output format.

The most significant update from WFS 1.0.0 to WFS 1.1.0 is the supported output GML format. WFS 1.0.0 only support GML 2.1.1 while WFS 1.3.0 suport both GML 2.1.1 and GML 3.1.2. So, it's necessary for MapGuide feature service to allow user to specify GML format.

////////////////////////////////////////////////////////////////////////////////////////////////////////
/// \brief
/// Retrieves schema informationabout a set of feature classes for a given feature source  with specified format.
///
/// \note1
///
/// <!-- Syntax in .Net, Java, and PHP -->
/// \htmlinclude DotNetSyntaxTop.html
/// virtual MgByteReader DescribeWfsFeatureType(MgResourceIdentifier featureSourceId, MgStringCollection featureClasses, string outputFormat);
/// \htmlinclude SyntaxBottom.html
/// \htmlinclude JavaSyntaxTop.html
/// virtual MgByteReader DescribeWfsFeatureType(MgResourceIdentifier featureSourceId, MgStringCollection featureClasses, string outputFormat);
/// \htmlinclude SyntaxBottom.html
/// \htmlinclude PHPSyntaxTop.html
/// virtual MgByteReader DescribeWfsFeatureType(MgResourceIdentifier featureSourceId, MgStringCollection featureClasse, string outputFormats);
/// \htmlinclude SyntaxBottom.html
///
/// \param featureSourceId (MgResourceIdentifier)
/// The resource identifier defining the
/// location of the feature source in
/// the repository.
/// \param featureClasses (MgStringCollection)
/// A collection of strings identifying the feature classes for which to
/// retrieve schema information. If this collection is null or empty, information
/// is returned for all feature classes.
/// \param outputFormat (String/string)
/// A string identifying the output format of 
/// the retrieved schema information.
/// The supported values of output format are specified in OpenGIS Web Feature Service (WFS) Implementation Specification - section 8.2
/// http://portal.opengeospatial.org/files/?artifact_id=8339
///
/// \return
/// Returns an MgByteReader containing the XML schema.
///
virtual MgByteReader* DescribeWfsFeatureType(MgResourceIdentifier* featureSourceId, MgStringCollection* featureClasses,CREFSTRING outputFormat) = 0; 

////////////////////////////////////////////////////////////////////////////////////////////////////////
/// \brief
/// Retrieves feature information based on the supplied criteria with specified format.
///
/// \note1
///
/// <!-- Syntax in .Net, Java, and PHP -->
/// \htmlinclude DotNetSyntaxTop.html
/// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, string featureClass, MgStringCollection requiredProperties, string srs, string filter, int maxFeatures, string outputFormat);
/// \htmlinclude SyntaxBottom.html
/// \htmlinclude JavaSyntaxTop.html
/// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, String featureClass, MgStringCollection requiredProperties, String srs, String filter, int maxFeatures, string outputFormat);
/// \htmlinclude SyntaxBottom.html
/// \htmlinclude PHPSyntaxTop.html
/// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, string featureClass, MgStringCollection requiredProperties, string srs, string filter, int maxFeatures, string outputFormat);
/// \htmlinclude SyntaxBottom.html
///
/// \param featureSourceId (MgResourceIdentifier)
/// The resource identifier defining the
/// location of the feature source in
/// the repository.
/// \param featureClass (String/string)
/// The feature class containing the features to retrieve.
/// \param requiredProperties (MgStringCollection)
/// The collection of properties to retrieve for each feature. If the
/// collection is null or empty, all properties will be retrieved.
/// \param srs (String/string)
/// The spatial reference system in which to return feature geometries
/// \param filter (String/string)
/// An XML string containing the definition for an OGC filter
/// \param maxFeatures (int)
/// The maximum number of features to retrieve. If the value is less
/// than or equal to zero, all features will be retrieved.
/// \param outputFormat (String/string)
/// A string identifying the output format of 
/// the retrieved feature information.
/// The supported values of output format are specified in OpenGIS Web Feature Service (WFS) Implementation Specification - section 9.2
/// http://portal.opengeospatial.org/files/?artifact_id=8339
/// 
/// \return
/// Returns an MgByteReader containing the requested feature information.
///
virtual MgByteReader* GetWfsFeature(MgResourceIdentifier* featureSourceId, CREFSTRING featureClass,
    MgStringCollection* requiredProperties, CREFSTRING srs, CREFSTRING filter, INT32 maxFeatures,CREFSTRING outputFormat) = 0;

comment:3 by liuar, 14 years ago

Changeset [5090] by liuar

comment:4 by liuar, 14 years ago

  1. Enhance the Feature Service interfaces GetWfsFeature by adding a parameter to specify the WFS version.
////////////////////////////////////////////////////////////////////////////////
////////////////////////
/// \brief
/// Retrieves feature information based on the supplied criteria with specified 
format.
///
/// \note1
///
/// <!-- Syntax in .Net, Java, and PHP -->
/// \htmlinclude DotNetSyntaxTop.html
/// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, 
string featureClass, MgStringCollection requiredProperties, string srs, string 
filter, int maxFeatures, string wfsVersion, string outputFormat);
/// \htmlinclude SyntaxBottom.html
/// \htmlinclude JavaSyntaxTop.html
/// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, 
String featureClass, MgStringCollection requiredProperties, String srs, String 
filter, int maxFeatures, string wfsVersion, string outputFormat);
/// \htmlinclude SyntaxBottom.html
/// \htmlinclude PHPSyntaxTop.html
/// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, 
string featureClass, MgStringCollection requiredProperties, string srs, string 
filter, int maxFeatures, string wfsVersion, string outputFormat);
/// \htmlinclude SyntaxBottom.html
///
/// \param featureSourceId (MgResourceIdentifier)
/// The resource identifier defining the
/// location of the feature source in
/// the repository.
/// \param featureClass (String/string)
/// The feature class containing the features to retrieve.
/// \param requiredProperties (MgStringCollection)
/// The collection of properties to retrieve for each feature. If the
/// collection is null or empty, all properties will be retrieved.
/// \param srs (String/string)
/// The spatial reference system in which to return feature geometries
/// \param filter (String/string)
/// An XML string containing the definition for an OGC filter
/// \param maxFeatures (int)
/// The maximum number of features to retrieve. If the value is less
/// than or equal to zero, all features will be retrieved.
/// \param outputFormat (String/string)
/// A string identifying the output format of 
/// the retrieved feature information.
/// The supported values of output format are specified in OpenGIS Web Feature 
Service (WFS) Implementation Specification - section 9.2
/// http://portal.opengeospatial.org/files/?artifact_id=8339
/// 
/// \return
/// Returns an MgByteReader containing the requested feature information.
///
virtual MgByteReader* GetWfsFeature(MgResourceIdentifier* featureSourceId, 
CREFSTRING featureClass,
    MgStringCollection* requiredProperties, CREFSTRING srs, CREFSTRING filter, 
INT32 maxFeatures, CREFSTRING wfsVersion, CREFSTRING outputFormat) = 0;

  1. Implement the GetWfsFeature in ServerFeatureService to support GML 3.1.1 format. Update the default output format of DescribeFeatureType and GetFeature to GML3.
  1. Update following items regard to the test suite of OGC CITE Update the DefaultSRS to urn:x-ogc:def:crs:EPSG:4326 Update the format element name from <ows:Format> to <Format> Update the namespaces in GetCapabilities response document Update the child element sequence of <ows:ServiceIdentification> Add GML 3 support for DescribeFeatureType and GetFeature response.

comment:5 by liuar, 14 years ago

MapGuide encodes the feature schema name to hash code as the feature type's namespace. However, OGC WFS certification supports customized namespace url for feature type. So MapGuide has to provide a way to specify a namespace url and a prefix indicate the url. All the namespaces and prefixes should appear in wfs:FeatureCollection element in GetFeature response document.

I updated the wfs.1.1.0 template to support customized namespaces in featureCollection.

Changeset [5127] by liuar

comment:6 by liuar, 14 years ago

Fixed OGC certification test failure.

  1. Test wfs:wfs-1.1.0-Basic-GetCapabilities-tc11.1 (s0012/d1e34887_1/d1e732_1/d1e25171_1/d1e856_1)

Assertion: A response message containing an entity body must contain a Content-Type entity header field that correctly indicates the media type of the message body.

The OGC CITE test engine looks for a case-sensitive "Content-Type" in response header, but MapGuide generates "Content-type" in cgiAgent, isapiAgent and apacheAgent. So I updated the hard coded "Content-type" to "Content-Type".

  1. Test wfs:wfs-1.1.0-Basic-GetCapabilities-tc9.2 (s0012/d1e34887_1/d1e732_1/d1e25171_1/d1e836_1)

Assertion: A valid http URL value shall conform to the syntax specified in RFC 2616. http_URL = 'http:' '' host [ ':' port ] [ abs_path [ '?' query ]]

The OGC CITE test engine looks for a root element which is an ows:ExceptionReport document. The MapGuide WFS exception response template should be updated to

<!--

  Exception Format  - XML

-->
<Response request="Exception" content-type="text/xml">
<ows:ExceptionReport 
   version="&TemplateVersion;"
   xmlns:ows="http://www.opengis.net/ows"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.opengis.net/ows http://schemas.opengis.net/ows/1.0.0/owsExceptionReport.xsd">
 <ows:Exception exceptionCode="&Exception.Type;" locator="&Exception.Locator;">
  <ows:ExceptionText>
   &Exception.message;
  </ows:ExceptionText>
 </ows:Exception>
</ows:ExceptionReport>
</Response>
  1. Test wfs:wfs-1.1.0-Basic-GetCapabilities-tc16.1 (s0012/d1e34887_1/d1e732_1/d1e25171_1/d1e898_1)

Assertion: In the event that a GetCapabilities request cannot be processed for any reason, the response entity shall include an exception report. The exception code must be one of those listed in Table 5.

For request: http://xxx.xxx.xxx.xxx/mapguide/mapagent/mapagent.fcgi?&version=1.1.0&request=GetCapabilities, an OperationNotSupported exception will be thrown from MapGuide, which should be a MissingRequestParameter exception.

I also extended the OGCException by adding a new member m_pszLocator, since the optional ows:Locator attribute is required by the OGC test engine.

  1. Test wfs:wfs-1.1.0-Basic-GetCapabilities-tc13.2 (s0012/d1e34887_1/d1e732_1/d1e25171_1/d1e872_1)

Assertion: A KVP-encoded GetCapabilities request shall include the following query parameters: service=WxS request=GetCapabilities, where WxS is a mnemonic label for a service type. See Table 2 for definitions of optional query parameters.

For request: http://xxx.xxx.xxx.xxx/mapguide/mapagent/mapagent.fcgi?&request=GetCapabilities&version=1.1.0, an OWS exception is expected by the OGC CITE test engine which is a WFS exception type. So, if SERVICE parameter is not specified, the default service will be WFS.

  1. Test wfs:wfs-1.1.0-Basic-GetCapabilities-tc15.2 (s0012/d1e34887_1/d1e732_1/d1e25171_1/d1e892_1)

Assertion: Version negotiation using AcceptVersions parameter (preference ordering): Return service metadata corresponding to the most preferred version that is supported. If none of the requested versions are supported, the server must generate an exception with code 'VersionNegotiationFailed'.

For request: http://xxx.xxx.xxx.xxx/mapguide/mapagent/mapagent.fcgi?&service=WFS&request=GetCapabilities&acceptversions=2006.10.25, an exception is expected by the OGC test engine but MapGuide doesn't check the acceptVersions parameter. I extended the !MgOgcWfsServer::ValidateRequest() to handle the unsupported versions case for WFS.

NOTE: acceptVersions is not supported in current MapGuide implementation.

Changeset [5131] by liuar

comment:7 by liuar, 14 years ago

  1. Test wfs:wfs-1.1.0-Basic-GetCapabilities-tc9.2 (s0012/d1e34887_1/d1e732_1/d1e25171_1/d1e836_1)

Assertion: A valid http URL value shall conform to the syntax specified in RFC 2616. http_URL = 'http:' '' host [ ':' port ] [ abs_path [ '?' query ]]

For request: http://xxx.xxx.xxx.xxx/mapguide/mapagent/mapagent.fcgi?#request=GetCapabilities,service=WFS, MapGuide will return HTTP response code: 401. However, CITE test engine expects a WFS exception. Because MapGuide provides lots kind of services besides WFS, to reslove this problem, I added a config setting in webconfig.ini named CITEWfs(BOOL) which means MapGuide is under CITE WFS testing, and for invalid HTTP requests, MapGuide will return a WFS exception.

  1. Test wfs:wfs-1.1.0-Basic-GetCapabilities-tc19.2 (s0012/d1e34887_1/d1e732_1/d1e25171_1/d1e949_1)

Assertion: The response to a GetCapabilities request that includes a sections parameter listing optional elements shall include only the requested elements in the response entity.

MapGuide doesn't support sections parameter, so I added the parameter validation in HttpWfsGetCapabilities.

I also removed updateSequence attribute from the GetCapabilities document since MapGuide doesn't support it currently (Cause an error in OGC CITE test)

Changeset [5153] by liuar

comment:8 by liuar, 14 years ago

  1. Test wfs:wfs-1.1.0-Basic-DescribeFeatureType-tc4.1 (s0001/d1e35137_1/d1e740_1/d1e25192_1/d1e3796_1)

Assertion: The following query parameters are required for all KVP-encoded service requests except GetCapabilities: service, request, version.

For DescribeFeatureType requests, if service or version parameter is not specified, MapGuide should response a WFS exception

  1. Test wfs:wfs-1.1.0-Basic-GetFeature-tc23.3 (s0001/d1e35137_1/d1e740_1/d1e25217_1/d1e6193_1)

Assertion: The following query parameters are required for all KVP-encoded service requests except GetCapabilities: service, request, version.

For GetFeature requests, if service or version parameter is not specified, MapGuide should response a WFS exception

  1. In the latest OGC CITE test engine, the default SRS for WFS should be urn:ogc:def:crs:EPSG::4326.

Changeset [5182] by liuar

comment:9 by liuar, 14 years ago

  1. Test wfs:wfs-1.1.0-Basic-GetFeature-tc23.1 (s0001/d1e35137_1/d1e740_1/d1e25217_1/d1e6182_1)

Assertion: The following query parameters are required for all KVP-encoded service requests except GetCapabilities: service, request, version.

For GetFeature requests, if service or version parameter is not specified, MapGuide should response a WFS exception.

  1. Test wfs:wfs-1.1.0-Basic-GetFeature-tc44.2 (s0001/d1e35137_1/d1e740_1/d1e25217_1/d1e6238_1)

Assertion: Version number specified in a given request must correspond to a version supported by the service.

For GetFeature requests, if the version number specified in the request is not supported, MapGuide should generate a WFS exception.

  1. Test wfs:wfs-1.1.0-Basic-GetFeature-tc32.1 (s0001/d1e35137_1/d1e740_1/d1e25217_1/d1e6226_1)

Assertion: An ogc:Literal element may include simple or complex content. If a child element appears it may belong to any target namespace, but a top-level declaration for the item must be available.

For property names in filter, there will be a prefix like "gml:" or user specified prefix. Those prefixes should be removed to make sure properties can be found by FDO API.

Changeset [5191] by liuar

comment:10 by liuar, 14 years ago

13 Test wfs:wfs-1.1.0-Basic-GetFeature-tc8.1 (s0001/d1e35137_1/d1e740_1/d1e25217_1/d1e6162_1)

Assertion: A KVP parameter value that denotes a bounding box shall conform to the general syntax specified in subclause 10.2.3. If no CRS reference is provided, a service-defined default value must be assumed.

The API GetWfsFeature which response to the GetFeature request doesn't support mutilple spatial query like:

(surfaceProperty ENVELOPEINTERSECTS GeomFromText('POLYGON((-180 -90,180 -90,180 90,-180 90,-180 -90))')) OR (pointProperty ENVELOPEINTERSECTS GeomFromText('POLYGON((-180 -90,180 -90,180 90,-180 90,-180 -90))')) OR (curveProperty ENVELOPEINTERSECTS GeomFromText('POLYGON((-180 -90,180 -90,180 90,-180 90,-180 -90))'))

It just do query on the default geometry property, and features responsed to the client is less then expected. I extended the GetWfsFeature API to make sure MapGuide could process the spatial query on multiple geometry properties.

NOTE: Some FDO providers don't support OR with spatial query like Postgis/Posstgres Provider.

Another problem is that WFS 1.1.0 support URN SRS like (urn:ogc:def:crs:EPSG::4326) which is not supported by MapGuide. In order to support the URN SRS, I did a work around to replace the text "urn:ogc:def:crs:EPSG:" with "EPSG".

Changeset [5209] by liuar

comment:11 by liuar, 14 years ago

  1. Test wfs:wfs-1.1.0-Basic-GetFeature-tc50.1 (s0002/d1e35137_1/d1e740_1/d1e25217_1/d1e6264_1)

Assertion: When the SortBy parameter is used the resulting feature set must be properly sorted according to the sort criteria.

MapGuide WFS didn't support sortby parameter, I extend the GetWfsFeature API to accept a sortCriteria parameter to sort the feature set base on FDO OrderBy filter.

Note: not all FDO providers support OrderBy.

Changeset [5212] by liuar

comment:12 by liuar, 14 years ago

  1. Following two test cases:

Test wfs:wfs-1.1.0-Basic-GetFeature-tc47.2 (s0002/d1e35145_1/d1e740_1/d1e25225_1/d1e6254_1) Assertion: IIf a request is unrecognizable or the service cannot process the request, a valid exception report must be returned.

Test wfs:wfs-1.1.0-Basic-GetFeature-tc47.1 (s0002/d1e35145_1/d1e740_1/d1e25225_1/d1e6249_1) Assertion: IIf a request is unrecognizable or the service cannot process the request, a valid exception report must be returned.

If clients specify invalid feature class or feature property, MapGuide will generate an FDO exception and send it to clients. However, what the client expected is an WFS exception. I wrappered the FDO exception with WFS exception and make sure the client could get the proper error messages.

Changeset [5235] by liuar

comment:13 by liuar, 13 years ago

  1. Test wfs:wfs-1.1.0-Basic-GetFeature-tc8.3 (s0004/d1e35143_1/d1e740_1/d1e25223_1/d1e6172_1)

[GetFeature with BBOX KVP parameter (with the CRS not specified, service default expected). The BBOX values would indicate no features in the response. Pass if all of the following conditions are true: (1) the response is schema valid; (2) the root document is an wfs:FeatureCollection document; (3) no features are in the response.

Changeset [5333] by liuar

comment:14 by liuar, 13 years ago

  1. Test wfs:wfs-1.1.0-Basic-DescribeFeatureType-tc5.1 (s0004/d1e35143_1/d1e740_1/d1e25198_1/d1e3817_1)

Assertion: A comma (',') shall be used to delimit list items within multi-valued parameters in KVP strings.

Changeset [5339] by liuar

comment:15 by liuar, 13 years ago

  1. In order to pass the WFS certification, Mapguide should provide a way to customize the namespaceURL and namespacePrefix to the response document for GetFeature and DescribeFeatureType.

FDO provided following 2 APIs to set the namespaceURL and namespacePrefix.

    /// \brief
    /// Sets the default namespace which defines all feature/object types found in the input
    /// feature reader which is to be serialized. The user is also supposed to set the schema
    /// location for this namespace.
    /// 
    /// \param defaultNamespace 
    /// Default namespace.
    /// 
    FDO_API virtual void SetDefaultNamespace(FdoString* defaultNamespace);

    /// \brief
    /// Sets the default namespace prefix
    /// If the prefix is not set then it could be defaulted to the schema name. 
    /// 
    /// 
    /// \param defaultNamespace 
    /// Default namespace prefix.
    /// 
    FDO_API virtual void SetDefaultNamespacePrefix(FdoString* prefix);

MapGuide set thte namespaceURL and namesapcePrefix for the GetFeature response GML based on above FDO API

comment:16 by liuar, 13 years ago

Changeset [5371] by liuar

comment:17 by jng, 12 years ago

Resolution: fixed
Status: newclosed

Implemented

Note: See TracTickets for help on using tickets.