简体   繁体   English

ASMX Web服务公开课程

[英]ASMX Web Service Expose Class

I'm creating a basic web service in asp.net/c# using simple ASMX services. 我正在使用简单的ASMX服务在asp.net/c#中创建一个基本的Web服务。 When I create a method that returns a class, this class definition is discoverable by clients of the service. 当我创建一个返回类的方法时,该类定义可由服务的客户端发现。

I'm wondering if there is a way to expose a class to the service that isn't used directly in any of the service methods. 我想知道是否有办法将类公开给未在任何服务方法中直接使用的服务。 I need my service clients to know about a particular class even though it doesn't appear as a return value or parameter type in any of the methods. 我需要我的服务客户端知道某个特定的类,即使它在任何方法中都没有显示为返回值或参数类型。

I realise this is a strange requirement, but it comes about because we're serialising the object and compressing the serialised file. 我意识到这是一个奇怪的要求,但它的出现是因为我们正在序列化对象并压缩序列化文件。 We send the object as a byte[] ultimately. 我们最终将对象作为byte []发送。 This is causing an issue when it comes to deserialising it on the other end as the client doesn't know about the class. 由于客户端不了解该类,因此在另一端对其进行反序列化时会出现问题。

Is there a way to decorate a class so that it's discoverable through service discovery? 有没有办法装饰一个类,以便通过服务发现可以发现它?

Thanks in advance, 提前致谢,

Martin. 马丁。

在公开的类上使用XmlInclude属性以包含另一个。

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

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