I am following a template that has objects for requesting and responding to a WCF service. I have multi-user request objects that have the same type and return name. Any help would be greatly appreciated.
I get the following exception:
An ExceptionDetail is probably thrown by IncludeExceptionDetailInFaults = true whose value is: System.InvalidOperationException: The exception was caused by a call to the WSDL export extension: System.ServiceModel.Description.DataContractSerializerOperationBehavior contract: http://tempuri.org/:IService ----> System. InvalidOperationException: the Service.ServiceContract.IService.RetrieveUsers operation refers to the message element [http://tempuri.org/:WeekEndingId] that has already been exported from the Service.ServiceContract.IService.RetrieveDepartments operation. You can change the name of one of the operations by changing the method name or by using the Name property of OperationContractAttribute. In addition, you can control the element name in more detail using the MessageContract programming model.
Edit: I used the Name attribute in the properties to give them unique names, and this fixes the problem, but we need to use the name "WeekEndingId" for all requests. I would like to try to find a fix for this while still using the same name for the property.
The following are the classes causing the problems:
RetrieveDepartmentsRequest:
[MessageContract(WrapperName = "RetrieveDepartmentsRequest", WrapperNamespace = "http://Service.V1")]
public class RetrieveDepartmentsRequest
{
[MessageBodyMember(Order = 0)]
public int WeekEndingId { get; set; }
[MessageBodyMember(Order = 1)]
public string UserId { get; set; }
[MessageBodyMember(Order = 2)]
public string MachineName { get; set; }
}
RetrieveUsersRequest:
[MessageContract(WrapperName = "RetrieveUsersRequest", WrapperNamespace = "http://Service.V1")]
public class RetrieveUsersRequest
{
[MessageBodyMember(Order = 0)]
public int WeekEndingId { get; set; }
[MessageBodyMember(Order = 1)]
public string UserId { get; set; }
[MessageBodyMember(Order = 2)]
public string MachineName { get; set; }
}
IService:
[OperationContract]
[FaultContract(typeof(ServiceFault))]
RetrieveDepartmentsResponse RetrieveDepartments(RetrieveDepartmentsRequest request);
[OperationContract]
[FaultContract(typeof(ServiceFault))]
RetrieveUsersResponse RetrieveUsers(RetrieveUsersRequest request);
Bryan source
share