I’ve always wanted to send objects that you can serialize in XML across websites, such as a dictionary or an exception (because I’m perverse).
I know for example in the dictionary, I shouldn’t send custom objects (as the value part) in case I upgrade the class library on the web service, but not on the client as this would lead to a mismatch in the byte array and it wouldn’t be able to be de-serialised at the other end correctly.
But I don’t see a problem with an exception, or an image object etc?
Are there any other reasons, such as performance concerns that I should be aware of?
Is this a valid approach to web services if I use it carefully? This is more of a theoretical question, so any elaboration on answers would be appreciated. Thanks.
I have no idea where you got this idea, but pretend you didn’t.
You should simply not be sending platform-specific types across a web service boundary. This can cause problems even between .NET Framework versions.
Instead, you should abstract the value that you are sending – decide what information in the
Exceptionis important, and just send that.