ASMX的Web服务公开级 [英] ASMX Web Service Expose Class
问题描述
我要创建使用简单的ASMX服务,一个基本的Web服务asp.net/c#。当我创建一个返回类中的方法,这个类的定义是发现由服务的客户。
I'm creating a basic web service in asp.net/c# using simple ASMX services. 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.
我意识到这是一个奇怪的规定,但它大约是因为我们正在连载的对象和COM pressing序列化的文件。我们发送对象为一个byte [最终]。这导致一个问题,当谈到deserialising它放在另一端的客户端不知道的类。
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. 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?
在此先感谢,
马丁。
推荐答案
使用的 XmlInclude 属性上暴露类包含另外一个。
Use the XmlInclude attribute on an exposed class to include another one.
这篇关于ASMX的Web服务公开级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!