I'm importing a WSDL as a service definition (inbound to my service), and for whatever reason the client is formatting the request such that WCF cannot deserialize it without the proxy classes having MessageContract
decorations.
I've gotten it to work this way by adding the MessageContract
attribute on the main container class, which is fine because WCF builds these as partial classes, which means I can decorate my part and leave the generated part alone. However, in order to correctly deserialize the properties on the main container class, I have to decorate them with MessageBodyMember
attributes that specify the namespace.
This is obviously a Bad Thing®, as it means that every time I regenerate from the WSDL I'm going to lose the ability to receive messages from the client. I've already set "Always generate message contracts" on the service reference configuration, but it appears to be a lie - the message contracts are not generated, regardless of whether I leave my partial class decorated with MessageContract
or not.
Is there any way I can force WCF to generate these MessageContract
s?
EDIT
I'm not sure whether it's pertinent, but when svcutil generates the proxy class, it decorates the properties with
[XmlElement(Order=0)]
//Property definition
And when I add the MessageContract
attribute the service breaks with the message
Explicit sequencing may not be used on parameters or return values. Please remove Order property from custom attributes.
I have to remove all of the Order directives from the generated XmlElement
attributes before I can successfully call the service.