简体   繁体   English

在 web 服务 (WSE) 中公开自定义类型(类)

[英]exposing custom types (classes) in a web service (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?如果我的 web 服务中有自定义类型(类),是否必须使用特殊属性进行标记才能正确序列化?

ie [SomeAttribute]?即[SomeAttribute]?

Update I am using WSE at the moment更新我目前正在使用 WSE

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.如果您默认使用 Data Contract 序列化程序,则不会对任何内容进行序列化 - 这与较旧的 XmlSerializer 相反 - 这是较旧的 asmx web 服务方法。

For WCF look at the DataContractAttribute for starters: link text对于 WCF,请查看初学者的 DataContractAttribute: 链接文本

The obsolete WSE uses the XmlSerializer.过时的 WSE 使用 XmlSerializer。 It should serialize most public read/write properties of types that have a default constructor.它应该序列化具有默认构造函数的类型的大多数公共读/写属性。 For more details, look up XmlSerializer.有关更多详细信息,请查看 XmlSerializer。

And convert from WSE to WCF as soon as possible, as WSE is obsolete.并尽快从 WSE 转换为 WCF,因为 WSE 已过时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM