// Get Add to map information public void GetAddToMapInfoByID(string DocID) { _response = new CswSearchResponse(); StringBuilder sb = new StringBuilder(); if (DocID == null || DocID == "") { throw new ArgumentNullException(); } if (_catalog == null) { throw new NullReferenceException("Catalog not specified."); } if (_catalog.Capabilities == null) { throw new NullReferenceException("Catalog capabilities not initialized."); } if (_catalog.Profile == null) { throw new NullReferenceException("Catalog profile not specified."); } if (_catalog.Capabilities.GetRecordByID_GetURL == null || _catalog.Capabilities.GetRecordByID_GetURL.Length == 0) { sb.AppendLine(DateTime.Now + " GetRecordByID URL not specified for the catalog capabilities."); throw new NullReferenceException("GetRecordByID URL not specified for the catalog capabilities."); } CswProfile profile = _catalog.Profile; // generate request url string getRecordByIDBaseUrl = _catalog.Capabilities.GetRecordByID_GetURL; string requestUrl = profile.GenerateCSWGetMetadataByIDRequestURL(getRecordByIDBaseUrl, DocID); sb.AppendLine(DateTime.Now + " GetRecordsById request URL : " + requestUrl); if (_cswClient == null) { _cswClient = new CswClient(); } string responseText = _cswClient.SubmitHttpRequest("GET", requestUrl, ""); _response.ResponseXML = responseText; sb.AppendLine(DateTime.Now + " GetRecordsById response xml : " + responseText); CswRecord record = new CswRecord(DocID); profile.ReadCSWGetMetadataByIDResponse(responseText, record); if (record.MetadataResourceURL != null && record.MetadataResourceURL.Equals("") && profile.Name.Equals("terra catalog CSW 2.0.2 AP ISO")) { record.FullMetadata = responseText; } if (record == null) { throw new NullReferenceException("Record not populated."); } // check if full metadata or resourceURL has been returned bool hasFullMetadata = !(record.FullMetadata == null || record.FullMetadata == ""); bool hasResourceUrl = !(record.MetadataResourceURL == null || record.MetadataResourceURL == ""); if (!hasFullMetadata && !hasResourceUrl) { // throw new InvalidOperationException("Neither full metadata nor metadata resource URL was found for the CSW record."); } else if (!hasFullMetadata && record.MetadataResourceURL != null) { // need to load metadata from resource URL responseText = _cswClient.SubmitHttpRequest("GET", record.MetadataResourceURL, "", "", ""); record.FullMetadata = responseText; } // add record to the response CswRecords records = new CswRecords(); if (record != null) { records.Add(record.ID, record); } _response.Records = records; _mapServerUrl = record.MapServerURL; if (_mapServerUrl != null) sb.AppendLine(DateTime.Now + " Map Server Url : " + _mapServerUrl); writeLogMessage(sb.ToString()); }
/// <summary> /// Search CSW catalog using the provided criteria. Search result can be accessed by calling GetResponse(). /// </summary> public void Search() { try { _response = new CswSearchResponse(); StringBuilder sb = new StringBuilder(); if (_criteria == null) { sb.AppendLine(DateTime.Now + " Criteria not specified."); throw new NullReferenceException("Criteria not specified."); } if (_catalog == null) { sb.AppendLine(DateTime.Now + " Catalog not specified."); throw new NullReferenceException("Catalog not specified."); } if (_catalog.URL == null || _catalog.URL.Length == 0) { sb.AppendLine(DateTime.Now + " Catalog URL not specified."); throw new NullReferenceException("Catalog URL not specified."); } if (_catalog.Profile == null) { sb.AppendLine(DateTime.Now + " Catalog profile not specified."); throw new NullReferenceException("Catalog profile not specified."); } CswProfile profile = _catalog.Profile; // generate getRecords query string requestUrl = _catalog.Capabilities.GetRecords_PostURL; //Set Breakpoint to see transformed request (use xml viewer on tooltip variable) string requestQuery = profile.GenerateCSWGetRecordsRequest(_criteria); sb.AppendLine("Untransformed Request Query : " + profile.LastUntransformedGetRecordsRequest.InnerXml); // requestQuery = "<csw:GetCapabilities xmlns:csw=\"http://www.opengis.net/cat/csw/2.0.2\" request=\"GetCapabilities\" service=\"CSW\" version=\"2.0.2\"/>"; requestQuery = requestQuery.Replace("utf-16", "utf-8"); requestQuery = requestQuery.Replace("UTF-16", "UTF-8"); // submit search query if (_cswClient == null) { _cswClient = new CswClient(); } string responseText; sb.AppendLine(DateTime.Now + " Sending CSW GetRecords request to endpoint : " + requestUrl); sb.AppendLine("Request Query : " + requestQuery); if (!_catalog.Capabilities.GetRecords_IsSoapEndPoint) responseText = _cswClient.SubmitHttpRequest("POST", requestUrl, requestQuery); else responseText = _cswClient.SubmitHttpRequest("SOAP", requestUrl, requestQuery); // parse out csw search records CswRecords records = new CswRecords(); sb.AppendLine(DateTime.Now + " Response received : " + responseText); profile.ReadCSWGetRecordsResponse(responseText, records); sb.AppendLine(DateTime.Now + " Parsed GetRecords response."); // populate CSW response _response.ResponseXML = responseText; _response.Records = records; writeLogMessage(sb.ToString()); } catch (Exception e) { writeLogMessage(DateTime.Now + " " + e.ToString()); } }
private string BuildGetFeatureRequest(string url) { String[] s = url.Trim().Split('?'); //hardcode the version 1.0.0 (and thus assume it is also implemented by higher version wfs services) so we know what the response looks like url = s[0] + "?request=GetCapabilities&service=WFS&version=1.0.0"; CswClient client = new CswClient(); String response = client.SubmitHttpRequest("GET", url, ""); XmlDocument xmlDocument = new XmlDocument(); try { xmlDocument.LoadXml(response); } catch (XmlException xmlEx) { } XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmlDocument.NameTable); nsmgr.AddNamespace("wfs", "http://www.opengis.net/wfs"); XmlNode shapeZip = xmlDocument.SelectSingleNode(@"/wfs:WFS_Capabilities/wfs:Capability/wfs:Request/wfs:GetFeature/wfs:ResultFormat/wfs:SHAPE-ZIP",nsmgr); if (shapeZip == null) throw new Exception("This WFS service does not support getting features in the required SHAPE-ZIP ResultFormat."); XmlNodeList featureTypeNames = xmlDocument.SelectNodes(@"/wfs:WFS_Capabilities/wfs:FeatureTypeList/wfs:FeatureType/wfs:Name",nsmgr); if (featureTypeNames != null && featureTypeNames.Count > 0) { //Convert to array in order to Join string[] typenames = new string[featureTypeNames.Count]; for(int i = 0;i<featureTypeNames.Count;i++) { typenames[i]= featureTypeNames[i].InnerText; } //1.1.0 because of 5 param BBOX string getFeatureUrl = s[0] + @"?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=" + String.Join(",",typenames) + "&outputFormat=shape-zip"; //'SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME='+layers+'&BBOX='+xmin+","+ymin+","+xmax+","+ymax+'&outputFormat=shape-zip') //getFeatureUrl = getFeatureUrl + @"&BBOX=0,0,350000,650000,EPSG:28992"; getFeatureUrl = String.Format("{0}&{1}", getFeatureUrl, ComposeBBOXkeyValuePair()); return getFeatureUrl; } else { throw new Exception("This WFS service does not return any featuretypes."); } }
/// <summary> /// Retrieve metadata from CSW service by its ID /// </summary> /// <param name="DocID">Metadata document ID</param> public bool GetMetadataByID(string DocID, bool bApplyTransform) { _response = new CswSearchResponse(); StringBuilder sb = new StringBuilder(); if (DocID == null || DocID == "") { throw new ArgumentNullException(); } if (_catalog == null) { throw new NullReferenceException("Catalog not specified."); } if (_catalog.Capabilities == null) { throw new NullReferenceException("Catalog capabilities not initialized."); } if (_catalog.Profile == null) { throw new NullReferenceException("Catalog profile not specified."); } if (_catalog.Capabilities.GetRecordByID_GetURL == null || _catalog.Capabilities.GetRecordByID_GetURL.Length == 0) { throw new NullReferenceException("GetRecordByID URL not specified for the catalog capabilities."); } CswProfile profile = _catalog.Profile; // generate request url string getRecordByIDBaseUrl = _catalog.Capabilities.GetRecordByID_GetURL; string requestUrl = profile.GenerateCSWGetMetadataByIDRequestURL(getRecordByIDBaseUrl, DocID); sb.AppendLine(DateTime.Now + " GetRecordsById request URL : " + requestUrl); if (_cswClient == null) { _cswClient = new CswClient(); } string responseText = _cswClient.SubmitHttpRequest("GET", requestUrl, ""); _response.ResponseXML = responseText; sb.AppendLine(DateTime.Now + " GetRecordsById response xml : " + responseText); CswRecord record = new CswRecord(DocID); bool isTransformed = false; if (bApplyTransform) { isTransformed = profile.TransformCSWGetMetadataByIDResponse(responseText, record); if(isTransformed) sb.AppendLine(DateTime.Now + " Transformed xml : " + record.FullMetadata); } else { record.FullMetadata = responseText; } /*if (!isTransformed) { XmlDocument responseXml = new XmlDocument(); try { responseXml.LoadXml(responseText); } catch (XmlException xmlEx) { throw new XmlException("Error occurred \r\n" + xmlEx.Message); } record.FullMetadata = responseXml.FirstChild.InnerText ; }*/ // add record to the response CswRecords records = new CswRecords(); if (record != null) { records.Add(record.ID, record); } _response.Records = records; _mapServerUrl = record.MapServerURL; if (_mapServerUrl != null) sb.AppendLine(DateTime.Now + " Map Server Url : " + _mapServerUrl); writeLogMessage(sb.ToString()); return isTransformed; }
/// <summary> /// Add WCS map service layer to map /// </summary> /// <param name="msi">Map service information</param> private void AddLayerWCS(pdok4arcgis.MapServiceInfo msi, Boolean fromServerUrl) { if (msi == null) { throw new ArgumentNullException(); } try { string _mapServerUrl = AppendQuestionOrAmpersandToUrlString(msi.Server); // append serviceParam to server url // todo: does msi.ServiceParam have a leading "?" or "&"? if (msi.ServiceParam.Length > 0 && !fromServerUrl) { _mapServerUrl = _mapServerUrl + msi.ServiceParam; _mapServerUrl = AppendQuestionOrAmpersandToUrlString(_mapServerUrl); } /* IPropertySet propertySet = new PropertySetClass(); propertySet.SetProperty("URL", url); IMxDocument mxDoc = (IMxDocument)m_application.Document; IMap map = (IMap)mxDoc.FocusMap; IActiveView activeView = (IActiveView)map; IWCSLayer wcsLayer = new WCSLayerClass(); // IWCSCoverageDescription // IWCSGroupLayer wcsGroupLayer = (IWCSGroupLayer)new WCSMapLayerClass(); IWCSConnectionName wcsConnectionName = new WCSConnectionName(); wcsConnectionName.ConnectionProperties = propertySet; // connect to wms service IDataLayer dataLayer; bool connected = false; try { dataLayer = (IDataLayer) wcsLayer; IName connName = (IName) wcsConnectionName; connected = dataLayer.Connect(connName); } catch (Exception ex) { ShowErrorMessageBox(StringResources.ConnectToMapServiceFailed + "\r\n" + ex.Message); connected = false; } if (!connected) return; // get service description out of the layer. the service description contains // information about the wms categories and layers supported by the service // IWCSServiceDescription wcsServiceDesc = wcsLayer.WMSServiceDescription; IWCSCoverageDescription wcsCoverageDesc; ILayer newLayer; ILayer layer; IWCSLayer newWcsLayer; // IWCSGroupLayer newWmsGroupLayer; // add to focus map // map.AddLayer(layer); return;*/ // MapServiceInfo msi = new MapServiceInfo(); String[] s = _mapServerUrl.Trim().Split('?'); _mapServerUrl = s[0] + "?request=GetCapabilities&service=WCS"; CswClient client = new CswClient(); String response = client.SubmitHttpRequest("GET", _mapServerUrl, ""); XmlDocument xmlDocument = new XmlDocument(); try { xmlDocument.LoadXml(response); } catch (XmlException xmlEx) { } XmlNodeList contentMetadata = xmlDocument.GetElementsByTagName("ContentMetadata"); if (contentMetadata != null && contentMetadata.Count > 0) { XmlNodeList coverageList = contentMetadata.Item(0).ChildNodes; foreach (XmlNode coverage in coverageList) { XmlNodeList nodes = coverage.ChildNodes; foreach(XmlNode node in nodes) { if (node.Name.ToLower().Equals("name")) { _mapServerUrl = s[0] + "?request=GetCoverage&service=WCS&format=GeoTIFF&coverage=" + node.InnerText; try{ String filePath = client.SubmitHttpRequest("DOWNLOAD", _mapServerUrl, ""); AddAGSService(filePath); } catch(Exception e){ ShowErrorMessageBox("WCS service with no GeoTiff interface"); return; } } } } } //msi.Server = s[0]; // AddLayerWCS(msi, true); } catch (Exception ex) { // ShowErrorMessageBox(StringResources.AddWcsLayerFailed + "\r\n" + ex.Message); } }
private void AddMapServiceLayer(CswRecord cswrecord, string sldForWMS) { MapServiceInfo msinfo = new MapServiceInfo(); msinfo.Server = cswrecord.MapServerURL; msinfo.Service = cswrecord.ServiceName; msinfo.ServiceType = cswrecord.Protocol; CswProfile.ParseServiceInfoFromUrl(msinfo, cswrecord.MapServerURL, cswrecord.Protocol); switch (cswrecord.Protocol.ToUpper()) { case "WMS": case "OGC:WMS": AddLayerWMS(msinfo, true,sldForWMS); break; case "WCS": case "OGC:WCS": AddLayerWCS(cswrecord.MapServerURL); break; case "OGC:WMTS"://"TMS": case "UKST": AddLayerWMTS(cswrecord);//AddLayerTMS(cswrecord); break; case "WFS": case "OGC:WFS": AddLayerWFS(cswrecord); break; case "AGS": string url = String.Empty; url = cswrecord.MapServerURL; if (url.ToLower().Contains("arcgis/rest")) { url = url + "?f=lyr"; CswClient client = new CswClient(); AddAGSService(client.SubmitHttpRequest("DOWNLOAD", url, "")); } else { AddAGSService(url); } break; case "AIMS": AddLayerArcIMS(msinfo); break; default: MessageBox.Show(String.Format("Adding data of type {0} is not implemented yet.",cswrecord.Protocol.ToUpper())); break; } }
private void AddLayerWCS(string url) { // MapServiceInfo msi = new MapServiceInfo(); String[] s = url.Trim().Split('?'); url = s[0] + "?request=GetCapabilities&service=WCS"; CswClient client = new CswClient(); String response = client.SubmitHttpRequest("GET", url, ""); XmlDocument xmlDocument = new XmlDocument(); try { xmlDocument.LoadXml(response); } catch (XmlException xmlEx) { } XmlNodeList contentMetadata = xmlDocument.GetElementsByTagName("wcs:Contents");//ContentMetadata if (contentMetadata != null && contentMetadata.Count > 0) { XmlNodeList coverageList = contentMetadata.Item(0).ChildNodes; foreach (XmlNode coverage in coverageList) { XmlNodeList nodes = coverage.ChildNodes; foreach (XmlNode node in nodes) { if (node.Name.ToLower().Equals("ows:title"))//name { url = s[0] + "?request=GetCoverage&service=WCS&format=GeoTIFF&coverage=" + node.InnerText; try { String filePath = client.SubmitHttpRequest("DOWNLOAD", url, ""); AddAGSService(filePath); } catch (Exception e) { ShowErrorMessageBox("WCS service with no GeoTiff interface"); return; } } } } } else { /* contentMetadata = xmlDocument.GetElementsByTagName("CoverageSummary"); if (contentMetadata != null && contentMetadata.Count > 0) { XmlNodeList coverageList = contentMetadata.Item(0).ChildNodes; foreach (XmlNode coverage in coverageList) { if (coverage.Name.ToLower().Equals("identifier")) { url = s[0] + "?request=GetCoverage&service=WCS&format=GeoTIFF&coverage=" + coverage.InnerText; try { String filePath = client.SubmitHttpRequest("DOWNLOAD", url, ""); AddAGSService(filePath); } catch (Exception e) { ShowErrorMessageBox("WCS service with no GeoTiff interface"); return; } } } }*/ } }
/// <summary> /// Search CSW catalog using the provided criteria. Search result can be accessed by calling GetResponse(). /// </summary> public void Search() { try { _response = new CswSearchResponse(); StringBuilder sb = new StringBuilder(); if (_criteria == null) { sb.AppendLine(DateTime.Now + " Criteria not specified."); throw new NullReferenceException("Criteria not specified."); } if (_catalog == null) { sb.AppendLine(DateTime.Now + " Catalog not specified."); throw new NullReferenceException("Catalog not specified."); } if (_catalog.URL == null || _catalog.URL.Length == 0) { sb.AppendLine(DateTime.Now + " Catalog URL not specified."); throw new NullReferenceException("Catalog URL not specified."); } if (_catalog.Profile == null) { sb.AppendLine(DateTime.Now + " Catalog profile not specified."); throw new NullReferenceException("Catalog profile not specified."); } CswProfile profile = _catalog.Profile; // generate getRecords query string requestUrl = _catalog.Capabilities.GetRecords_PostURL; //Set Breakpoint to see transformed request (use xml viewer on tooltip variable) string requestQuery = profile.GenerateCSWGetRecordsRequest(_criteria); sb.AppendLine("Untransformed Request Query : " + profile.LastUntransformedGetRecordsRequest.InnerXml); // requestQuery = "<csw:GetCapabilities xmlns:csw=\"http://www.opengis.net/cat/csw/2.0.2\" request=\"GetCapabilities\" service=\"CSW\" version=\"2.0.2\"/>"; requestQuery = requestQuery.Replace("utf-16", "utf-8"); requestQuery = requestQuery.Replace("UTF-16", "UTF-8"); // submit search query if (_cswClient == null) { _cswClient = new CswClient(); } string responseText; sb.AppendLine(DateTime.Now + " Sending CSW GetRecords request to endpoint : " + requestUrl); sb.AppendLine("Request Query : " + requestQuery); if (!_catalog.Capabilities.GetRecords_IsSoapEndPoint) { responseText = _cswClient.SubmitHttpRequest("POST", requestUrl, requestQuery); } else { responseText = _cswClient.SubmitHttpRequest("SOAP", requestUrl, requestQuery); } // parse out csw search records CswRecords records = new CswRecords(); sb.AppendLine(DateTime.Now + " Response received : " + responseText); profile.ReadCSWGetRecordsResponse(responseText, records); sb.AppendLine(DateTime.Now + " Parsed GetRecords response."); // populate CSW response _response.ResponseXML = responseText; _response.Records = records; writeLogMessage(sb.ToString()); } catch (Exception e) { writeLogMessage(DateTime.Now + " " + e.ToString()); } }
// Get Add to map information public void GetAddToMapInfoByID(string DocID) { _response = new CswSearchResponse(); StringBuilder sb = new StringBuilder(); if (DocID == null || DocID == "") { throw new ArgumentNullException(); } if (_catalog == null) { throw new NullReferenceException("Catalog not specified."); } if (_catalog.Capabilities == null) { throw new NullReferenceException("Catalog capabilities not initialized."); } if (_catalog.Profile == null) { throw new NullReferenceException("Catalog profile not specified."); } if (_catalog.Capabilities.GetRecordByID_GetURL == null || _catalog.Capabilities.GetRecordByID_GetURL.Length == 0) { sb.AppendLine(DateTime.Now + " GetRecordByID URL not specified for the catalog capabilities."); throw new NullReferenceException("GetRecordByID URL not specified for the catalog capabilities."); } CswProfile profile = _catalog.Profile; // generate request url string getRecordByIDBaseUrl = _catalog.Capabilities.GetRecordByID_GetURL; string requestUrl = profile.GenerateCSWGetMetadataByIDRequestURL(getRecordByIDBaseUrl, DocID); sb.AppendLine(DateTime.Now + " GetRecordsById request URL : " + requestUrl); if (_cswClient == null) { _cswClient = new CswClient(); } string responseText = _cswClient.SubmitHttpRequest("GET", requestUrl, ""); _response.ResponseXML = responseText; sb.AppendLine(DateTime.Now + " GetRecordsById response xml : " + responseText); CswRecord record = new CswRecord(DocID); profile.ReadCSWGetMetadataByIDResponse(responseText, record); if (record.MetadataResourceURL != null && record.MetadataResourceURL.Equals("") && profile.Name.Equals("terra catalog CSW 2.0.2 AP ISO")) { record.FullMetadata = responseText; } if (record == null) { throw new NullReferenceException("Record not populated."); } // check if full metadata or resourceURL has been returned bool hasFullMetadata = !(record.FullMetadata == null || record.FullMetadata == ""); bool hasResourceUrl = !(record.MetadataResourceURL == null || record.MetadataResourceURL == ""); if (!hasFullMetadata && !hasResourceUrl) { // throw new InvalidOperationException("Neither full metadata nor metadata resource URL was found for the CSW record."); } else if (!hasFullMetadata && record.MetadataResourceURL != null) { // need to load metadata from resource URL responseText = _cswClient.SubmitHttpRequest("GET", record.MetadataResourceURL, "", "", ""); record.FullMetadata = responseText; } // add record to the response CswRecords records = new CswRecords(); if (record != null) { records.Add(record.ID, record); } _response.Records = records; _mapServerUrl = record.MapServerURL; if (_mapServerUrl != null) { sb.AppendLine(DateTime.Now + " Map Server Url : " + _mapServerUrl); } writeLogMessage(sb.ToString()); }
/// <summary> /// Retrieve metadata from CSW service by its ID /// </summary> /// <param name="DocID">Metadata document ID</param> public bool GetMetadataByID(string DocID, bool bApplyTransform) { _response = new CswSearchResponse(); StringBuilder sb = new StringBuilder(); if (DocID == null || DocID == "") { throw new ArgumentNullException(); } if (_catalog == null) { throw new NullReferenceException("Catalog not specified."); } if (_catalog.Capabilities == null) { throw new NullReferenceException("Catalog capabilities not initialized."); } if (_catalog.Profile == null) { throw new NullReferenceException("Catalog profile not specified."); } if (_catalog.Capabilities.GetRecordByID_GetURL == null || _catalog.Capabilities.GetRecordByID_GetURL.Length == 0) { throw new NullReferenceException("GetRecordByID URL not specified for the catalog capabilities."); } CswProfile profile = _catalog.Profile; // generate request url string getRecordByIDBaseUrl = _catalog.Capabilities.GetRecordByID_GetURL; string requestUrl = profile.GenerateCSWGetMetadataByIDRequestURL(getRecordByIDBaseUrl, DocID); sb.AppendLine(DateTime.Now + " GetRecordsById request URL : " + requestUrl); if (_cswClient == null) { _cswClient = new CswClient(); } string responseText = _cswClient.SubmitHttpRequest("GET", requestUrl, ""); _response.ResponseXML = responseText; sb.AppendLine(DateTime.Now + " GetRecordsById response xml : " + responseText); CswRecord record = new CswRecord(DocID); bool isTransformed = false; if (bApplyTransform) { isTransformed = profile.TransformCSWGetMetadataByIDResponse(responseText, record); if (isTransformed) { sb.AppendLine(DateTime.Now + " Transformed xml : " + record.FullMetadata); } } else { record.FullMetadata = responseText; } /*if (!isTransformed) * { * XmlDocument responseXml = new XmlDocument(); * try { responseXml.LoadXml(responseText); } * catch (XmlException xmlEx) * { * throw new XmlException("Error occurred \r\n" + xmlEx.Message); * } * record.FullMetadata = responseXml.FirstChild.InnerText ; * }*/ // add record to the response CswRecords records = new CswRecords(); if (record != null) { records.Add(record.ID, record); } _response.Records = records; _mapServerUrl = record.MapServerURL; if (_mapServerUrl != null) { sb.AppendLine(DateTime.Now + " Map Server Url : " + _mapServerUrl); } writeLogMessage(sb.ToString()); return(isTransformed); }
/// <summary> /// To retrieve informations about the CSW service. /// </summary> /// <remarks> /// </remarks> /// <param name="param1">capabilities baseurl</param> /// <returns>Response the get capabilities url</returns> private string GetCapabilities(string capabilitiesurl) { try { CswClient client = new CswClient(); string response = client.SubmitHttpRequest("GET", capabilitiesurl, ""); //Console.WriteLine() XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(response); XmlNamespaceManager xmlnsManager = new XmlNamespaceManager(xmlDoc.NameTable); if (this.Profile.CswNamespace.Length <= 0) { this.Profile.CswNamespace = CswProfiles.DEFAULT_CSW_NAMESPACE; } xmlnsManager.AddNamespace("ows", "http://www.opengis.net/ows"); xmlnsManager.AddNamespace("csw", this.Profile.CswNamespace); xmlnsManager.AddNamespace("wrs10", "http://www.opengis.net/cat/wrs/1.0"); xmlnsManager.AddNamespace("wrs", "http://www.opengis.net/cat/wrs"); xmlnsManager.AddNamespace("xlink", "http://www.w3.org/1999/xlink"); xmlnsManager.AddNamespace("wcs", "http://www.opengis.net/wcs"); if (xmlDoc.SelectSingleNode("/csw:Capabilities|/wrs:Capabilities| /wrs10:Capabilities | /wcs:WCS_Capabilities", xmlnsManager) != null) return response; else return null; } catch (Exception ex) { throw ex; } }