Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 517977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:53:23+00:00 2026-05-13T07:53:23+00:00

Can I add Custom SOAP header in WCF incoming/outgoing messages in basicHttpBinding, like we

  • 0

Can I add Custom SOAP header in WCF incoming/outgoing messages in basicHttpBinding, like we can add custom authentication header in ASMX web services? Those custom SOAP header should be accessible using .net 2.0/1.1 web service clients (accessible by WSDL.EXE tool) .

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:53:24+00:00Added an answer on May 13, 2026 at 7:53 am

    Check out the WCF Extras on Codeplex – it’s an easy extension library for WCF which offers – among other things – custom SOAP headers.

    Another option is to use WCF message contracts in your WCF service – this also easily allows you to define and set WCF SOAP headers.

    [MessageContract]
    public class BankingTransaction
    {
      [MessageHeader]
      public Operation operation;
      [MessageHeader] 
      public DateTime transactionDate;
    
      [MessageBodyMember] 
      private Account sourceAccount;
      [MessageBodyMember] 
      private Account targetAccount;
      [MessageBodyMember] 
      public int amount;
    }
    

    Here, the “operation” and the “transactionDate” are defined as SOAP headers.

    If none of those methods help, then you should check out the concept of WCF Message Inspectors which you can write as extensions. They allow you to e.g. inject certain headers into the message on every outgoing call on the client, and retrieving those from the message on the server for your use.

    See this blog post Handling custom SOAP headers via WCF Behaviors for a starting point on how to write a message inspector, and how to include it in your project setup.

    The client side IClientMessageInspector defines two methods BeforeSendRequest and AfterReceiveReply while the server side IDispatchMessageInspector has the opposite methods, i.e. AfterReceiveRequest and BeforeSendReply.

    With this, you could add headers to every message going across the wire (or selectively only to a few).

    Here’s a snippet from a IClientMessageInspector implementor we use to automagically transmit the locale information (language and culture info) across from the clients to the server – should give you an idea how to get started:

    public object BeforeSendRequest(ref Message request, IClientChannel channel)
    {
        International intlHeader = new International();
        intlHeader.Locale = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName;
    
        MessageHeader header = MessageHeader.CreateHeader(WSI18N.ElementNames.International, WSI18N.NamespaceURI, intlHeader);
        request.Headers.Add(header);
    
        return null;
    }
    

    On the server side, you’d then check for the presence of those headers, and if present, extract them from the SOAP envelope and use them.

    UPDATE: okay, you’re clients are on .NET 2.0 and not using WCF – good news is, this should still work just fine – see this blog post Custom SOAP Headers: WCF and ASMX for details. You could still use the message inspector on the server side to sniff and extract the custom headers being sent by your .NET 2.0 clients.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to add custom attributes to a MySQL table which I can
In Rails 2 we can add custom new actions to resourceful routes, like: map.resources
Can we add custom language for RecognizerIntent? I have search many SO Question like
Team, I would like to know, whether we can add custom configurations in Manifest
How can I add custom commands to the cmake when invoking something like cmake
I am struggeling with Magento custom options. In Magento you can add custom options
How can I add custom action in generator.yml that point to an action in
Can someone explain how can I add custom font, css classes styles to Contribute?
Arrays have a "length" property by default. Can I add custom properties to them?
how can i add a custom view to the right click menu of every

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.