2011-08-18 153 views
1

我們正在設計具有多語言界面的報告。我們開發了返回特定單詞翻譯的網絡服務。有沒有辦法通過Web服務或特定的URL來調用報告中使用的標籤的翻譯。SSRS呼叫外部URL /網絡服務

例如,像

http://domain.com/translate?w=WORD-TO-Translate&L=ar 

回答

0

我會建議創建一個自定義組件會做到這一點,但是當它從報表生成器的工作原理似乎不從我的SSRS服務器的工作。我想知道是否有一個問題從自定義程序集連接到Web服務(或者我做錯了)。相反,我會告訴你another method做翻譯。

如果你想拿起定製組裝方式,這裏是我使用的代碼:

using System; 
using System.IO; 
using System.Net; 

namespace SSRSCustomAssembly 
{ 
    public class Translate 
    { 
     public static string TranslateString(string input, string locale) 
     { 
      string url = string.Format("http://domain.com/translate?w={0}&L={1}", input, locale); 

      HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url); 
      req.Method = "GET"; 

      HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); 
      StreamReader sr = new StreamReader(resp.GetResponseStream()); 
      return sr.ReadToEnd(); 
     } 
    } 
} 

在報表中,只需添加一個參考組裝,由具有表達叫它: = SSRSCustomAssembly.Translate.TranslateString(「word」,「en」)