将多个参数传递给WCF restful service [英] Pass multiple parameters to WCF restful service

查看:293
本文介绍了将多个参数传递给WCF restful service的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





i有一个WCF服务,有多个参数,比如



Hi,

i have a WCF service with multiple parameters like

[OperationContract]
 [WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json,BodyStyle=WebMessageBodyStyle.WrappedRequest, UriTemplate = "PutTestDataMulti")]
        string PutTestDataMulti(string id, Testclass fd);



对于上面的方法,我将发送一个类对象和一个id作为参数。



直到现在我已经实现了传递多个参数,如字符串,string,int等..并通过序列化数据传递一个类对象。但是没有好运传递类对象以及一个更多的参数,如上面提到的情况。



请让我知道如何使用C#webclient而不是jquery来实现它(如何将两个参数序列化为一个并将其传递给操作合同)或者还有其他任何方法来实现这一点。



提前致谢。



谢谢,



Vasanth


For the above method i will be sending a class object and an id as parameter.

Till now i have achieved passing multiple parameters like string,string,int etc.. and passing a class object by serializing the data. But no luck with passing class object along with one more parameter like the case mentioned above.

Please let me know how to achieve it using C# webclient not with jquery (how to serialize both the parameters into one and pass it to operation contract) or else is there any other way to achieve this.

Thanks in advance.

Thanks,

Vasanth

推荐答案

http://stackoverflow.com/questions/9381633/how-to-pass -multif-parameters-in-wcf-rest-service [ ^ ]





http://stackoverflow.com/questions/9381633/how-to-pass-multiple-parameters-in-wcf-rest-service[^]



[ ^ ]



问候,

Praveen

[^]

Regards,
Praveen


这篇关于将多个参数传递给WCF restful service的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆