Click here to Skip to main content
15,885,032 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi,

In wcf, I do not want to use message contract. but wcf service does not show header definition in wsdl without it. I wrote following code with implementation of IWsdlExportExtension and overriding ExportContract, in which I added header definition in following way,

C#
MessageHeaderDescription User = new MessageHeaderDescription("User", string.Empty);
User.Type = typeof(string);

foreach (OperationDescription op in context.Contract.Operations)
{
    foreach (MessageDescription msgDescription in op.Messages)
    {
        if (msgDescription.Direction == MessageDirection.Input)
        {
            msgDescription.Headers.Add(User);
        }
    }
}


This works perfectly and exposing Header definition in WSDL, but the problem is it is updating all the method signature as well. So if you have DoWork() method in service on Server, at Consumer/Client side it will write like DoWork(string User). My consumer wants actual method signature to call. He will take care Header separately and send user name in header only. So how to stop it in changing method signature?
Posted
Updated 5-Jan-14 22:00pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900