M_ Fa
M_ Fa

Reputation: 497

Custom error message in header when exception happens

I need simple fault handling in WCF

what i need is to put a custom error message in soap header whenever an exception throw in wcf service

in short sentence i just need to put a tag in soap header when an exception thrown, i don't want to use message inspector

or if you know how can i use

MessageHeader aMessageHeader = MessageHeader.CreateHeader("UserInfo", "Eshteb kardi amoo", "salammmmmmmm"); OperationContext.Current.OutgoingMessageHeaders.Add(aMessageHeader);

Upvotes: 0

Views: 414

Answers (1)

Seymour
Seymour

Reputation: 7067

I'm not entirely sure I follow your usage scenario, but if you just want a way to simplify custom SOAP Header support in WCF, then you might want to try "WCFExtras" on CodePlex.

http://wcfextras.codeplex.com/

Although WCF allows you to work with SOAP headers using a message contract based programming model, it is sometimes easier to keep the more intuitive operation contract model but still expose SOAP headers and be able to access them inside WCF calls. The SoapHeader attribute introduced in the project allows you to use SOAP headers in code while still using the Operation Contract based model.

Upvotes: 1

Related Questions