title: Missing action in content-type of WCF SOAP call HTTP header
body: <p>I have been investigating for several days why my SOAP request isn't correct according to my vendor, and how I can change it.</p>
  
  <p>I followed the steps below to create my SOAP Client:</p>
  
  <ul>
  <li>Added the service reference to my project. The wsdl of the service is:</li>
  </ul>
  
  <pre><code>
  
      &lt;?xml version="1.0" encoding="utf-8"?>
      &lt;wsdl:definitions name="vz801802Service" targetNamespace="http://schemas.vecozo.nl/VZ801802/v1" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://schemas.vecozo.nl/VZ801802/v1" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
       &lt;wsp:Policy wsu:Id="vz801802Soap12_policy">
        &lt;wsp:ExactlyOne>
         &lt;wsp:All>
          &lt;sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
           &lt;wsp:Policy>
            &lt;sp:TransportToken>
             &lt;wsp:Policy>
              &lt;sp:HttpsToken RequireClientCertificate="true"/>
             &lt;/wsp:Policy>
            &lt;/sp:TransportToken>
            &lt;sp:AlgorithmSuite>
             &lt;wsp:Policy>
              &lt;sp:Basic256/>
             &lt;/wsp:Policy>
            &lt;/sp:AlgorithmSuite>
            &lt;sp:Layout>
             &lt;wsp:Policy>
              &lt;sp:Strict/>
             &lt;/wsp:Policy>
            &lt;/sp:Layout>
           &lt;/wsp:Policy>
          &lt;/sp:TransportBinding>
         &lt;/wsp:All>
        &lt;/wsp:ExactlyOne>
       &lt;/wsp:Policy>
       &lt;wsp:Policy wsu:Id="vz801802Soap11_policy">
        &lt;wsp:ExactlyOne>
         &lt;wsp:All>
          &lt;sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt;
           &lt;wsp:Policy>
            &lt;sp:TransportToken>
             &lt;wsp:Policy>
              &lt;sp:HttpsToken RequireClientCertificate="true"/>
             &lt;/wsp:Policy>
            &lt;/sp:TransportToken>
            &lt;sp:AlgorithmSuite>
             &lt;wsp:Policy>
              &lt;sp:Basic256/>
             &lt;/wsp:Policy>
            &lt;/sp:AlgorithmSuite>
            &lt;sp:Layout>
             &lt;wsp:Policy>
              &lt;sp:Strict/>
             &lt;/wsp:Policy>
            &lt;/sp:Layout>
           &lt;/wsp:Policy>
          &lt;/sp:TransportBinding>
         &lt;/wsp:All>
        &lt;/wsp:ExactlyOne>
       &lt;/wsp:Policy>
       &lt;wsdl:types>
        &lt;xsd:schema targetNamespace="http://schemas.vecozo.nl/VZ801802/v1/Imports">
         &lt;xsd:import schemaLocation="https://acccovwebservice.vecozo.nl/v1/VZ801802.svc?xsd=xsd0" namespace="http://schemas.vecozo.nl/VZ801802/v1"/>
         &lt;xsd:import schemaLocation="https://acccovwebservice.vecozo.nl/v1/VZ801802.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
         &lt;xsd:import schemaLocation="https://acccovwebservice.vecozo.nl/v1/VZ801802.svc?xsd=xsd2" namespace="http://schemas.vecozo.nl/VZ801802/v1/messages"/>
         &lt;xsd:import schemaLocation="https://acccovwebservice.vecozo.nl/v1/VZ801802.svc?xsd=xsd3" namespace="http://schemas.vecozo.nl/VZ801802/v1/types"/>
        &lt;/xsd:schema>
       &lt;/wsdl:types>
       &lt;wsdl:message name="vz801802Service_Controleer_InputMessage">
        &lt;wsdl:part name="parameters" element="tns:Controleer"/>
       &lt;/wsdl:message>
       &lt;wsdl:message name="vz801802Service_Controleer_OutputMessage">
        &lt;wsdl:part name="parameters" element="tns:ControleerResponse"/>
       &lt;/wsdl:message>
       &lt;wsdl:portType name="vz801802Service">
        &lt;wsdl:operation name="Controleer">
         &lt;wsdl:input wsaw:Action="http://schemas.vecozo.nl/VZ801802/v1/Controleer" message="tns:vz801802Service_Controleer_InputMessage"/>
         &lt;wsdl:output wsaw:Action="http://schemas.vecozo.nl/VZ801802/v1/Controleer/reply" message="tns:vz801802Service_Controleer_OutputMessage"/>
        &lt;/wsdl:operation>
       &lt;/wsdl:portType>
       &lt;wsdl:binding name="vz801802Soap12" type="tns:vz801802Service">
        &lt;wsp:PolicyReference URI="#vz801802Soap12_policy"/>
        &lt;soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
        &lt;wsdl:operation name="Controleer">
         &lt;soap12:operation soapAction="http://schemas.vecozo.nl/VZ801802/v1/Controleer" style="document"/>
         &lt;wsdl:input>
          &lt;soap12:body use="literal"/>
         &lt;/wsdl:input>
         &lt;wsdl:output>
          &lt;soap12:body use="literal"/>
         &lt;/wsdl:output>
        &lt;/wsdl:operation>
       &lt;/wsdl:binding>
       &lt;wsdl:binding name="vz801802Soap11" type="tns:vz801802Service">
        &lt;wsp:PolicyReference URI="#vz801802Soap11_policy"/>
        &lt;soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
        &lt;wsdl:operation name="Controleer">
         &lt;soap:operation soapAction="http://schemas.vecozo.nl/VZ801802/v1/Controleer" style="document"/>
         &lt;wsdl:input>
          &lt;soap:body use="literal"/>
         &lt;/wsdl:input>
         &lt;wsdl:output>
          &lt;soap:body use="literal"/>
         &lt;/wsdl:output>
        &lt;/wsdl:operation>
       &lt;/wsdl:binding>
       &lt;wsdl:service name="vz801802Service">
        &lt;wsdl:port name="vz801802Soap12" binding="tns:vz801802Soap12">
         &lt;soap12:address location="https://acccovwebservice.vecozo.nl/v1/VZ801802.svc"/>
        &lt;/wsdl:port>
        &lt;wsdl:port name="vz801802Soap11" binding="tns:vz801802Soap11">
         &lt;soap:address location="https://acccovwebservice.vecozo.nl/v1/VZ801802.svc/soap11"/>
        &lt;/wsdl:port>
       &lt;/wsdl:service>
      &lt;/wsdl:definitions>
  
  </code></pre>
  
  <p>This created the proxy class for me.</p>
  
  <ul>
  <li><p>Next I tweaked my app.config a little, to force it to use soap1.2 (so I removed the soap1.1 entries, because of the problems I had)
  <code><pre>
  &lt;?xml version="1.0"?>
  &lt;configuration>
      &lt;system.serviceModel>
          &lt;bindings>
              &lt;customBinding>
                  &lt;binding name="vz801802Soap12">
                      &lt;textMessageEncoding messageVersion="Soap12" />
                      &lt;httpsTransport requireClientCertificate="true" />
                  &lt;/binding>
              &lt;/customBinding>
          &lt;/bindings>
          &lt;client>
              &lt;endpoint address="https://acccovwebservice.vecozo.nl/v1/VZ801802.svc"
                  binding="customBinding" bindingConfiguration="vz801802Soap12"
                  contract="COV_VZ801802.vz801802Service" name="vz801802Soap12" />
          &lt;/client>
      &lt;/system.serviceModel>
  &lt;/configuration>
  </pre></code></p></li>
  <li><p>The code to instantiate and call the webservice is:<br><code><pre>
  WSHttpBinding serviceBinding = new WSHttpBinding(SecurityMode.Transport);
  serviceBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
  serviceBinding.ReceiveTimeout = new TimeSpan(0, 0, 120);<br>
  EndpointAddress endpointAddress = new EndpointAddress(Bericht.Url);
  COV_VZ801802.vz801802ServiceClient VZ801_Client = new COV_VZ801802.vz801802ServiceClient(serviceBinding, endpointAddress);<br>
  if (Bericht.Certificaat != null &amp;&amp; Bericht.Certificaat != "")
  {
      X509Certificate2 x509_2 = new X509Certificate2(Bericht.Certificaat);
      VZ801_Client.ClientCredentials.ClientCertificate.Certificate = x509_2;
  }<br>
  COV_VZ801802.ControleerRequestType VZ801_Request = new COV_VZ801802.ControleerRequestType();<br>
  // Here I fill request with data<br>
  COV_VZ801802.ControleerResponseType VZ801_Reponse = VZ801_Client.Controleer(VZ801_Request);
  </pre></code></p></li>
  <li><p>When checking the message with Fiddler, I see the following:
  <code><pre>
  POST <code>https://acccovwebservice.vecozo.nl/v1/VZ801802.svc</code> HTTP/1.1
  Content-Type: application/soap+xml; charset=utf-8
  Host: acccovwebservice.vecozo.nl
  Content-Length: 1216
  Expect: 100-continue
  Accept-Encoding: gzip, deflate
  Connection: Keep-Alive</p>
  
  <p>&lt;s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
   &lt;s:Header>
    &lt;a:Action s:mustUnderstand="1"><code>http://schemas.vecozo.nl/VZ801802/v1/Controleer</code>&lt;/a:Action>
    &lt;a:MessageID>urn:uuid:a492c393-a93b-43df-9f0e-4e3f7116f8a2&lt;/a:MessageID>
    &lt;a:ReplyTo>
     &lt;a:Address><code>http://www.w3.org/2005/08/addressing/anonymous</code>&lt;/a:Address>
    &lt;/a:ReplyTo>
    &lt;a:To s:mustUnderstand="1"><code>https://acccovwebservice.vecozo.nl/v1/VZ801802.svc</code>&lt;/a:To>
   &lt;/s:Header>
   &lt;s:Body>
    &lt;Controleer xmlns="http://schemas.vecozo.nl/VZ801802/v1">
     &lt;request xmlns:b="http://schemas.vecozo.nl/VZ801802/v1/messages" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
      &lt;b:Zorgaanbieder i:nil="true" xmlns:c="http://schemas.vecozo.nl/VZ801802/v1/types"/>
      &lt;b:Zoekopdrachten xmlns:c="http://schemas.vecozo.nl/VZ801802/v1/types">
       &lt;c:Zoekopdracht>
        &lt;c:Volgnummer>0&lt;/c:Volgnummer>
        &lt;c:Geboortedatum>1956-01-14&lt;/c:Geboortedatum>
        &lt;c:Peildatum>2013-05-08&lt;/c:Peildatum>
        &lt;c:Bsn i:nil="true"/>
        &lt;c:Verzekerdenummer>FB_60585&lt;/c:Verzekerdenummer>
        &lt;c:Postcode i:nil="true"/>
        &lt;c:ReferentieZorgaanbieder i:nil="true"/>
        &lt;c:Huisnummer i:nil="true"/>
        &lt;c:Huisnummertoevoeging i:nil="true"/>
       &lt;/c:Zoekopdracht>
      &lt;/b:Zoekopdrachten>
     &lt;/request>
    &lt;/Controleer>
   &lt;/s:Body>
  &lt;/s:Envelope></p></li>
  </ul>
  
  <p></pre></code></p>
  
  <p>When running the program, I get an exception, telling me:</p>
  
  <blockquote>
    <p>The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).</p>
  </blockquote>
  
  <p>The vendor told me that he sees two problems in this message:</p>
  
  <ol>
  <li>There's no action defined in the content-type of the header. Content-type should be <code>application/soap+xml;charset=UTF-8;action="http://schemas.vecozo.nl/VZ801802/v1/Controleer"</code></li>
  <li>Both values of MustUnderstand (in Action and To tag) should be 0 instead of 1</li>
  </ol>
  
  <p>I've been searching and searching all kind of places, tried custom headers, etc, etc, but I did not find a way yet to fix those issues.</p>
  
  <p>Anyone out there can help me with this??? I'm quite desperate, for I need to fix this before June 1st.</p>
  
  <p>BTW I am using .NET 4.0
  BTW2 I am using Visual Studio Express 2012 for Windows Desktop to edit my project</p>
  
  <p>EDIT: </p>
  
  <pre><code>[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] 
      [System.ServiceModel.ServiceContractAttribute(Namespace="schemas.vecozo.nl/VZ801802/v1";, ConfigurationName="COV_VZ801802.vz801802Service")] 
      public interface vz801802Service 
      { 
          [System.ServiceModel.OperationContractAttribute(Action="schemas.vecozo.nl/VZ801802/v1/Controleer";, ReplyAction="schemas.vecozo.nl/VZ801802/v1/Controleer/reply")] 
          SOAPLib.COV_VZ801802.ControleerResponseType Controleer(SOAPLib.COV_VZ801802.ControleerRequestType request); 
      }
  </code></pre>