【问题标题】:pass out parameter to json webservice将参数传递给 json webservice
【发布时间】:2016-11-04 16:42:10
【问题描述】:

我有一个 Json WCF 服务我的方法请求输出参数我如何从客户端传递输出参数

[ServiceContract]
public interface ITestServices
{
    [OperationContract]
    [WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped, Method = "POST", UriTemplate = "GetPerson", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
    Person GetPerson(out ResponseStatus ResponseStatus, int PersonID);
}

【问题讨论】:

  • 我修复了这个问题尝试 {$.ajax({type: "POST",url:localhost:55566/TestServices.svc/GetPerson", data: { "ResponseStatus": null ,"PersonID": "789797" }, contentType:"application/json; charset=utf-8", dataType: "json",success:function (data){$("#divItems").html(JSON.stringify(data));}, error: function (错误) {$("#divItems").html(error.responseText);}});} 捕获 (e) {$("#divItems").html(e.message);}

标签: c# json wcf parameters out


【解决方案1】:

WCF 提供了一个可使用 SOAP 或 REST Web 服务的接口,它没有任何物理能力来处理无参数。

【讨论】:

    猜你喜欢
    • 2011-07-23
    • 2014-10-01
    • 1970-01-01
    • 2023-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多