自定义对象的Web服务数组命名空间问题 [英] Web Service Array of Custom Objects Namespace Problem

查看:59
本文介绍了自定义对象的Web服务数组命名空间问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 

    我想知道是否有人可以提供帮助: 我从WebMethod返回一组自定义对象,一切似乎都很好。 问题是: 当我返回我的类的单个实例时,每个元素的XML元素名称空间不包含在输出中。 另一方面,如果我要返回同一个类的数组,则输出包含每个XML元素的完全限定名称空间。 这是设计还是我做错了。 我认为在输出时包含每个XML元素的完整命名空间是过分的。 如果它是一个单独的实例,一切都很好,如果它是同一个类的数组,它将返回完整的命名空间。 奇怪。

     I was wondering if someone can help:  I am returning an array of custom objects from a WebMethod and all seems well.  The problem is this:  When I return a single instance of my class, the XML element namespace for each element is NOT included in the output.  On the other hand, if I were to return an array of that same class, the output includes the fully qualified namespace for each XML element.  Is this by design or am I doing something wrong.  I think its overkill to include the full namespace of each XML element when being output.  If its a single instance, all is well, if its an array of that same class, it returns the full namespaces.  Strange.

是否有适当/标准的方法来返回自定义对象数组? 我目前正在使用强类型类数组(例如:Client []),其中包含"Serializable"属性以及命名空间。

Is there a proper/standard method by which to return arrays of custom objects?  I am currently using an Array of strongly typed classes (Ex.: Client[]) which contain the "Serializable" attribute as well as a namespace.

 

     Giovanni

     Giovanni

推荐答案

请提供一个说明问题的示例。如果可能,简化情况。包括代码和生成的XML,并显示您期望的XML。

Please provide an example that illustrates the problem. Simplify the situation if possible. Include both the code, and the resulting XML, and show what XML you expected.


这篇关于自定义对象的Web服务数组命名空间问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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