WCF SOAP Message Version

Services and their clients communicate using messages. So they must use compatible message versions to communicate. A service may send a message either as POX or as SOAP12.

When at the service side we create a SOAP Message, we call it a Message Object Model. Essentially, we can say a Message Object Model is used to create a SOAP Message in WCF to communicate with a client. When we create a SOAP Message, we specify the message version and it is not modifiable afterwards.

A message created using a Message Object Model essentially consists of an Envelope version and an Addressing version type.


The MessageVersion class is inside System.ServiceModel.Channels. If you navigate to the MessageVersion class you will find AddressingVersion and EnvelopeVersion there.


The Message versions are as below:


If you want you can create your own Message Version:


CreateVersion is an overloaded function. Either you can pass only Envelope Version or Envelope Version and Addressing Version both to create your own Message Version.

Now let us inspect the entire Message version to find what Envelope Version and AddressingVersion type are inside a particular Message Version.

using System;
using System.ServiceModel.Channels;
namespace XML
    class Program
        static void Main(string[] args)
            MessageVersion version = MessageVersion.Default;
            Display(version ,"Default");
            version = MessageVersion.Soap11 ;
            version = MessageVersion.Soap11WSAddressing10 ;
            version = MessageVersion.Soap11WSAddressingAugust2004;
            version = MessageVersion.Soap12 ;
            version= MessageVersion.Soap12WSAddressing10;

        static void Display(MessageVersion v , string strName)
            Console.WriteLine("Addressing : " + v.Addressing.ToString());
            Console.WriteLine("Envelope : " + v.Envelope.ToString());

If you run the above code you will get output as below:


If you want to create a new Message Version, you can very much do that.


If you want you can pass as an input parameter only EnvelopeVersion:


Note: Display is a function to print EnevelopeVesrion and AddressingVesrion. This function is created in the code shown previously.

If you run the above code you will get output as below:


I hope you are now getting an idea about SOAP Message Versions. In the next post, we will see more about messages in WCF.

I hope this post was useful. Thanks for reading.