SOAPを使わず、EBIのCGIを利用してもデータを取得できる。
EBI.WebClientクラス
using System; using System.Net; namespace EBI { public class WebClient { private const string ERROR_KEYWORD = "Error Information"; private const string FETCH_URL= "http://www.ebi.ac.uk/cgi-bin/dbfetch?db={0}&id={1}&format={2}&style={3}"; private System.Net.WebClient wc = new System.Net.WebClient(); public WebClient(){} /// Fetch entry with default settings. public string FetchEntry(string db, string id) { try { string result = wc.DownloadString(string.Format(FETCH_URL, db, id, "default", "default")); if (result.Contains(ERROR_KEYWORD)) return null; return result; } catch (NotSupportedException nse) { throw nse; } catch (WebException we) { throw we; } } } }
/// 呼び出しテスト /// public void FetchEntryTest() { EBI.WebClient wc = new EBI.WebClient(); string result = wc.FetchEntry("ensembltranscript", "ENST00000338386"); Console.WriteLine(result); // この場合はhtmlデータが得られる。 }