How can I return something other than an enum from an NServiceBus endpoint exposed as a WCF service?
Posted
by Todd Stout
on Stack Overflow
See other posts from Stack Overflow
or by Todd Stout
Published on 2010-04-02T16:20:36Z
Indexed on
2010/04/02
16:23 UTC
Read the original article
Hit count: 224
nservicebus
|wcf
I have a service exposed as WCF via NServiceBus. Ultimately, I'd like to call to this service from silverlight. My WCF Service Interface looks like this:
[ServiceContract]
public interface ISettingsService
{
[OperationContract(Action = "http://tempuri.org/IWcfServiceOf_RequestSettingsMessage_SettingsResponseMessage/Process", ReplyAction = "http://tempuri.org/IWcfServiceOf_RequestSettingsMessage_SettingsResponseMessage/ProcessResponse") ]
SettingsResponseMessage FetchSettings(RequestSettingsMessage request);
}
My NSB WCF service is defined as:
public class CoreService : WcfService<RequestSettingsMessage, SettingsResponseMessage>
{
}
When I invoke the FetchSettings method on the service, I get an exception:
System.TypeInitializationException: The type initializer for 'NServiceBus.WcfSer vice`2' threw an exception. ----> System.InvalidOperationException: Centerlink.Services.Core.Msg.Settings.SettingsResponseMessage must be an enum representing error codes returned by the server.
It seems that the WcfService<> class is restricting the return type of a WCF method to be an enum. How can I have my service return something other than an enum? Do I need to create a custom implementation of NServiceBus.WcfService<>?
© Stack Overflow or respective owner