My WCF service exports a single operation, marked with the catch-all action and reply action so that it represents a common entry point to the service:
[ServiceContract]
public interface IService
{
[OperationContract (Action="*", ReplyAction="*")]
Message MyMethod (Message msg);
}
Client proxies are still generated as data contracts.
What I'm finding, however, is that despite the client sending a data contract, when msg
is serialized, the body appears to be the equivalent message contract to the data contract, not the data contract itself.
Even this is fine, except that extracting the data contract inside involves doing a manual parsing of the incoming XML. The service itself does not have an actual MessageContract
type to use, so accessing the body means extracting nodes, relabeling elements, and so on. It's a manual process for something that, presumably, WCF is already handling under the covers when the exposed operations are not Message
-based.
How does WCF do this when it's data contract-to-data contract? Is there a way that I can use that same process?