发送一个Hashtable到WebService [英] Sending a Hashtable to a Webservice

查看:161
本文介绍了发送一个Hashtable到WebService的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着发送与通用键和值类型为一个asp.net web服务的项目清单。
我怎样才能做到这一点?
字典<字符串,字符串>我列表与LT试过> ,但这好好尝试的工作。我没有得到一个异常,但是当我在webserivice打破,我的集合为null。
数据看起来是这样的:
{数据:{字段类型:整型,isrequired:真的,isrequirederror:无效数据}}
但正如我所说,钥匙是通用的,有时也有更多的属性,有时没有。

Im trying to send a List of Items with generic Keys and Value Types to a asp.net webservice. How can i do this? I tried it with List<Dictionary<String, String>>, but this doens't work. I do not get an exception, but when i break in the webserivice, my collection is null. The Data could look like this: {"Data":{"fieldtype":"integer","isrequired":true,"isrequirederror":"Invalid Data"}}. But as i said, the Keys are generic, sometimes there are more properties, sometimes not.

THX很多

这后不能帮助我的BTW:
<一href=\"http://stackoverflow.com/questions/862271/how-to-send-a-hashtable-to-an-asmx-webservice\">http://stackoverflow.com/questions/862271/how-to-send-a-hashtable-to-an-asmx-webservice

This post couldn't help my btw: http://stackoverflow.com/questions/862271/how-to-send-a-hashtable-to-an-asmx-webservice

推荐答案

您将不得不使用SOA和WCF特别困难的时候,如果你想引入任何一种仿制药的服务 - 从序列化/反序列化的问题出发,完成互操作性问题。

You are going to have hard times with SOA and WCF in particular if you want to introduce any kind of generics in your service - starting from serialization/deserialization issues and finishing interoperability issues.

不要使用泛型参数。哈希表(或字典),使只在由于读/写操作的性能在进程的使用感。如果你想通过线路传输在这样的形式的东西,使用类似的结构如下:
对(字符串,字符串)的列表。

Don't use generic parameters. Hashtable (or Dictionary) makes sense only within in-process usage due to read/write operations performance. If you want to transmit something in such format over the wire, use something like the following structure: List of pairs (string, string).

这篇关于发送一个Hashtable到WebService的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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