Let's assume I have a webservice which returns a class on all methods, informing the client the status of the process, for example:
public class WsResult {
string result; // either "error" or "ok"
}
Now we'd like to add a property to this class, without forcing all clients consuming our service to update their software. Is this possible?
For example:
public class WsResult {
public string result; // either "error" or "ok"
public Guid? someIdentifier;
}
I'm looking for answers on both WCF and ASMX.
WCF
It is possible. You can simply add a new property and it'll work providing that this new property is not required. For more details see point 8 of Best Practices: Data Contract Versioning article.
If you need to handle round-tripping scenario you should read about IExtensibleDataObject
interface. Round-tripping occurs when data is sent from a server to a client and it is expected that it'll be sent back. See Forward-Compatible Data Contracts article for details.
ASMX
With ASMX a situation is the same. You can add a new property and all clients should work. In this case you can also use IExtensibleDataObject
interface.
Final Comments
This answer is based on empirical tests with VS 2015. I strongly suggest you to do the same i.e.: write simple WCF/ASMX servers and clients and verify behaviour described by me. It took me just several minutes to do so. Or even better you can use already existing services.
I recommend additional tests because you may be using some non-default configuration which changes the default behaviour of WCF/ASMX services so it is better to check. I'm not aware of this kind of configuration but you never know.