ASMX Web Expose Class

I am 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 service clients.

I am wondering if there is a way to expose the class to a service that is not used directly in any of the service methods. I need my service clients to know about a particular class, even if it does not appear as a return value or parameter type in any of the methods.

I understand that this is a strange requirement, but this is because we serialize the object and compress the serialized file. We send the object as a byte [] ultimately. This causes a problem when it comes to deserialization on the other end, as the client is not aware of the class.

Is there a way to decorate a class so that it can be detected through service discovery?

Thanks in advance,

Martin.

+3
source share
1 answer

Use the XmlInclude attribute for the public class to include another.

+3
source

Source: https://habr.com/ru/post/1703420/


All Articles