I am developing a WCF service. The methods that this service must support are defined by a third party. The interface that defines the service contract looks, in part, like this:
[SoapHeaders]
[ServiceContract(Namespace ="abc.xyz")]
public interface IAbcSoap
{
[SoapHeader("AuthenticationHeader",
typeof(AuthenticationHeader),
Direction = SoapHeaderDirection.In)]
[OperationContract(Action = "abc.xyz/ReverseCard")]
ReverseCardResponse ReverseCard(
OriginalRequest OriginalRequest);
The classes that define the data contract include an OriginalRequest and several more specific types that inherit from OriginalRequest, like so:
[DataContract]
public class OriginalRequest
{
[DataMember]
public MessageHeader MsgHeader { get; set; }
}
[DataContract]
public class OriginalLoadRequest : OriginalRequest
{
[DataMember]
public long ProductCode { get; set; }
}
I have a test client program, created using SvcUtil from the WSDL generated by the service. My problem is that the code generated from the WSDL includes only the OriginalRequest, not the classes like OriginalLoadRequest that inherit from OriginalRequest, presumably because there is no reference to these classes in the interface. I tried adding an overload to the interface like so:
[OperationContract(Action = "abc.xyz/ReverseCard")]
ReverseCardResponse ReverseCard(
OriginalRequest OriginalLoadRequest);
But this causes an error when trying to generate the WSDL. If I understand correctly this is because I cannot have two methods with the same action. But the action is defined by the third party. I can't change that.
What can I do to make the client program aware of the OriginalLoadRequest and other classes that inherit from OriginalRequest?