[WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest)]
公司有一任务,将.net的接口由get请求改为post请求。我在方法上面采用了上述的配置。现在请求格式必须是json形式的。要将请求格式变为 param1=value1¶m2=value2 这样格式的,上面的配置应该怎样修改呢。
在线等待中,好心的大家帮帮忙......
没做过.net 的web,现在做WPF,但是我遇到问题现在已经不用中文问了。你可以用谷歌镜像搜英文,一般stackoverflow上的链接,都会给出很好的解决办法######
如搜:wcf how to post a request in json ,试了下有好多链接,你可以自己看看。
虽然不懂wcf和web,感觉这个链接应该是你要找的:http://stackoverflow.com/questions/9906931/wcf-make-a-post-request-with-a-parameters
######[OperationContract(Name = "GetUserList")] [WebInvoke(UriTemplate = "GetUserList?par1={UserID}&
par2={UserName}", ResponseFormat = WebMessageFormat.Json)]
public string GetUserList(string userID,string UserName)
{
}</pre>