1
votes

I've this WCf Interface definition

public interface IDataToMfcV2
{       
    [OperationContract(IsOneWay = false)]
    SecurityAnswerDTO CommitDTOs(string sessionId, BasicDTO[] basicDto);        
}

and now I have different Objects which derive from BasicDTO! Now I want to know, is it Possible to send a List of derived Objects to this call?

Because I got this exception:

The message with Action 'X' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).

2

2 Answers

0
votes

You need to add ServiceKnownType attribute to the service interface for all derived classes which you are planning to send and receive using the service.

e.g.

public class X : BasicDTO
public class Y : BasicDTO

[ServiceContract]
[ServiceKnownType(typeof(X))]
[ServiceKnownType(typeof(Y))]
public interface IDataToMfcV2
{       
    [OperationContract(IsOneWay = false)]
    SecurityAnswerDTO CommitDTOs(string sessionId, BasicDTO[] basicDto);        
}
0
votes

Was my fault! I connected to a completly wrong URI!