http://bugzilla.novell.com/show_bug.cgi?id=598223
http://bugzilla.novell.com/show_bug.cgi?id=598223#c0 Summary: Custom MessageHeaders not being sent Classification: Mono Product: Mono: Class Libraries Version: 2.6.x Platform: x86 OS/Version: All Status: NEW Severity: Major Priority: P5 - None Component: WCF AssignedTo: mono-bugs@lists.ximian.com ReportedBy: rich...@ayudasystems.com QAContact: mono-bugs@lists.ximian.com Found By: Third Party Developer/Partner Blocker: Yes Description of Problem: Custom headers attached to WCF messages are not sent when running in Mono 2.6 on both Windows and Linux. Steps to reproduce the problem: 1. Create a simple WCF service exposing a single method. The parameter should be an object with the MessageContract attribute, and contain a header. Example: [ServiceContract] public interface IRegularService { [OperationContract] void GetData(TestRequestMessage obj); } [MessageContract] public class TestRequestMessage { [MessageHeader] public string Header { get; set; } [MessageBodyMember] public string Body { get; set; } } public class RegularService : IRegularService { #region IRegularService Members public void GetData(TestRequestMessage obj) { if (obj.Header == null) throw new Exception("Header is null"); else System.Diagnostics.Debug.WriteLine(string.Format("Header: {0}", obj.Header)); if (obj.Body == null) throw new Exception("Body is null"); else System.Diagnostics.Debug.WriteLine(string.Format("Body: {0}", obj.Body)); } #endregion } 2. Host the service and then attempt to call it from a Mono client: .. client code: BasicHttpBinding binding = new BasicHttpBinding(); ServiceEndpoint svcEp = new ServiceEndpoint(ContractDescription.GetContract(typeof(IRegularService)), binding, new EndpointAddress("http://serviceaddress/service.svc")); ChannelFactory<IRegularService> cnlFactory = new ChannelFactory<IRegularService>(svcEp); IRegularService svc = cnlFactory.CreateChannel(); TestRequestMessage msg = new TestRequestMessage() { Header = "header", Body = "body" }; srv.GetData(msg); Actual Results: The custom header is not passed to the service. Break into the service and the 'Header' property will be null. Expected Results: The custom header should be passed to the service as part of the message. How often does this happen? Every time. Additional Information: As well as using the MessageContract / MessageHeader attributes, I also tried to attach a header to the message manually, e.g. using(OperationContextScope scope = new OperationContextScope((IContextChannel)srv)) { MessageHeader<string> mhg = new MessageHeader<string>("header"); MessageHeader untyped = mhg.GetUntypedHeader("token", "ns"); OperationContext.Current.OutgoingMessageHeaders.Add(untyped); .. And then read it back on the service like this: string token = OperationContext.Current.IncomingMessageHeaders.GetHeader<string>("token", "ns"); .. The result was the same. I also implemented IClientMessageInspector on the client, and attached it to the endpoint using an IEndpointBehavior implementation. In my IClientMessageInspector implementation, I used the BeforeSendRequest method to attach my custom header to the message and then check it was added succesfully. My header appears in the message, however it does not get sent to the server (it is null on the server). -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. _______________________________________________ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs