ASMX Web 服务公开类
我正在使用简单的 ASMX 服务在 asp.net/c# 中创建基本的 Web 服务。 当我创建返回类的方法时,服务的客户端可以发现该类定义。
我想知道是否有一种方法可以将类公开给不直接在任何服务方法中使用的服务。 我需要我的服务客户端了解特定的类,即使它没有在任何方法中显示为返回值或参数类型。
我意识到这是一个奇怪的要求,但它的出现是因为我们正在序列化对象并压缩序列化文件。 我们最终将对象作为 byte[] 发送。 当在另一端反序列化它时,这会导致问题,因为客户端不知道该类。
有没有一种方法可以装饰一个类,以便可以通过服务发现来发现它?
提前致谢,
马丁。
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.
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?
Thanks in advance,
Martin.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在公开的类上使用 XmlInclude 属性包括另一个。
Use the XmlInclude attribute on an exposed class to include another one.