In the January CTP, I was able to have an empty reply sent back to a client by giving a ReplyAction in the contract. It was something like the following:
[
OperationContract(Action = "DoStuff", ReplyAction = "DoStuffResponse")]void DoStuff(DoStuffMessage message);
However, in the February CTP, this throws a CommunicationException: The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.
What should I do instead of a void Pass an empty Message back
jsin

ReplyAction and void method
dgrm44
Thanks for the reply, Mike.
The OperationContract is not setting the IsOneWay flag so I'm assuming it is the default which is false. The thing that irks me is that this worked on the January CTP with the same exact code. I looked through the changes documents between the two CTPs and I didn't notice anything familiar except for the move of ReplyAction off of MessageContract.
I guess I can dig in with Reflector and try to find out what's going on underneath. I was hoping someone might know off the top of their head.
-jsin
Ferry Meidianto
I'm sorry you're having trouble. =/
I've tried to repro this, but I can't (see below code). Does the below code work for you
System;using
System.ServiceModel;[MessageContract]
public
class DoStuffMessage{
[MessageBody]
public string Stuff;
}
[ServiceContract]
interface
DoStuffContract{
[OperationContract(Action = "DoStuff", ReplyAction = "DoStuffResponse")]
void DoStuff(DoStuffMessage message);
}
class
DoStuffService : DoStuffContract{
public void DoStuff(DoStuffMessage message)
{
Console.WriteLine("Stuff Done!");
}
}
class
Program{
static void Main(string[] args)
{
ServiceHost host = new ServiceHost(typeof(DoStuffService), new Uri("http://localhost:8000/"));
host.AddServiceEndpoint("DoStuffContract", new BasicHttpBinding(), "");
host.Open();
ChannelFactory<DoStuffContract> factory = new ChannelFactory<DoStuffContract>(
new BasicHttpBinding(), new EndpointAddress("http://localhost:8000/"));
DoStuffContract channel = factory.CreateChannel();
channel.DoStuff(new DoStuffMessage());
Console.ReadLine();
((IClientChannel)channel).Close();
host.Close();
}
}
Cheers,
-mike
Carsten M. Horlacher
Greetings -
ReplyAction doesn't control whether or not a reply message gets sent. There is a knob on OperationContract called IsOneWay which controls this. If IsOneWay = true and the return type is void, then there will be no response. If IsOneWay = true and there is a non-void return type, that is an error. If IsOneWay = false, there is always a response message.
I suspect there might be something else going on here. What if you don't specify the ReplyAction What if you set IsOneWay = true
-mike