I am consuming a predefined wsdl with svcutil:
svcutil some_service.wsdl
We are using this to set up a mock server for testing a client.
The generated code looks like the following:
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace = "http://LIB-Operations/interfaces/ServiceResponse", ConfigurationName = "ServiceResponse")]
public interface ServiceInterface
{
[System.ServiceModel.OperationContractAttribute(IsOneWay = true, Action="")]
[System.ServiceModel.XmlSerializerFormatAttribute()]
void Operation1(OperationRequest1 request);
[System.ServiceModel.OperationContractAttribute(IsOneWay = true, Action="")]
[System.ServiceModel.XmlSerializerFormatAttribute()]
void Operation2(OperationRequest2 request);
}
This causes the following exception:
System.InvalidOperationException: The operations Operation1 and Operation2 have the same action (). Every operation must have a unique action value.
If I remove the
Action=""
I receive the following exception:
System.ServiceModel.ProtocolException: The one-way operation returned a fault message. The reason for the fault was 'The message with Action '' 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).'.
Note that if there is only one operation in the contract there is no problem. This is only a problem when used in a server, this is no issue using the generated code in a client.
What is the correct way to handle this situation? I can not modify the client (it must be backed by the unmodified code generated by svcutil), but can modify the code generated by svcutil used in our mock server.