在 Web 服务 (WSE) 中公开自定义类型(类)
如果我的 Web 服务中有自定义类型(类),我是否必须使用特殊属性进行标记,以便它们能够正确序列化?
即[某些属性]?
更新 我现在正在使用 WSE
If I have custom types (classes) in my web service, do I have to mark with with special attributes so they are serialized properly?
i.e. [SomeAttribute] ?
Update
I am using WSE at the moment
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您默认使用数据契约序列化程序,则不会对任何内容进行序列化 - 这与旧的 XmlSerializer 相反 - 这是旧的 asmx Web 服务方法。
对于 WCF,首先查看 DataContractAttribute:链接文本< /a>
If you are using the Data Contract serializer by default nothing is serialized - this is the opposite of the older XmlSerializer - which is the older asmx web service approach.
For WCF look at the DataContractAttribute for starters: link text
过时的 WSE 使用 XmlSerializer。 它应该序列化具有默认构造函数的类型的大多数公共读/写属性。 有关更多详细信息,请查找 XmlSerializer。
并尽快从 WSE 转换为 WCF,因为 WSE 已过时。
The obsolete WSE uses the XmlSerializer. It should serialize most public read/write properties of types that have a default constructor. For more details, look up XmlSerializer.
And convert from WSE to WCF as soon as possible, as WSE is obsolete.