开发者

WCF Service Wsdl Error: operation references a message element that has already been exported

We have a WCF service that has two operations (Operation1 and Operation2) with the same message contract. When you access the开发者_如何学JAVA Wsdl (Get/Http) we get this error:


System.InvalidOperationException: An exception was thrown in a call to a WSDL export extension: System.ServiceModel.Description.DataContractSerializerOperationBehavior

contract: Xxxxx ----> System.InvalidOperationException: The Xxxx.IServiceInterface.Operation1 operation references a message element [http://schemas.somecompany.com/namespace/version/:MessageContract] that has already been exported from the Xxxx.IServiceInterface.Operation2 operation.

You can change the name of one of the operations by changing the method name or using the Name property of OperationContractAttribute. Alternatively, you can control the element name in greater detail using the MessageContract programming model.


Seems to me that reusing the same message for different service operations should be possible. I understand the resolution that is given in the error, but we want to have the same message for a number of different operations.

Thoughts?

More Info: We implement an event pub/sub mechanism. Event subscribers declare a service operation with the event type they want to handle and wrap that in a generic message contract class. This generic message class uses the message code attributes to use the event-publisher xml names - which is a single message structure. All event subscribers are registered in UDDI and the pub/sub mechanism use those endpoints to push events to the subscribers. Registration of service operations in UDDI detect the specific event-namespace to register those service operations as event handlers (and not req/response operations).


This error can occur if you have copy - pasted operation1, then changed the name to operation2, but not changed the DataContract attribute to match the new name.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜