К сожалению, нет способа динамически делать запросы классом. Вы должны запрограммировать его через fdl-файл. Чтобы добавить сервис (например, WFS), вы можете использовать код ниже.
IWorkspaceFactory factory = (IWorkspaceFactory)new FMEWorkspaceFactoryClass();
IFeatureWorkspace workspace = (IFeatureWorkspace)factory.OpenFromFile("d:\test", 0);
IFeatureDataset fds = workspace.OpenFeatureDataset("name.fdl");
Ура!
PS: вы пытались использовать интерфейс IWFSServer ? Я использовал функциональность DI в одном из моих предыдущих проектов для экспорта данных в формат GML с использованием QuickExport . Вы можете попробовать использовать QuickImport и выбрать WFS в качестве источника. Я присматриваю код QuickExport для вашей справки ...
Friend Sub Export2GML()
Dim pGPMessages As IGPMessages
'Dim pGPMessage As IGPMessage
Dim pGPEnvMgr As IGPEnvironmentManager
Dim pGPEnv_CoordSys As IGPEnvironment
Dim pGPEnv_Extent As IGPEnvironment
Dim pGPCOMHelper As IGPComHelper
Dim pGPToolbox As IGPToolbox
Dim pGPTool As IGPTool
Dim pParameter As IGPParameter
Dim pParameterEdit As IGPParameterEdit
Dim pDataType As IGPDataType
Dim pToolboxWorkspaceFactory As IWorkspaceFactory
Dim pToolboxWorkspace As IToolboxWorkspace
Dim pParamArray As IArray = New ArrayClass
Dim pProgressTracker As ITrackCancel
Dim pDSNames As IEnumDatasetName
Dim pDSN As IDatasetName
Dim TempWSPath As String = String.Empty
Dim Inv_Layer_Names As String = String.Empty
Try
OS_Layer_Names = String.Empty
'Get all layer names from the scratch PGDB
TempWSPath = pTempWS.PathName
pDSNames = pTempWS.DatasetNames(esriDatasetType.esriDTFeatureClass)
pDSNames.Reset()
pDSN = pDSNames.Next
While Not pDSN Is Nothing
If pDSN.Name.Contains("X") Or pDSN.Name.Contains("Y") Then
'If pDSN.Name.Contains("_OS") Then
' OS Layers present, export them seperately
OS_Layer_Names &= TempWSPath & "\" & pDSN.Name & "; "
Else
' Inventory layer
Inv_Layer_Names &= TempWSPath & "\" & pDSN.Name & "; "
End If
pDSN = pDSNames.Next
End While
'gputils = New GPUtilities
pProgressTracker = New TrackCancel
'Get the environment manager
pGPCOMHelper = New GpDispatch
pGPEnvMgr = pGPCOMHelper.EnvironmentManager
'Set output coordinate system
pGPEnv_CoordSys = pGPEnvMgr.FindEnvironment("outputCoordinateSystem")
pGPEnv_CoordSys.Value = pGPEnv_CoordSys.DataType.CreateValue(ArcMap_INSTALL_DIR & "Coordinate Systems\Projected Coordinate Systems\National Grids\Your National Grid.prj")
'Set extents
pGPEnv_Extent = pGPEnvMgr.FindEnvironment("extent")
pGPEnv_Extent.Value = pGPEnv_Extent.DataType.CreateValue("sameAsInput")
'Create a toolbox workspace factory
pToolboxWorkspaceFactory = New ToolboxWorkspaceFactory
'Open toolbox workspace
pToolboxWorkspace = pToolboxWorkspaceFactory.OpenFromFile(ArcMap_INSTALL_DIR & "ArcToolbox\Toolboxes", 0)
'Open toolbox by name
pGPToolbox = pToolboxWorkspace.OpenToolbox("Data Interoperability Tools.tbx")
'If DI Toolbox is not found, means extensions were not installed
If pGPToolbox Is Nothing Then
MsgBox("Data Interoperability Toolbox not found!" & vbCrLf & "Please contact helpdesk.", MsgBoxStyle.Critical)
Throw New CustomException
End If
'Open tool by name
pGPTool = pGPToolbox.OpenTool("QuickExport") 'You need to use QuickImport
'Get parameters required for the tool
pParamArray = pGPTool.ParameterInfo
If Not (Inv_Layer_Names Is Nothing Or String.IsNullOrEmpty(Inv_Layer_Names) Or Inv_Layer_Names = "") Then
'Remove trailing ";"
Inv_Layer_Names = Inv_Layer_Names.Remove(Inv_Layer_Names.LastIndexOf(";"))
'Set input parameters
pParameter = pParamArray.Element(0)
pParameterEdit = pParameter
pDataType = pParameter.DataType
pParameterEdit.Value = pDataType.CreateValue(Inv_Layer_Names)
'Set output parameters
pParameter = pParamArray.Element(1)
pParameterEdit = pParameter
pDataType = pParameter.DataType
pParameterEdit.Value = pDataType.CreateValue("GMLSF, " & FILE_STORAGE_PATH.Substring(0, FILE_STORAGE_PATH.LastIndexOf(".")) & ".gml")
'Validate input parameters
pGPMessages = pGPTool.Validate(pParamArray, True, Nothing)
'Execute tool for at least inventory layers
pGPTool.Execute(pParamArray, pProgressTracker, pGPEnvMgr, pGPMessages)
End If
Catch ex As Exception
Throw New CustomException(ex.Message, ex)
Finally
'Release resources
pGPMessages = Nothing
pParameterEdit = Nothing
pDataType = Nothing
pParameterEdit = Nothing
pParameter = Nothing
pParamArray = Nothing
pGPTool = Nothing
pGPToolbox = Nothing
pToolboxWorkspace = Nothing
pToolboxWorkspaceFactory = Nothing
pGPEnv_Extent = Nothing
pGPEnv_CoordSys = Nothing
pGPEnvMgr = Nothing
pGPCOMHelper = Nothing
pProgressTracker = Nothing
End Try
End Sub