Reputation: 425
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.
Upvotes: 3
Views: 4998
Reputation: 22368
Use the XmlInclude attribute on an exposed class to include another one.
Upvotes: 3