我试图从浏览器访问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