在REST Web服务输入数组 [英] Input an array in the Rest Web service
问题描述
我创造在C#中的REST Web服务,需要采取项目的列表(即活动列表)。
I am creating a REST Web service in C# and need to take a list of item (e.g. activity list).
我们怎么可以把一个数组作为输入REST Web服务的方法? 什么是最终的URI,将这样的方法来创建?
How can we take an array as input in Rest Web Service method? What would be final URI that will be created for such method?
推荐答案
有关我所知道的(我用Java开发的REST服务与泽西库),最终的URI不受参数传递给类型服务。因此,URI会像 http://asite.com/service/activitylist
。
For what I know (I developed ReST services in Java with the Jersey library), the final URI is not affected by the type of the parameters you pass to the service. So the URI would be something like http://asite.com/service/activitylist
.
那么对于实现(在Java中,也许你可以尝试寻找在C#中的REST实现库),在客户端我会把我的参数(任何类型,数组太)在表格
对象(新泽西州),它与我的要求发送。
然后在我的服务,我将使用注释 @FormParam
访问我的参数,最后正常处理他们在我的服务。
Then for the implementation (in Java, maybe you could try to look for a REST implementation library in C#), in the client I would put my parameters (any type, arrays too) in a Form
object (Jersey) and send it with my request.
Then in my service I would access my parameters using the annotation @FormParam
and finally process them normally in my service.
希望它帮助。
这篇关于在REST Web服务输入数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!