向Web服务传递未知数量的参数 [英] Passing a web service an unknown number of parameters

查看:133
本文介绍了向Web服务传递未知数量的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对使用Web服务还比较陌生.我正在尝试创建一个将从ASP.Net表单接受数据的表单,该表单的输入控件是在运行时动态创建的,并且我没有传递多少控件值.

I'm relatively new to utilizing web services. I'm trying to create one that will be accepting data from a ASP.Net form whose input controls are created dynamically at runtime and I don't how many control values will be getting passed.

我想我将在表单上使用jQuery的serialize()来获取数据,但是Web服务对参数可以接受什么呢?我以为也许可以使用serializeArray(),但我仍然不知道JavaScript数组可以接受哪种类型的变量.

I'm thinking I'll be using jQuery's serialize() on the form to get the data, but what do I have the web service accept for a parameter? I thought maybe I could use serializeArray(), but still I don't know what type of variable to accept for the JavaScript array.

最后,我想我可能需要先使用数据创建一个简单的数据传输对象,然后再将其发送到Web服务.如果有更简单的方法或应该遵循的既定最佳实践,我就是不想走DTO路线.

Finally, I was thinking that I might need to create a simple data transfer object with the data before sending it along to the web service. I just didn't wanna go through with the DTO route if there was a much simpler way or an established best practice that I should follow.

在此先感谢您提供的任何指示,并告诉我我还不够清楚,或者您有任何疑问.

Thanks in advance for any direction you can provide and let me know I wasn't clear enough, or if you have any questions.

推荐答案

好吧,我创建了自己的数据传输对象,我猜想它始终是大脑解决方案的前沿,我只是认为可能存在公认的最佳实践关于如何处理此问题.

Well I went with creating my own data transfer object which I guess was always the front of brain solution, I was just thinking that there was probably a recognized best practice on how to handle this.

这篇关于向Web服务传递未知数量的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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