ASMX Web Service Expose Class

岁酱吖の 提交于 2019-12-12 16:13:17

问题


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.


回答1:


Use the XmlInclude attribute on an exposed class to include another one.



来源:https://stackoverflow.com/questions/560722/asmx-web-service-expose-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!