我試圖從瀏覽器訪問WCF服務。我正在從我的瀏覽器發送GET請求到WCF服務。爲了供您參考,WCF服務的細節如下所示。配置來自Nifi的GET請求
服務合同的定義如下:
[ServiceContract]
public interface IBZTsoftsensor_WcfService {
[OperationContract]
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, UriTemplate = "json/?inputModel={inputModel}")]
string ExecuteModelJson(string inputModel);
}
而這個接口的實現如下:
public string ExecuteModelJson(string inputModel){
try
{
BZTsoftsensor_ModelInput input = JsonConvert.DeserializeObject<BZTsoftsensor_ModelInput>(inputModel);
var results = this.ExecuteModel(input);
return JsonConvert.SerializeObject(results);
}
catch (Exception ex)
{
return ex.Message;
}
}
當我從瀏覽器訪問該WCF服務與網址
http://localhost:8733/Design_Time_Addresses/WcfServiceLibrary1/Service1/json/?inputModel={"Pyro":"30.0","O2":"20.0"}
我的WCF服務正在成功響應。
但是,使用上述URL,當我配置GeTHTTP
Nifi處理器時,處理器正在對GET請求URL中的非法字符進行錯誤處理。
您能否告訴我 - 在使用GetHTTP處理器時,我必須在GET URL中做出什麼改變?
感謝您的指示。我對Nifi有點新鮮感。你能否建議我 - 我應該如何使用表達式語言。什麼是GetHTTP處理器的URL屬性值? – Pankesh
感謝您的指點。它現在有效! :) – Pankesh