[mapguide-commits] r5397 - in trunk/MgDev: Common/MapGuideCommon/Services Common/PlatformBase/Services Server/src/Services/Feature Web/src/HttpHandler

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Nov 23 00:54:03 EST 2010


Author: liuar
Date: 2010-11-22 21:54:03 -0800 (Mon, 22 Nov 2010)
New Revision: 5397

Modified:
   trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.cpp
   trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.h
   trunk/MgDev/Common/PlatformBase/Services/FeatureService.h
   trunk/MgDev/Server/src/Services/Feature/FilterUtil.cpp
   trunk/MgDev/Server/src/Services/Feature/OpDescribeWfsFeatureType.cpp
   trunk/MgDev/Server/src/Services/Feature/ServerDescribeSchema.cpp
   trunk/MgDev/Server/src/Services/Feature/ServerDescribeSchema.h
   trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp
   trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.h
   trunk/MgDev/Web/src/HttpHandler/HttpWfsDescribeFeatureType.cpp
Log:
Ticket #1421: OGC WFS 1.1.0 Support

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 target namespace prefix for the GML version of this schema.
    /// When the Feature Schema for these overrides is written to GML, its targetNamespace prefix
    /// is set to this value.
    /// 
    /// \param prefix 
    /// Input the target namespace prefix.
    /// 
    FDO_API void SetTargetNamespacePrefix(FdoString* prefix);

    /// \brief
    /// Sets the target namespace URI for the GML version of this schema.
    /// When the Feature Schema for these overrides is written to GML, its targetNamespace
    /// is set to this value.
    /// 
    /// \param url 
    /// Input the target namespace.
    /// 
    FDO_API void SetTargetNamespace( FdoString* url );

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



Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.cpp	2010-11-21 21:03:39 UTC (rev 5396)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.cpp	2010-11-23 05:54:03 UTC (rev 5397)
@@ -1366,18 +1366,20 @@
 // Retrieves WFS schema information for the specified feature classes with specified format
 MgByteReader* MgProxyFeatureService::DescribeWfsFeatureType(MgResourceIdentifier* featureSourceId,
                                                             MgStringCollection* featureClasses,
-                                                            CREFSTRING outputFormat)
+                                                            CREFSTRING namespacePrefix,
+                                                            CREFSTRING namespaceUrl)
 {
     MgCommand cmd;
     cmd.ExecuteCommand(m_connProp,                                  // Connection
                        MgCommand::knObject,                         // Return type expected
                        MgFeatureServiceOpId::DescribeWfsFeatureType_Id, // Command Code
-                       3,                                           // No of arguments
+                       4,                                           // No of arguments
                        Feature_Service,                             // Service Id
                        BUILD_VERSION(2,3,0),                        // Operation version
                        MgCommand::knObject, featureSourceId,        // Argument#1
                        MgCommand::knObject, featureClasses,         // Argument#2
-                       MgCommand::knString, &outputFormat,          // Argument#3
+                       MgCommand::knString, &namespacePrefix,       // Argument#3
+                       MgCommand::knString, &namespaceUrl,          // Argument#4
                        MgCommand::knNone);                          // End of argument
 
     SetWarning(cmd.GetWarningObject());

Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.h	2010-11-21 21:03:39 UTC (rev 5396)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.h	2010-11-23 05:54:03 UTC (rev 5397)
@@ -1033,17 +1033,17 @@
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////////
     /// \brief
-    /// Retrieves schema informationabout a set of feature classes for a given feature source  with specified format.
+    /// Retrieves schema informationabout a set of feature classes for a given feature source  with specified namespace prefix and url.
     ///
     /// <!-- Syntax in .Net, Java, and PHP -->
     /// \htmlinclude DotNetSyntaxTop.html
-    /// virtual MgByteReader DescribeWfsFeatureType(MgResourceIdentifier featureSourceId, MgStringCollection featureClasses, string outputFormat);
+    /// virtual MgByteReader DescribeWfsFeatureType(MgResourceIdentifier featureSourceId, MgStringCollection featureClasses, string namespacePrefix, string namespaceUrl);
     /// \htmlinclude SyntaxBottom.html
     /// \htmlinclude JavaSyntaxTop.html
-    /// virtual MgByteReader DescribeWfsFeatureType(MgResourceIdentifier featureSourceId, MgStringCollection featureClasses, string outputFormat);
+    /// virtual MgByteReader DescribeWfsFeatureType(MgResourceIdentifier featureSourceId, MgStringCollection featureClasses, string namespacePrefix, string namespaceUrl);
     /// \htmlinclude SyntaxBottom.html
     /// \htmlinclude PHPSyntaxTop.html
-    /// virtual MgByteReader DescribeWfsFeatureType(MgResourceIdentifier featureSourceId, MgStringCollection featureClasse, string outputFormats);
+    /// virtual MgByteReader DescribeWfsFeatureType(MgResourceIdentifier featureSourceId, MgStringCollection featureClasses, string namespacePrefix, string namespaceUrl);
     /// \htmlinclude SyntaxBottom.html
     ///
     /// \param featureSourceId (MgResourceIdentifier)
@@ -1054,18 +1054,18 @@
     /// 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
+    /// \param namespacePrefix (String/string)
+    /// A string identifying the namespace prefix in the output xml
+    /// \param namespaceUrl (String/string)
+    /// A string idenyifying the namespace url in the output xml
     ///
     /// \return
     /// Returns an MgByteReader containing the XML schema.
     ///
     virtual MgByteReader* DescribeWfsFeatureType(MgResourceIdentifier* featureSourceId,
                                                  MgStringCollection* featureClasses,
-                                                 CREFSTRING outputFormat);
+                                                 CREFSTRING namespacePrefix,
+                                                 CREFSTRING namespaceUrl);
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////////
     /// \brief

Modified: trunk/MgDev/Common/PlatformBase/Services/FeatureService.h
===================================================================
--- trunk/MgDev/Common/PlatformBase/Services/FeatureService.h	2010-11-21 21:03:39 UTC (rev 5396)
+++ trunk/MgDev/Common/PlatformBase/Services/FeatureService.h	2010-11-23 05:54:03 UTC (rev 5397)
@@ -1531,19 +1531,19 @@
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////////
     /// \brief
-    /// Retrieves schema informationabout a set of feature classes for a given feature source  with specified format.
+    /// Retrieves schema informationabout a set of feature classes for a given feature source  with specified namespace prefix and url.
     ///
     /// \note1
     ///
     /// <!-- Syntax in .Net, Java, and PHP -->
     /// \htmlinclude DotNetSyntaxTop.html
-    /// virtual MgByteReader DescribeWfsFeatureType(MgResourceIdentifier featureSourceId, MgStringCollection featureClasses, string outputFormat);
+    /// virtual MgByteReader DescribeWfsFeatureType(MgResourceIdentifier featureSourceId, MgStringCollection featureClasses, string namespacePrefix, string namespaceUrl);
     /// \htmlinclude SyntaxBottom.html
     /// \htmlinclude JavaSyntaxTop.html
-    /// virtual MgByteReader DescribeWfsFeatureType(MgResourceIdentifier featureSourceId, MgStringCollection featureClasses, string outputFormat);
+    /// virtual MgByteReader DescribeWfsFeatureType(MgResourceIdentifier featureSourceId, MgStringCollection featureClasses, string namespacePrefix, string namespaceUrl);
     /// \htmlinclude SyntaxBottom.html
     /// \htmlinclude PHPSyntaxTop.html
-    /// virtual MgByteReader DescribeWfsFeatureType(MgResourceIdentifier featureSourceId, MgStringCollection featureClasse, string outputFormats);
+    /// virtual MgByteReader DescribeWfsFeatureType(MgResourceIdentifier featureSourceId, MgStringCollection featureClasses, string namespacePrefix, string namespaceUrl);
     /// \htmlinclude SyntaxBottom.html
     ///
     /// \param featureSourceId (MgResourceIdentifier)
@@ -1554,18 +1554,18 @@
     /// 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
+    /// \param namespacePrefix (String/string)
+    /// A string identifying the namespace prefix in the output xml
+    /// \param namespaceUrl (String/string)
+    /// A string idenyifying the namespace url in the output xml
     ///
     /// \return
     /// Returns an MgByteReader containing the XML schema.
     ///
     virtual MgByteReader* DescribeWfsFeatureType(MgResourceIdentifier* featureSourceId,
                                                  MgStringCollection* featureClasses,
-                                                 CREFSTRING outputFormat) = 0;
+                                                 CREFSTRING namespacePrefix,
+                                                 CREFSTRING namespaceUrl) = 0;
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////////
     /// \brief

Modified: trunk/MgDev/Server/src/Services/Feature/FilterUtil.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/FilterUtil.cpp	2010-11-21 21:03:39 UTC (rev 5396)
+++ trunk/MgDev/Server/src/Services/Feature/FilterUtil.cpp	2010-11-23 05:54:03 UTC (rev 5397)
@@ -154,11 +154,19 @@
     {
         m_propName = process_identifier(root);
 
-        // This is a workaround for GML3. For Name and Description properties, there will be a "gml:" prefix
-        // Remove the prefix to make sure Name and Description properties can be found by FDO API.
-        size_t pos = m_propName.find_first_of(L":");
+        // This is a workaround for OGC WFS Certification.
+
+        // In GML3 , for Name and Description elements, there will be a "gml:" prefix. 
+        // The colon will be replaced with underline in FDO.
+        size_t pos = m_propName.find(L"gml:");
         if(pos != STRING::npos)
         {
+            m_propName = MgUtil::ReplaceString(m_propName,L":",L"_");
+        }
+        // For other elemnts, there will be a namespace prefix like "sf:". 
+        // The prefix should be removed before passing to FDO.
+        else if((pos = m_propName.find(L":")) != STRING::npos)
+        {
             m_propName = m_propName.substr(pos+1);
         }
 

Modified: trunk/MgDev/Server/src/Services/Feature/OpDescribeWfsFeatureType.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/OpDescribeWfsFeatureType.cpp	2010-11-21 21:03:39 UTC (rev 5396)
+++ trunk/MgDev/Server/src/Services/Feature/OpDescribeWfsFeatureType.cpp	2010-11-23 05:54:03 UTC (rev 5397)
@@ -86,7 +86,7 @@
         // Write the response
         EndExecution(byteReader);
     }
-    else if (3 == m_packet.m_NumArguments)
+    else if (4 == m_packet.m_NumArguments)
     {
         // Get the feature source
         Ptr<MgResourceIdentifier> featureSourceId = (MgResourceIdentifier*)m_stream->GetObject();
@@ -94,10 +94,14 @@
         // Get the feature class collection
         Ptr<MgStringCollection> featureClasses = (MgStringCollection*)m_stream->GetObject();
 
-        // Get the output format
-        STRING outputFormat;
-        m_stream->GetString(outputFormat);
+        // Get the namespace prefix
+        STRING namespacePrefix;
+        m_stream->GetString(namespacePrefix);
 
+        // Get the namespace url
+        STRING namespaceUrl;
+        m_stream->GetString(namespaceUrl);
+
         BeginExecution();
 
         MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
@@ -105,13 +109,15 @@
         MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
         MG_LOG_OPERATION_MESSAGE_ADD_STRING(L"MgStringCollection");
         MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
-        MG_LOG_OPERATION_MESSAGE_ADD_STRING(outputFormat.c_str());
+        MG_LOG_OPERATION_MESSAGE_ADD_STRING(namespacePrefix.c_str());
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_STRING(namespaceUrl.c_str());
         MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
 
         Validate();
 
         // Execute the operation
-        Ptr<MgByteReader> byteReader = m_service->DescribeWfsFeatureType(featureSourceId, featureClasses,outputFormat);
+        Ptr<MgByteReader> byteReader = m_service->DescribeWfsFeatureType(featureSourceId, featureClasses, namespacePrefix, namespaceUrl);
 
         // Write the response
         EndExecution(byteReader);

Modified: trunk/MgDev/Server/src/Services/Feature/ServerDescribeSchema.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerDescribeSchema.cpp	2010-11-21 21:03:39 UTC (rev 5396)
+++ trunk/MgDev/Server/src/Services/Feature/ServerDescribeSchema.cpp	2010-11-23 05:54:03 UTC (rev 5397)
@@ -663,6 +663,47 @@
 }
 
 //////////////////////////////////////////////////////////////////
+// Converts MgFeatureSchemaCollection to XML with specified namespacePrefix and namespaceURL (Just used for OGC WFS certification)
+STRING MgServerDescribeSchema::SchemaToXml(MgFeatureSchemaCollection* schema, CREFSTRING namespacePrefix, CREFSTRING namespaceUrl)
+{
+    STRING xmlSchema;
+
+    MG_FEATURE_SERVICE_TRY()
+
+    if (NULL == schema)
+    {
+        throw new MgNullArgumentException(L"MgServerDescribeSchema.SchemaToXml", __LINE__, __WFILE__, NULL, L"", NULL);
+    }
+
+    CHECKNULL((MgFeatureSchemaCollection*)schema, L"MgServerDescribeSchema.SchemaToXml");
+
+    FdoPtr<FdoFeatureSchemaCollection> fdoSchemaCol = MgServerFeatureUtil::GetFdoFeatureSchemaCollection(schema);
+
+    FdoPtr<FdoXmlFlags> flags = FdoXmlFlags::Create();
+
+    if(!namespacePrefix.empty() && !namespaceUrl.empty())
+    {
+        FdoPtr<FdoPhysicalSchemaMappingCollection> fdoPhysicalSchemaMappingCol = FdoPhysicalSchemaMappingCollection::Create();
+        for(int i = 0; i<fdoSchemaCol->GetCount(); i++)
+        {
+            FdoPtr<FdoFeatureSchema> fdoSchema = fdoSchemaCol->GetItem(i);
+            FdoPtr<FdoXmlSchemaMapping> fdoSchemaMapping = FdoXmlSchemaMapping::Create(fdoSchema->GetName());
+            fdoSchemaMapping->SetTargetNamespacePrefix(namespacePrefix.c_str());
+            fdoSchemaMapping->SetTargetNamespace(namespaceUrl.c_str());
+            fdoPhysicalSchemaMappingCol->Add(fdoSchemaMapping);
+        }
+        flags->SetSchemaMappings(fdoPhysicalSchemaMappingCol);
+    }
+
+
+    xmlSchema = GetSerializedXml(fdoSchemaCol,flags);
+
+    MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDescribeSchema.SchemaToXml")
+
+    return xmlSchema;
+}
+
+//////////////////////////////////////////////////////////////////
 MgFeatureSchemaCollection* MgServerDescribeSchema::XmlToSchema(CREFSTRING xml)
 {
     Ptr<MgFeatureSchemaCollection> mgSchemaCol;
@@ -760,7 +801,41 @@
     return serializedXml;
 }
 
+//////////////////////////////////////////////////////////////////
+STRING MgServerDescribeSchema::GetSerializedXml(FdoFeatureSchemaCollection* fdoSchemaCol, FdoXmlFlags* flags)
+{
+    STRING serializedXml;
 
+    MG_FEATURE_SERVICE_TRY()
+    CHECKNULL(fdoSchemaCol, L"MgServerDescribeSchema.GetSerializedXml");
+
+    FdoIoMemoryStreamP fmis = FdoIoMemoryStream::Create();
+    CHECKNULL((FdoIoMemoryStream*)fmis, L"MgServerDescribeSchema.GetSerializedXml");
+
+    // Write to memory stream
+    fdoSchemaCol->WriteXml(fmis,flags);
+    fmis->Reset(); // TODO: We should not be calling reset here. A defect in FDO should be fixed.
+
+    FdoInt64 len = fmis->GetLength();
+    FdoByte *bytes = new FdoByte[(size_t)len];
+    CHECKNULL(bytes, L"MgServerDescribeSchema.GetSerializedXml");
+
+    fmis->Read(bytes, (FdoSize)len);
+
+    Ptr<MgByteSource> byteSource = new MgByteSource((BYTE_ARRAY_IN)bytes, (INT32)len);
+    byteSource->SetMimeType(MgMimeType::Xml);
+    Ptr<MgByteReader> byteReader = byteSource->GetReader();
+
+    string out = MgUtil::GetTextFromReader(byteReader);
+    serializedXml = MgUtil::MultiByteToWideChar(out);
+
+    delete [] bytes;
+
+    MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDescribeSchema.GetSerializedXml")
+
+    return serializedXml;
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 MgStringCollection* MgServerDescribeSchema::GetSchemas(MgResourceIdentifier* resource)
 {

Modified: trunk/MgDev/Server/src/Services/Feature/ServerDescribeSchema.h
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerDescribeSchema.h	2010-11-21 21:03:39 UTC (rev 5396)
+++ trunk/MgDev/Server/src/Services/Feature/ServerDescribeSchema.h	2010-11-23 05:54:03 UTC (rev 5397)
@@ -48,6 +48,7 @@
     MgStringCollection* GetClasses(MgResourceIdentifier* resource, CREFSTRING schemaName);
     MgClassDefinition*  GetClassDefinition(MgResourceIdentifier* resource, CREFSTRING schemaName, CREFSTRING className, bool serialize = true);
     STRING SchemaToXml(MgFeatureSchemaCollection* schema);
+    STRING SchemaToXml(MgFeatureSchemaCollection* schema, CREFSTRING namespacePrefix, CREFSTRING namespaceUrl);
     MgFeatureSchemaCollection* XmlToSchema(CREFSTRING xml);
     MgClassDefinitionCollection* GetIdentityProperties(MgResourceIdentifier* resource, CREFSTRING schemaName, MgStringCollection* classNames);
 
@@ -55,6 +56,7 @@
     FdoFeatureSchemaCollection* DescribeFdoSchema(MgResourceIdentifier* resource,
         CREFSTRING schemaName, MgStringCollection* classNames, bool& classNameHintUsed);
     STRING GetSerializedXml(FdoFeatureSchemaCollection* fdoSchemaCol);
+    STRING GetSerializedXml(FdoFeatureSchemaCollection* fdoSchemaCol, FdoXmlFlags* flags);
     bool GetIdentityProperties(CREFSTRING className,
         FdoClassCollection* classCol, MgPropertyDefinitionCollection* idProps);
 

Modified: trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp	2010-11-21 21:03:39 UTC (rev 5396)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp	2010-11-23 05:54:03 UTC (rev 5397)
@@ -1156,17 +1156,17 @@
 
 //////////////////////////////////////////////////////////////////
 /// \brief
-/// Retrieves schema information about a set of feature classes for a given feature source.
+/// Retrieves schema information about a set of feature classes for a given feature source with specified namespace prefix and url.
 ///
 /// <!-- Syntax in .Net, Java, and PHP -->
 /// \htmlinclude DotNetSyntaxTop.html
-/// virtual MgByteReader CreateFeatureSource(MgResourceIdentifier featureSourceId, MgStringCollection featureClasses);
+/// virtual MgByteReader DescribeWfsFeatureType(MgResourceIdentifier featureSourceId, MgStringCollection featureClasses, string namespacePrefix, string namespaceUrl);
 /// \htmlinclude SyntaxBottom.html
 /// \htmlinclude JavaSyntaxTop.html
-/// virtual MgByteReader CreateFeatureSource(MgResourceIdentifier featureSourceId, MgStringCollection featureClasses);
+/// virtual MgByteReader DescribeWfsFeatureType(MgResourceIdentifier featureSourceId, MgStringCollection featureClasses, string namespacePrefix, string namespaceUrl);
 /// \htmlinclude SyntaxBottom.html
 /// \htmlinclude PHPSyntaxTop.html
-/// virtual MgByteReader CreateFeatureSource(MgResourceIdentifier featureSourceId, MgStringCollection featureClasses);
+/// virtual MgByteReader DescribeWfsFeatureType(MgResourceIdentifier featureSourceId, MgStringCollection featureClasses, string namespacePrefix, string namespaceUrl);
 /// \htmlinclude SyntaxBottom.html
 ///
 /// \param featureSourceId (MgResourceIdentifier)
@@ -1177,12 +1177,18 @@
 /// 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 namespacePrefix (String/string)
+/// A string identifying the namespace prefix in the output xml
+/// \param namespaceUrl (String/string)
+/// A string idenyifying the namespace url in the output xml
 ///
 /// \return
 /// Returns an MgByteReader containing the XML schema.
 ///
 MgByteReader* MgServerFeatureService::DescribeWfsFeatureType(MgResourceIdentifier* featureSourceId,
-                                                             MgStringCollection* featureClasses)
+                                                             MgStringCollection* featureClasses,
+                                                             CREFSTRING namespacePrefix,
+                                                             CREFSTRING namespaceUrl)
 {
     MG_LOG_TRACE_ENTRY(L"MgServerFeatureService::DescribeWfsFeatureType()");
 
@@ -1271,7 +1277,7 @@
         fsc = dfsc;
     }
 
-    STRING sch = SchemaToXml(fsc);
+    STRING sch = SchemaToXml(fsc, namespacePrefix, namespaceUrl);
 
     string utfsch = MgUtil::WideCharToMultiByte(sch);
 
@@ -1285,49 +1291,13 @@
     return byteReader.Detach();
 }
 
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////
-/// \brief
-/// Retrieves schema informationabout a set of feature classes for a given feature source  with specified format.
+///////////////////////////////////////////////////////////////////////////
+/// This method has been deprecated. Use the above method.
 ///
-///
-/// <!-- 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.
-///
 MgByteReader* MgServerFeatureService::DescribeWfsFeatureType(MgResourceIdentifier* featureSourceId,
-                                                             MgStringCollection* featureClasses,
-                                                             CREFSTRING outputFormat)
+                                                             MgStringCollection* featureClasses)
 {
-    throw new MgNotImplementedException(
-    L"MgServerFeatureService::DescribeWfsFeatureType",
-    __LINE__, __WFILE__, NULL, L"", NULL);
-
-    return NULL; // to make some compiler happy
+    return DescribeWfsFeatureType(featureSourceId, featureClasses, L"", L"");
 }
 
 
@@ -1490,7 +1460,15 @@
     return msds.SchemaToXml(schema);
 }
 
+//////////////////////////////////////////////////////////////////
+STRING MgServerFeatureService::SchemaToXml(MgFeatureSchemaCollection* schema, CREFSTRING namespacePrefix, CREFSTRING namespaceUrl)
+{
+    MG_LOG_TRACE_ENTRY(L"MgServerFeatureService::SchemaToXml()");
 
+    MgServerDescribeSchema msds;
+    return msds.SchemaToXml(schema, namespacePrefix, namespaceUrl);
+}
+
 //////////////////////////////////////////////////////////////////
 MgFeatureSchemaCollection* MgServerFeatureService::XmlToSchema(CREFSTRING xml)
 {

Modified: trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.h
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.h	2010-11-21 21:03:39 UTC (rev 5396)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.h	2010-11-23 05:54:03 UTC (rev 5397)
@@ -837,7 +837,7 @@
 
     //////////////////////////////////////////////////////////////////
     /// <summary>
-    /// Retrieves schema information about a set of feature classes for a given feature source.
+    /// Retrieves schema information about a set of feature classes for a given feature source with specified namespace prefix and url.
     /// </summary>
     /// <param name="featureSourceId">Input
     /// The resource identifier defining the
@@ -849,40 +849,27 @@
     /// retrieve schema information. If this collection is null or empty, information
     /// is returned for all feature classes.
     /// </param>
-    /// <returns>
-    /// Returns an MgByteReader containing the XML schema.
-    /// </returns>
-    ///
-    MgByteReader* DescribeWfsFeatureType(MgResourceIdentifier* featureSourceId,
-                                         MgStringCollection* featureClasses);
-
-    //////////////////////////////////////////////////////////////////
-    /// <summary>
-    /// Retrieves schema information about a set of feature classes for a given feature source with specified output format.
-    /// </summary>
-    /// <param name="featureSourceId">Input
-    /// The resource identifier defining the
-    /// location of the feature source in
-    /// the repository.
+    /// <param name="namespacePrefix">Input
+    /// A string identifying the namespace prefix in the output xml
     /// </param>
-    /// <param name="featureClasses">Input
-    /// 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 name="namespaceUrl">Input
+    /// A string idenyifying the namespace url in the output xml
     /// </param>
-    /// <param name="outputFormat">Input
-    /// 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
-    /// </param>
     /// <returns>
     /// Returns an MgByteReader containing the XML schema.
     /// </returns>
     ///
     MgByteReader* DescribeWfsFeatureType(MgResourceIdentifier* featureSourceId,
                                          MgStringCollection* featureClasses,
-                                         CREFSTRING outputFormat);
+                                         CREFSTRING namespacePrefix,
+                                         CREFSTRING namespaceUrl);
 
+    ///////////////////////////////////////////////////////////////////////////
+    /// This method has been deprecated. Use the above method.
+    ///
+    MgByteReader* DescribeWfsFeatureType(MgResourceIdentifier* featureSourceId,
+                                         MgStringCollection* featureClasses);
+
     //////////////////////////////////////////////////////////////////
     /// <summary>
     /// Retrieves feature information based on the supplied criteria with specified output format.
@@ -1055,6 +1042,8 @@
         CREFSTRING schemaName, CREFSTRING className, REFSTRING schemaHash,
         Ptr<MgFeatureSchema>& schemaFound, Ptr<MgClassDefinition>& classFound);
     void FeatureSourceToString(MgResourceIdentifier* resource, string& resourceContent);
+    //This method just used for OGC WFS certification
+    STRING SchemaToXml(MgFeatureSchemaCollection* schema, CREFSTRING namespacePrefix, CREFSTRING namespaceUrl);
 };
 
 #endif

Modified: trunk/MgDev/Web/src/HttpHandler/HttpWfsDescribeFeatureType.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpWfsDescribeFeatureType.cpp	2010-11-21 21:03:39 UTC (rev 5396)
+++ trunk/MgDev/Web/src/HttpHandler/HttpWfsDescribeFeatureType.cpp	2010-11-23 05:54:03 UTC (rev 5397)
@@ -125,8 +125,7 @@
                 Ptr<MgStringCollection> pFeatureClasses = new MgStringCollection();
                 pFeatureClasses->Add(((sSchemaHash.size()==0) ? sClass : sSchemaHash + _(":") + sClass)); //NOXLATE
 
-                Ptr<MgByteReader> response  = pFeatureService->DescribeWfsFeatureType(&idResource,pFeatureClasses);
-                //Ptr<MgByteReader> response  = pFeatureService->DescribeWfsFeatureType(&idResource,pFeatureClasses,sOutputFormat);
+                Ptr<MgByteReader> response  = pFeatureService->DescribeWfsFeatureType(&idResource, pFeatureClasses, sPrefix, oFeatureTypes.GetNamespaceUrl());
 
                 // Set the result
                 hResult->SetResultObject(response, response->GetMimeType());



More information about the mapguide-commits mailing list