title: How to change SOAP version in custom WCF MessageEncoder?
body: <p>I'm trying to utilize GZip compression for the self hosted WCF service.</p>
  
  <p>The SOAP 1.1 is required.</p>
  
  <p>I implemented custom MessageEncoder from the next sample <a href="http://msdn.microsoft.com/en-us/library/cc138373.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/cc138373.aspx</a>.</p>
  
  <p>The message encoder was incorporated to the new custom binding:</p>
  
  <pre><code>readonly HttpTransportBindingElement httpTransport;
  readonly TextMessageEncodingBindingElement textMessageEncoding;
  readonly CompressionMessageEncodingBindingElement compressionMessageEncoding;
  
  public InsecureGZipBasicHttpBinding()
  {           
      httpTransport = new AutoSecuredHttpTransportElement();
      textMessageEncoding = new TextMessageEncodingBindingElement { MessageVersion = **MessageVersion.Soap11** };
      compressionMessageEncoding = new CompressionMessageEncodingBindingElement(textMessageEncoding);
  }
  
  public override IChannelFactory&lt;TChannel&gt; BuildChannelFactory&lt;TChannel&gt;(BindingParameterCollection parameters)
  {
      return base.BuildChannelFactory&lt;TChannel&gt;(parameters);
  }
  
  public override BindingElementCollection CreateBindingElements()
  {
      var elements = new BindingElementCollection {
          compressionMessageEncoding, 
          httpTransport
      };
  
      return elements;
  }
  </code></pre>
  
  <p>The issue in the next code:</p>
  
  <pre><code>public override ArraySegment&lt;byte&gt; WriteMessage(Message message, int maxMessageSize, BufferManager bufferManager, int messageOffset)
  {
              var buffer = innerEncoder.WriteMessage(message, maxMessageSize, bufferManager, messageOffset);
              var compressedBuffer = CompressBuffer(buffer, bufferManager, messageOffset);
  
              return compressedBuffer;
          }
  </code></pre>
  
  <p>Each time when it reached, the message has SOAP 1.2 version and can't be processed by the innerEncoder.</p>
  
  <p>How to set the default message version to the SOAP 1.1?</p>