首页 新闻 会员 周边

webservice传参问题

0
悬赏园豆:15 [待解决问题]

我有一个webservice如下
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public void PostCallBack(string action, string flowId, string status, string flowType)
{
var result = new CallbackModel();
string res_json = JsonConvert.SerializeObject(result);
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType = "application/json; charset=utf-8";
HttpContext.Current.Response.Write(res_json);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();

    }

请求这个webservice是没有传递 flowId 这个参数,原本需要传4个参数的,只传了3个。
这种情况要想只传3个参数也能进入我的webservice,有什么办法,不删webservice的参数也不加请求的参数

COLOz的主页 COLOz | 初学一级 | 园豆:166
提问于:2020-11-18 16:41
< >
分享
所有回答(1)
0

在写一个只有3个参数的webserver方法怎么样,或者传null

会长 | 园豆:12401 (专家六级) | 2020-11-18 16:47

我试过public void PostCallBack(string action=null, string flowId=null, string status=null, string flowType=null),不行,如果又有另外一个参数如:action也可以填,那我不是要重载两个吗?

支持(0) 反对(0) COLOz | 园豆:166 (初学一级) | 2020-11-18 16:49
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册