[mapguide-commits] r5153 - in trunk/MgDev:
Common/MapGuideCommon/System Server/src/Wfs Web/src
Web/src/CgiAgent Web/src/HttpHandler Web/src/MapAgentCommon
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sun Sep 19 02:55:13 EDT 2010
Author: liuar
Date: 2010-09-19 06:55:12 +0000 (Sun, 19 Sep 2010)
New Revision: 5153
Modified:
trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp
trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h
trunk/MgDev/Server/src/Wfs/1.1.0.xml.awd
trunk/MgDev/Web/src/CgiAgent/CgiAgent.cpp
trunk/MgDev/Web/src/HttpHandler/HttpRequest.cpp
trunk/MgDev/Web/src/HttpHandler/HttpWfsGetCapabilities.cpp
trunk/MgDev/Web/src/HttpHandler/HttpWfsGetCapabilities.h
trunk/MgDev/Web/src/HttpHandler/OgcWfsException.cpp
trunk/MgDev/Web/src/HttpHandler/OgcWfsException.h
trunk/MgDev/Web/src/HttpHandler/OgcWfsServer.cpp
trunk/MgDev/Web/src/HttpHandler/OgcWfsServer.h
trunk/MgDev/Web/src/MapAgentCommon/MapAgentCommon.cpp
trunk/MgDev/Web/src/webconfig.ini
Log:
Ticket #1421 OGC WFS 1.1.0 Support
cont.
6. 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.
7. 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)
Modified: trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp 2010-09-19 05:50:38 UTC (rev 5152)
+++ trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp 2010-09-19 06:55:12 UTC (rev 5153)
@@ -500,6 +500,8 @@
const STRING MgConfigProperties::OgcPropertiesSection = L"OgcProperties";
const STRING MgConfigProperties::WfsPassword = L"WfsPassword";
const STRING MgConfigProperties::WmsPassword = L"WmsPassword";
+const STRING MgConfigProperties::CITEWfsEnabled = L"CITEWfsEnabled";
+const bool MgConfigProperties::DefaultCITEWfsEnabled = false;
// ******************************************************************
// Web Application Properties
@@ -748,5 +750,6 @@
{
{ MgConfigProperties::WfsPassword , MgPropertyType::String , MG_CONFIG_MIN_PASSWORD_LENGTH , MG_CONFIG_MAX_PASSWORD_LENGTH , MG_CONFIG_PASSWORD_RESERVED_CHARACTERS },
{ MgConfigProperties::WmsPassword , MgPropertyType::String , MG_CONFIG_MIN_PASSWORD_LENGTH , MG_CONFIG_MAX_PASSWORD_LENGTH , MG_CONFIG_PASSWORD_RESERVED_CHARACTERS },
+ { MgConfigProperties::CITEWfsEnabled , MgPropertyType::Boolean , 0 , 1 , L"" },
{ L"" , 0 , 0.0 , 0.0 , L"" }
};
Modified: trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h 2010-09-19 05:50:38 UTC (rev 5152)
+++ trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h 2010-09-19 06:55:12 UTC (rev 5153)
@@ -864,6 +864,9 @@
/// Password for Wms requests
static const STRING WmsPassword; /// value("WmsPassword")
+ /// Enable OGC CITE Test for WFS
+ static const STRING CITEWfsEnabled; /// value("CITEWfsEnabled")
+ static const bool DefaultCITEWfsEnabled; /// value(false)
/// WEB APPLICATION PROPERTIES SECTION -------------------------------------------------------------------------------------------
Modified: trunk/MgDev/Server/src/Wfs/1.1.0.xml.awd
===================================================================
--- trunk/MgDev/Server/src/Wfs/1.1.0.xml.awd 2010-09-19 05:50:38 UTC (rev 5152)
+++ trunk/MgDev/Server/src/Wfs/1.1.0.xml.awd 2010-09-19 06:55:12 UTC (rev 5153)
@@ -64,7 +64,10 @@
<ows:LowerCorner>&Enum.item.west; &Enum.item.south;</ows:LowerCorner>
<ows:UpperCorner>&Enum.item.east; &Enum.item.north;</ows:UpperCorner>
</Define>
-
+ <Define item="Formats.GetCapabilities">
+ <item>text/xml</item>
+ </Define>
+
<!-- TODO: these will need to come from the full Feature metadata store -->
<!-- for now, these are operating defaults. -->
<Define item="Feature.namespace">http://fdo.osgeo.org/schemas</Define>
@@ -123,13 +126,14 @@
xmlns:ogc="http://www.opengis.net/ogc"
xmlns="http://www.opengis.net/wfs"
version="1.1.0"
- updateSequence="0"
xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"
>
- <!-- ================================================================== -->
- <!-- SERVICE IDENTIFICATION SECTION -->
- <!-- ================================================================== -->
- <ows:ServiceIdentification>
+
+ <?Ifdef item="Section.ServiceIdentification"?>
+ <!-- ================================================================== -->
+ <!-- SERVICE IDENTIFICATION SECTION -->
+ <!-- ================================================================== -->
+ <ows:ServiceIdentification>
<ows:Title>&Service.Title;</ows:Title>
<ows:Abstract>&Service.Abstract;</ows:Abstract>
<ows:Keywords>
@@ -140,11 +144,13 @@
<ows:Fees>&Service.Fees;</ows:Fees>
<ows:AccessConstraints>&Service.AccessConstraints;</ows:AccessConstraints>
</ows:ServiceIdentification>
-
- <!-- ================================================================== -->
- <!-- SERVICE PROVIDER SECTION -->
- <!-- ================================================================== -->
- <ows:ServiceProvider>
+ <?Endif?>
+
+ <?Ifdef item="Section.ServiceProvider"?>
+ <!-- ================================================================== -->
+ <!-- SERVICE PROVIDER SECTION -->
+ <!-- ================================================================== -->
+ <ows:ServiceProvider>
<ows:ProviderName>&Service.Contact.ProviderName;</ows:ProviderName>
<ows:ProviderSite>&Service.Contact.ProviderSite;</ows:ProviderSite>
<ows:ServiceContact>
@@ -170,12 +176,14 @@
<ows:Role>&Service.Contact.Role;</ows:Role>
</ows:ServiceContact>
</ows:ServiceProvider>
+ <?Endif?>
+
+ <?Ifdef item="Section.OperationsMetadata"?>
+ <!-- ================================================================== -->
+ <!-- OPERATIONS METADATA SECTION -->
+ <!-- ================================================================== -->
+ <ows:OperationsMetadata>
- <!-- ================================================================== -->
- <!-- OPERATIONS METADATA SECTION -->
- <!-- ================================================================== -->
- <ows:OperationsMetadata>
-
<!-- GetCapabilities -->
<ows:Operation name="GetCapabilities">
<ows:DCP>
@@ -239,15 +247,18 @@
</ows:Constraint>
</ows:OperationsMetadata>
-
+ <?Endif?>
+
+ <?Ifdef item="Section.FeatureTypeList"?>
+ <!-- ================================================================== -->
+ <!-- FEATURE TYPE LIST SECTION -->
+ <!-- ================================================================== -->
+ <wfs:FeatureTypeList>
+ <?EnumFeatureTypes using="&Feature.xml;"?>
+ </wfs:FeatureTypeList>
+ <?Endif?>
+
<!-- ================================================================== -->
- <!-- FEATURE TYPE LIST SECTION -->
- <!-- ================================================================== -->
- <wfs:FeatureTypeList>
- <?EnumFeatureTypes using="&Feature.xml;"?>
- </wfs:FeatureTypeList>
-
- <!-- ================================================================== -->
<!-- FILTER CAPABILITIES SECTION -->
<!-- ================================================================== -->
Modified: trunk/MgDev/Web/src/CgiAgent/CgiAgent.cpp
===================================================================
--- trunk/MgDev/Web/src/CgiAgent/CgiAgent.cpp 2010-09-19 05:50:38 UTC (rev 5152)
+++ trunk/MgDev/Web/src/CgiAgent/CgiAgent.cpp 2010-09-19 06:55:12 UTC (rev 5153)
@@ -290,8 +290,11 @@
return true;
}
- // Nope, doesn't look like it to me.
- return false;
+ MgConfiguration* cfg = MgConfiguration::GetInstance();
+ bool bCITEWfsEnabled = false;
+ cfg->GetBoolValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::CITEWfsEnabled, bCITEWfsEnabled, MgConfigProperties::DefaultCITEWfsEnabled);
+
+ return bCITEWfsEnabled;
}
bool ParseAuth(char* auth, MgHttpRequestParam* params)
@@ -338,8 +341,8 @@
bool AuthenticateOgcRequest(MgHttpRequestParam* params)
{
- bool isWms = true;
-
+ bool isWms = false;
+ bool isWfs = false;
// Determine with the optional service parameter if the request is WMS or WFS
// If the service is present and specifies something else than WMS or WFS, refuse
// authentication as MapGuide only supports these 2 services.
@@ -349,9 +352,9 @@
if(serviceValue.length() != 0)
{
if(serviceValue == L"WFS")
- isWms = false;
- else if(serviceValue != L"WMS")
- return false;
+ isWfs = true;
+ else if(serviceValue == L"WMS")
+ isWms = true;
}
else // Look for possible POST-method with content payload.
{
@@ -382,15 +385,39 @@
return false; // abandon the authentication attempt
isWms = bWms;
+ isWfs = bWfs;
}
}
+ MgConfiguration* cfg = MgConfiguration::GetInstance();
+
+ // OGC CITE: Test wfs:wfs-1.1.0-Basic-GetCapabilities-tc16.2 (s0012/d1e34887_1/d1e732_1/d1e25171_1/d1e903_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.
+ if(!isWms && !isWfs)
+ {
+ cfg->GetBoolValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::CITEWfsEnabled, isWfs, MgConfigProperties::DefaultCITEWfsEnabled);
+ }
+
// Get WMS/WFS password from configuration.
STRING username, password;
- MgConfiguration* cfg = MgConfiguration::GetInstance();
- username = isWms ? MgUser::WmsUser : MgUser::WfsUser;
- cfg->GetStringValue(MgConfigProperties::OgcPropertiesSection, isWms? MgConfigProperties::WmsPassword: MgConfigProperties::WfsPassword, password, L"");
+ if(isWms)
+ {
+ username = MgUser::WmsUser;
+ cfg->GetStringValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::WmsPassword, password, L"");
+ }
+ else if(isWfs)
+ {
+ username = MgUser::WfsUser;
+ cfg->GetStringValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::WfsPassword, password, L"");
+ }
+ else
+ {
+ return false;
+ }
//feed these values in as parameters
params->AddParameter(MgHttpResourceStrings::reqUsername, username);
Modified: trunk/MgDev/Web/src/HttpHandler/HttpRequest.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpRequest.cpp 2010-09-19 05:50:38 UTC (rev 5152)
+++ trunk/MgDev/Web/src/HttpHandler/HttpRequest.cpp 2010-09-19 06:55:12 UTC (rev 5153)
@@ -212,9 +212,9 @@
if(sRequestValue.length() != 0)
{
STRING sServiceValue = m_requestParam->GetParameterValue(MgHttpResourceStrings::reqWmsService);
- if(sServiceValue.length() != 0)
+ if(sServiceValue.length() != 0 && (wcsicmp(L"WFS",sServiceValue.c_str()) == 0 || wcsicmp(L"WMS",sServiceValue.c_str()) == 0))
{
- sParamValue = sServiceValue;
+ sParamValue = sServiceValue;
}
else
{
@@ -228,16 +228,13 @@
// Error handling for OGC certification.
// MapGuide should generate an WFS exception while receiveing following request:
// http://locahost/mapguide/mapagent/mapagent.fcgi??request~GetCapabilities!service~WFS!version~1.1.0
- Ptr<MgStringCollection> parameterNames = m_requestParam->GetParameterNames();
- for(int i = 0; i < parameterNames->GetCount(); i++)
+ MgConfiguration* cfg = MgConfiguration::GetInstance();
+ bool bCITEWfsEnabled = false;
+
+ cfg->GetBoolValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::CITEWfsEnabled, bCITEWfsEnabled, MgConfigProperties::DefaultCITEWfsEnabled);
+ if(bCITEWfsEnabled)
{
- STRING parameterName = parameterNames->GetItem(i);
- if(parameterName.find(L"WFS") != STRING::npos)
- {
- sParamValue = L"WFS";
- sParamValue.append(L".");
- sParamValue.append(L"GETCAPABILITIES");
- }
+ sParamValue = L"WFS.GETCAPABILITIES";
}
}
}
Modified: trunk/MgDev/Web/src/HttpHandler/HttpWfsGetCapabilities.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpWfsGetCapabilities.cpp 2010-09-19 05:50:38 UTC (rev 5152)
+++ trunk/MgDev/Web/src/HttpHandler/HttpWfsGetCapabilities.cpp 2010-09-19 06:55:12 UTC (rev 5153)
@@ -22,6 +22,17 @@
#include "XmlParser.h"
#include "OgcWfsServer.h"
+extern CPSZ kpszQueryStringSections; // = _("sections");
+extern CPSZ kpszOmittedValue; //= _("(omitted)"); if any dictionary value needs to be omitted...
+extern CPSZ kpszDefinitionSectionServiceIdentification; //= _("Section.ServiceIdentification")
+extern CPSZ kpszDefinitionSectionServiceProvider; //= _("Section.ServiceProvider")
+extern CPSZ kpszDefinitionSectionOperationsMetadata; //= _("Section.OperationsMetadata")
+extern CPSZ kpszDefinitionSectionFeatureTypeList; //= _("Section.FeatureTypeList")
+const STRING kpszServiceIdentification = _("serviceidentification");
+const STRING kpszServiceProvider = _("serviceprovider");
+const STRING kpszOperationsMetadata = _("operationsmetadata");
+const STRING kpszSectionFeatureTypeList = _("featuretypelist");
+
HTTP_IMPLEMENT_CREATE_OBJECT(MgHttpWfsGetCapabilities)
/// <summary>
@@ -109,3 +120,50 @@
//TODO Parse params->GetXmlPostData();
return false;
}
+
+void MgHttpWfsGetCapabilities::AcquireValidationData(MgOgcServer* ogcServer)
+{
+ MgOgcWfsServer* wfsServer = (MgOgcWfsServer*)ogcServer;
+ if(wfsServer != NULL)
+ {
+ // The initialization that used to happen in the ctor is deferred until now
+ // (when we need it) since now we have access to a server object.
+ InitializeRequestParameters(*wfsServer);
+ }
+}
+
+void MgHttpWfsGetCapabilities::InitializeRequestParameters(MgOgcWfsServer& oServer)
+{
+ // OGC CITE: 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.
+ CPSZ pszSections = oServer.RequestParameter(kpszQueryStringSections);
+ if(pszSections)
+ {
+ STRING sSections = MgUtil::ToLower(STRING(pszSections));
+
+ if(sSections.find(kpszServiceIdentification) != STRING::npos)
+ {
+ oServer.SetGetCapabilitiesSection(kpszDefinitionSectionServiceIdentification);
+ }
+ if(sSections.find(kpszServiceProvider) != STRING::npos)
+ {
+ oServer.SetGetCapabilitiesSection(kpszDefinitionSectionServiceProvider);
+ }
+ if(sSections.find(kpszOperationsMetadata) != STRING::npos)
+ {
+ oServer.SetGetCapabilitiesSection(kpszDefinitionSectionOperationsMetadata);
+ }
+ if(sSections.find(kpszSectionFeatureTypeList) != STRING::npos)
+ {
+ oServer.SetGetCapabilitiesSection(kpszDefinitionSectionFeatureTypeList);
+ }
+ }
+ else
+ {
+ // All sections in GetCapabilities document should be displayed
+ oServer.SetGetCapabilitiesSection(_(""));
+ }
+}
Modified: trunk/MgDev/Web/src/HttpHandler/HttpWfsGetCapabilities.h
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpWfsGetCapabilities.h 2010-09-19 05:50:38 UTC (rev 5152)
+++ trunk/MgDev/Web/src/HttpHandler/HttpWfsGetCapabilities.h 2010-09-19 06:55:12 UTC (rev 5153)
@@ -64,7 +64,12 @@
/// </returns>
MgRequestClassification GetRequestClassification() { return MgHttpRequestResponseHandler::mrcWfs; }
+ // IMgOgcDataAccessor method
+ virtual void AcquireValidationData(MgOgcServer* ogcServer);
+
private:
+
+ void InitializeRequestParameters(MgOgcWfsServer& oServer);
};
#endif // _FS_WFS_GET_CAPABILITIES_H
Modified: trunk/MgDev/Web/src/HttpHandler/OgcWfsException.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/OgcWfsException.cpp 2010-09-19 05:50:38 UTC (rev 5152)
+++ trunk/MgDev/Web/src/HttpHandler/OgcWfsException.cpp 2010-09-19 06:55:12 UTC (rev 5153)
@@ -25,8 +25,8 @@
CPSZ MgOgcWfsException::kpszMissingRequestParameter = _("MissingParameterValue");
CPSZ MgOgcWfsException::kpszProcessingError = _("RequestProcessingError");
CPSZ MgOgcWfsException::kpszVersionNegotiationFailed = _("VersionNegotiationFailed");
+CPSZ MgOgcWfsException::kpszInvalidParameterValue = _("InvalidParameterValue");
-
void MgOgcWfsException::WriteTo(CStream& Response) const
{
SZBUF szTypeAttribute[64];
Modified: trunk/MgDev/Web/src/HttpHandler/OgcWfsException.h
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/OgcWfsException.h 2010-09-19 05:50:38 UTC (rev 5152)
+++ trunk/MgDev/Web/src/HttpHandler/OgcWfsException.h 2010-09-19 06:55:12 UTC (rev 5153)
@@ -34,11 +34,12 @@
Exception Code Meaning
--------------------- -------------------------------------------------------------
*/
- static CPSZ kpszOperationNotSupported; // Requested a Request= operation that is unknown
- static CPSZ kpszUnknownParameterValue; // Specified a parameter value that is unknown.
- static CPSZ kpszMissingRequestParameter; // A required request parameter was not specified.
- static CPSZ kpszProcessingError; // An error occurred while processing the request
+ static CPSZ kpszOperationNotSupported; // Requested a Request= operation that is unknown
+ static CPSZ kpszUnknownParameterValue; // Specified a parameter value that is unknown.
+ static CPSZ kpszMissingRequestParameter; // A required request parameter was not specified.
+ static CPSZ kpszProcessingError; // An error occurred while processing the request
static CPSZ kpszVersionNegotiationFailed; // None of the requested versions are supported
+ static CPSZ kpszInvalidParameterValue; // request parameter is invalid
};
#endif//_OgcWfsException_h
Modified: trunk/MgDev/Web/src/HttpHandler/OgcWfsServer.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/OgcWfsServer.cpp 2010-09-19 05:50:38 UTC (rev 5152)
+++ trunk/MgDev/Web/src/HttpHandler/OgcWfsServer.cpp 2010-09-19 06:55:12 UTC (rev 5153)
@@ -39,8 +39,15 @@
CPSZ kpszQueryStringGetFeatureOutputFormatDefault_1_1_0 = _("Formats.GetFeature.default.1.1.0");
CPSZ kpszPiGetFeatureCollection = _("GetFeatureCollection");
CPSZ kpszPiGetFeatureCollectionDefaultFormat = _("&GetFeatureCollection.xml;");
+
CPSZ kpszQueryStringAcceptVersions = _("acceptversions");
+CPSZ kpszQueryStringSections = _("sections");
+CPSZ kpszDefinitionSectionServiceIdentification = _("Section.ServiceIdentification");
+CPSZ kpszDefinitionSectionServiceProvider = _("Section.ServiceProvider");
+CPSZ kpszDefinitionSectionOperationsMetadata = _("Section.OperationsMetadata");
+CPSZ kpszDefinitionSectionFeatureTypeList = _("Section.FeatureTypeList");
+
extern CPSZ kpszPiAttributeSubset; // = _("subset");
extern CPSZ kpszElementVersion; // = _("Version");
extern CPSZ kpszAttributeNumber; //= _("number");
@@ -53,7 +60,8 @@
CPSZ kpszExceptionMessageUnknownOutputFormat = _("Expected valid outputFormat argument, as enumerated by GetCapabilities. (Instead, found outputFormat='&Request.OutputFormat;'.)"); // Localize
CPSZ kpszExceptionMessageUnknownTypeName = _("Expected valid typeName argument, as enumerated by GetCapabilities. (Instead, found typeName='&Request.TypeName;'.)"); // Localize
CPSZ kpszExceptionMessageWfsGetFeatureMissingFeatureType = _("A WFS GetFeature request requires at least one feature type to be specified."); // Localize
-CPSZ kpszExceptionMessageWfsVersionNegotiationFailed = _("Requested version is supported in AcceptVersions"); //Localize
+CPSZ kpszExceptionMessageWfsVersionNegotiationFailed = _("Requested version is unsupported in AcceptVersions"); //Localize
+CPSZ kpszExceptionMessageWfsInvalidService = _("Invalid parameter value for SERVICE"); //Localize
CPSZ kpszInternalErrorMissingGetFeatureRequestParams = _("Internal Error: Missing WFS GetFeature request parameters."); // Localize
//
@@ -120,13 +128,20 @@
// Check for SERVICE=WFS -- otherwise, we're not prepared to service the request
CPSZ pService = RequestParameter(kpszQueryStringService);
- if(pService == NULL || SZ_NEI(pService,kpszQueryValueWfs))
+ if(pService == NULL)
{
ServiceExceptionReportResponse(MgOgcWfsException(MgOgcWfsException::kpszMissingRequestParameter,
kpszExceptionMessageMissingServiceWfs,
kpszQueryStringService));
bValid = false;
}
+ else if(SZ_NEI(pService,kpszQueryValueWfs))
+ {
+ ServiceExceptionReportResponse(MgOgcWfsException(MgOgcWfsException::kpszInvalidParameterValue,
+ kpszExceptionMessageWfsInvalidService,
+ kpszQueryStringService));
+ bValid = false;
+ }
if(bValid)
{
@@ -384,6 +399,15 @@
//
void MgOgcWfsServer::ProcedureEnumFeatureTypes(MgXmlProcessingInstruction& PIEnum)
{
+ // OGC CITE: 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.
+ CPSZ psz = this->Definition(kpszDefinitionSectionFeatureTypeList);
+ if(!psz)
+ return;
+
STRING sFormat;
if(!PIEnum.GetAttribute(kpszPiAttributeUsing,sFormat))
sFormat = kpszPiEnumFeaturesDefaultFormat;
@@ -486,6 +510,22 @@
m_pFeatures = pFeatureDefs;
}
+
+void MgOgcWfsServer::SetGetCapabilitiesSection(CREFSTRING sSection)
+{
+ if(!sSection.empty())
+ {
+ AddDefinition(sSection.c_str(),kpszOmittedValue);
+ }
+ else
+ {
+ AddDefinition(kpszDefinitionSectionServiceIdentification,kpszOmittedValue);
+ AddDefinition(kpszDefinitionSectionServiceProvider,kpszOmittedValue);
+ AddDefinition(kpszDefinitionSectionOperationsMetadata,kpszOmittedValue);
+ AddDefinition(kpszDefinitionSectionFeatureTypeList,kpszOmittedValue);
+ }
+}
+
// Help method to get the default output format
STRING MgOgcWfsServer::GetDefaultOutputFormat(CREFSTRING sVersion)
{
Modified: trunk/MgDev/Web/src/HttpHandler/OgcWfsServer.h
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/OgcWfsServer.h 2010-09-19 05:50:38 UTC (rev 5152)
+++ trunk/MgDev/Web/src/HttpHandler/OgcWfsServer.h 2010-09-19 06:55:12 UTC (rev 5153)
@@ -32,8 +32,12 @@
void SetFeatures(MgWfsFeatures* pFeatures);
void SetGetFeatureRequestParams(WfsGetFeatureParams* pGetFeatureParams);
void SetFeatureDefinitions(MgWfsFeatureDefinitions* pFeatureDefs);
- STRING GetDefaultOutputFormat(CREFSTRING sVersion);
+ // The the section which displays in the GetCapabilities response document
+ void SetGetCapabilitiesSection(CREFSTRING sSection);
+
+ STRING GetDefaultOutputFormat(CREFSTRING sVersion);
+
protected:
virtual void RespondToRequest();
virtual bool ValidateRequest();
Modified: trunk/MgDev/Web/src/MapAgentCommon/MapAgentCommon.cpp
===================================================================
--- trunk/MgDev/Web/src/MapAgentCommon/MapAgentCommon.cpp 2010-09-19 05:50:38 UTC (rev 5152)
+++ trunk/MgDev/Web/src/MapAgentCommon/MapAgentCommon.cpp 2010-09-19 06:55:12 UTC (rev 5153)
@@ -35,8 +35,11 @@
return true;
}
- // Nope, doesn't look like it to me.
- return false;
+ MgConfiguration* cfg = MgConfiguration::GetInstance();
+ bool bCITEWfsEnabled = false;
+ cfg->GetBoolValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::CITEWfsEnabled, bCITEWfsEnabled, MgConfigProperties::DefaultCITEWfsEnabled);
+
+ return bCITEWfsEnabled;
}
@@ -85,8 +88,8 @@
bool MapAgentCommon::AuthenticateOgcRequest(MgHttpRequestParam* params)
{
- bool isWms = true;
-
+ bool isWms = false;
+ bool isWfs = false;
// Determine with the optional service parameter if the request is WMS or WFS
// If the service is present and specifies something else than WMS or WFS, refuse
// authentication as MapGuide only supports these 2 services.
@@ -96,9 +99,9 @@
if(serviceValue.length() != 0)
{
if(serviceValue == L"WFS")
- isWms = false;
- else if(serviceValue != L"WMS")
- return false;
+ isWfs = true;
+ else if(serviceValue == L"WMS")
+ isWms = true;
}
else // Look for possible POST-method with content payload.
{
@@ -129,15 +132,39 @@
return false; // abandon the authentication attempt
isWms = bWms;
+ isWfs = bWfs;
}
}
+ MgConfiguration* cfg = MgConfiguration::GetInstance();
+
+ // OGC CITE: Test wfs:wfs-1.1.0-Basic-GetCapabilities-tc16.2 (s0012/d1e34887_1/d1e732_1/d1e25171_1/d1e903_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.
+ if(!isWms && !isWfs)
+ {
+ cfg->GetBoolValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::CITEWfsEnabled, isWfs, MgConfigProperties::DefaultCITEWfsEnabled);
+ }
+
// Get WMS/WFS password from configuration.
STRING username, password;
- MgConfiguration* cfg = MgConfiguration::GetInstance();
- username = isWms ? MgUser::WmsUser : MgUser::WfsUser;
- cfg->GetStringValue(MgConfigProperties::OgcPropertiesSection, isWms? MgConfigProperties::WmsPassword: MgConfigProperties::WfsPassword, password, L"");
+ if(isWms)
+ {
+ username = MgUser::WmsUser;
+ cfg->GetStringValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::WmsPassword, password, L"");
+ }
+ else if(isWfs)
+ {
+ username = MgUser::WfsUser;
+ cfg->GetStringValue(MgConfigProperties::OgcPropertiesSection, MgConfigProperties::WfsPassword, password, L"");
+ }
+ else
+ {
+ return false;
+ }
//feed these values in as parameters
params->AddParameter(MgHttpResourceStrings::reqUsername, username);
Modified: trunk/MgDev/Web/src/webconfig.ini
===================================================================
--- trunk/MgDev/Web/src/webconfig.ini 2010-09-19 05:50:38 UTC (rev 5152)
+++ trunk/MgDev/Web/src/webconfig.ini 2010-09-19 06:55:12 UTC (rev 5153)
@@ -168,9 +168,13 @@
# requests
# WmsPassword Password to be used for credentials in WMS
# requests
+# CITEWfsEnabled Enable OGC CITE Test for WFS
+# Consider unknown requests as OGC Wfs HTTP requests
+# 0 = false and 1 = true
# *****************************************************************************
WfsPassword = wfs
WmsPassword = wms
+CITEWfsEnabled = 0
[WebApplicationProperties]
# *****************************************************************************
More information about the mapguide-commits
mailing list