title: WSE012: The input was not a valid SOAP message because the following information is missing: action
body: <p>
  We're trying to access a webservice (which I believe is also coded using WCF, but I have no control over it whatsoever) and I get an exception:</p>
  
  <blockquote>
    <p><a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.faultexception(v=vs.100).aspx" rel="nofollow noreferrer">System.ServiceModel.FaultException</a>: WSE012: The input was not a valid SOAP message because the following information is missing: action.<br>
    Server stack trace:</p>
  </blockquote>
  
  <pre class="lang-cs prettyprint-override"><code>at System.ServiceModel.Channels.ServiceChannel.HandleReply(
     ProxyOperationRuntime operation, ProxyRpc&amp; rpc)
  at System.ServiceModel.Channels.ServiceChannel.Call(String action,
     Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs,
     TimeSpan timeout)
  at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(
     IMethodCallMessage methodCall, ProxyOperationRuntime operation)
  at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
  </code></pre>
  
  <blockquote>
    <p>Exception rethrown at [0]: </p>
  </blockquote>
  
  <pre class="lang-cs prettyprint-override"><code>at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(
     IMessage reqMsg, IMessage retMsg)
  at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(
     MessageData&amp; msgData, Int32 type)
  at ClientName.ProjectName.Services.ServiceName.ServiceNameSoap.CallServiceName(
     Request request)
  at ClientName.ProjectName.Scheduler.ThirdPartyName.ProcessServiceName.Execute(
     Object state) in ...\ProcessServiceName.cs:line 65
  </code></pre>
  
  <p>The calling code in <code>ProcessServiceName.Execute</code> reads:</p>
  
  <pre class="lang-cs prettyprint-override"><code>Request serviceRequest = request.BuildServiceRequest();
  Result result = client.CallServiceName(serviceRequest);
  LogServiceErrors(db, request.ServiceNameRequestId, result.errors);
  </code></pre>
  
  <p>and the exception is coming from the second of those lines, which calls directly into the WCF code autogenerated by the Service Reference, calling <a href="http://msdn.microsoft.com/en-us/library/aa344730(v=vs.100).aspx" rel="nofollow noreferrer"><code>System.ServiceModel.ClientBase&lt;T&gt;. Channel</code></a><code>.CallServiceName(request)</code>; the method <code>BuildServiceRequest</code> just takes the database object and converts it to the object required by the webservice.</p>
  
  <p>The relevant part of the <code>App.config</code> (this is called within a Windows Service) reads:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;system.serviceModel&gt;
     &lt;bindings&gt;
        &lt;webHttpBinding&gt;
           &lt;binding name="webBinding"&gt;
           &lt;/binding&gt;
        &lt;/webHttpBinding&gt;
        &lt;wsHttpBinding&gt;
           &lt;binding name="ThirdPartySoap" closeTimeout="00:01:00"
            openTimeout="00:01:00" receiveTimeout="00:10:00"
            sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false"
            hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
            maxReceivedMessageSize="65536" messageEncoding="Text"
            textEncoding="utf-8" useDefaultWebProxy="true"&gt;
              &lt;readerQuotas maxDepth="32" maxStringContentLength="8192"
               maxArrayLength="16384" maxBytesPerRead="4096"
               maxNameTableCharCount="16384"/&gt;
              &lt;security mode="Transport"&gt;
                 &lt;transport clientCredentialType="Basic" proxyCredentialType="None"
                  realm="www.serviceprovider.com"/&gt;
                 &lt;message clientCredentialType="UserName"
                  algorithmSuite="Default"/&gt;
              &lt;/security&gt;
           &lt;/binding&gt;
        &lt;/wsHttpBinding&gt;
     &lt;/bindings&gt;
     &lt;client&gt;
        &lt;endpoint name="ServiceNameSoap"
         address="https://www.serviceprovider.com/ServiceName.asmx"
         binding="wsHttpBinding" bindingConfiguration="ThirdPartySoap"
         contract="ServiceName.ServiceNameSoap"/&gt;
     &lt;/client&gt;
  &lt;/system.serviceModel&gt;
  </code></pre>
  
  <p>Given that all the code that does the actual webservice work is from within WCF, I don't quite understand what the problem is but, presumably, I need something slightly different in my <code>App.config</code> to prevent it.</p>
  
  <p>Having <a href="https://www.google.co.uk/search?q=FaultException%3A+WSE012%3A+&quot;not+a+valid+SOAP+message&quot;+&quot;information+is+missing%3A+action&quot;" rel="nofollow noreferrer">looked on Google</a>, I'm finding nothing of any help. On StackOverflow, <a href="https://stackoverflow.com/q/7570610/205245">this unanswered WCF question from September 2011</a> is of no help; custom bindings (<a href="https://stackoverflow.com/a/1676838/205245">answer from November 2009</a> and <a href="http://social.msdn.microsoft.com/Forums/en/wcf/thread/256455d7-079c-4f09-84eb-202c121a2664" rel="nofollow noreferrer">link about WSE</a>) don't help (and I barely understand them), and both <a href="http://www.soapui.org/forum/viewtopic.php?t=2672" rel="nofollow noreferrer">a forum answer from November 2009</a> and <a href="http://forums.adobe.com/message/2326727" rel="nofollow noreferrer">a ColdFusion thing from October 2009</a> are unrelated. All the other Google hits I'm seeing are duplicates of these links.</p>
  
  <p><em>Any</em> assistance would be greatly appreciated!</p>
  
  <hr>
  
  <h2>Edit to add more detail</h2>
  
  <p><a href="https://stackoverflow.com/users/941240/wiktor-zychla">Wiktor Zychla</a> has rightly pointed out that the problem could (theoretically) be in the proxy classes. However, these classes are wholly unedited from the classes generated automatically; for example:</p>
  
  <pre class="lang-cs prettyprint-override"><code>using System.CodeDom.Compiler;
  using System.ServiceModel;
  using System.ServiceModel.Channels;
  
  namespace ClientName.ProjectName.Services.ServiceName
  {
     [GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
     public interface ServiceNameSoapChannel : ServiceNameSoap, IClientChannel {}
  
     [System.Diagnostics.DebuggerStepThroughAttribute()]
     [GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
     public partial class ServiceNameSoapClient : ClientBase&lt;ServiceNameSoap&gt;,
       ServiceNameSoap
     {
       public ServiceNameSoapClient() { }
  
       public ServiceNameSoapClient(string endpointConfigurationName) : 
         base(endpointConfigurationName) { }
  
       public ServiceNameSoapClient(string endpointConfigurationName,
         string remoteAddress) :
         base(endpointConfigurationName, remoteAddress) { }
  
       public ServiceNameSoapClient(string endpointConfigurationName,
         EndpointAddress remoteAddress) :
         base(endpointConfigurationName, remoteAddress) { }
  
       public ServiceNameSoapClient(Binding binding,
         EndpointAddress remoteAddress) : base(binding, remoteAddress) { }
  
       public Result CallServiceName(Request request)
       { return base.Channel.CallServiceName(request); }
     }
  }
  </code></pre>
  
  <p>All the other proxy classes are similarly unedited from the autogenerated code (which I've edited here for whitespace and namespace optimisation, so that it fits better on screen within StackOverflow; the three namespaces I've added <code>using</code> statements for were fully-qualified on all class references, as was the namespace I've redacted to <code>ClientName.ProjectName.Services.ServiceName</code> in these samples.</p>
  
  <p>Having added <a href="http://msdn.microsoft.com/en-us/library/ms730064(v=vs.100).aspx" rel="nofollow noreferrer">WCF Message Logging</a>, I get the following in my message log. (This is from a different service call than the code above, but throwing the same exception, partly because this service call is simpler, partly because not all service calls are being logged, for some reason. The only edit I have made is to make the error message legible without horizontal scrolling.)</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"&gt;
    &lt;System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"&gt;
      &lt;EventID&gt;0&lt;/EventID&gt;
      &lt;Type&gt;3&lt;/Type&gt;
      &lt;SubType Name="Information"&gt;0&lt;/SubType&gt;
      &lt;Level&gt;8&lt;/Level&gt;
      &lt;TimeCreated SystemTime="2013-01-18T12:00:04.7166250Z" /&gt;
      &lt;Source Name="System.ServiceModel.MessageLogging" /&gt;
      &lt;Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" /&gt;
      &lt;Execution ProcessName="ClientName.ProjectName.Scheduler" ProcessID="8600" ThreadID="10" /&gt;
      &lt;Channel/&gt;
      &lt;Computer&gt;MachineNameRedacted&lt;/Computer&gt;
    &lt;/System&gt;
    &lt;ApplicationData&gt;
      &lt;TraceData&gt;
        &lt;DataItem&gt;
          &lt;MessageLogTraceRecord Time="2013-01-18T12:00:04.7166250+00:00" Source="TransportSend" Type="System.ServiceModel.Dispatcher.OperationFormatter+OperationFormatterMessage" xmlns="http://schemas.microsoft.com/2004/06/ServiceModel/Management/MessageTrace"&gt;
            &lt;s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"&gt;
              &lt;s:Header&gt;
                &lt;a:Action s:mustUnderstand="1"&gt;http://www.serviceprovider.com/RedactedActionName&lt;/a:Action&gt;
                &lt;a:MessageID&gt;urn:uuid:395d6394-5f4b-4954-8df0-8fb82d17072a&lt;/a:MessageID&gt;
                &lt;a:ReplyTo&gt;
                  &lt;a:Address&gt;http://www.w3.org/2005/08/addressing/anonymous&lt;/a:Address&gt;
                &lt;/a:ReplyTo&gt;
                &lt;a:To s:mustUnderstand="1"&gt;https://www.serviceprovider.com/ServiceName.asmx&lt;/a:To&gt;
              &lt;/s:Header&gt;
              &lt;s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
                &lt;RedactedActionName xmlns="http://www.serviceprovider.com"&gt;
                  &lt;brandId&gt;2&lt;/brandId&gt;
                &lt;/RedactedActionName&gt;
              &lt;/s:Body&gt;
            &lt;/s:Envelope&gt;
          &lt;/MessageLogTraceRecord&gt;
        &lt;/DataItem&gt;
      &lt;/TraceData&gt;
    &lt;/ApplicationData&gt;
  &lt;/E2ETraceEvent&gt;
  &lt;E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"&gt;
    &lt;System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"&gt;
      &lt;EventID&gt;0&lt;/EventID&gt;
      &lt;Type&gt;3&lt;/Type&gt;
      &lt;SubType Name="Information"&gt;0&lt;/SubType&gt;
      &lt;Level&gt;8&lt;/Level&gt;
      &lt;TimeCreated SystemTime="2013-01-18T12:00:04.7635000Z" /&gt;
      &lt;Source Name="System.ServiceModel.MessageLogging" /&gt;
      &lt;Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" /&gt;
      &lt;Execution ProcessName="ClientName.ProjectName.Scheduler" ProcessID="8600" ThreadID="10" /&gt;
      &lt;Channel/&gt;
      &lt;Computer&gt;MachineNameRedacted&lt;/Computer&gt;
    &lt;/System&gt;
    &lt;ApplicationData&gt;
      &lt;TraceData&gt;
        &lt;DataItem&gt;
          &lt;MessageLogTraceRecord Time="2013-01-18T12:00:04.7635000+00:00" Source="TransportReceive" Type="System.ServiceModel.Channels.BufferedMessage" xmlns="http://schemas.microsoft.com/2004/06/ServiceModel/Management/MessageTrace"&gt;
            &lt;soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"&gt;
              &lt;env:Header xmlns:env="http://www.w3.org/2003/05/soap-envelope"&gt;
                &lt;wsa:Action&gt;http://schemas.xmlsoap.org/ws/2004/08/addressing/fault&lt;/wsa:Action&gt;
                &lt;wsa:MessageID&gt;urn:uuid:b72c6f30-8409-4b55-8c79-056d82f990a5&lt;/wsa:MessageID&gt;
                &lt;wsa:To&gt;http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous&lt;/wsa:To&gt;
              &lt;/env:Header&gt;
              &lt;soap:Body&gt;
                &lt;soap:Fault&gt;
                  &lt;soap:Code&gt;
                    &lt;soap:Value&gt;soap:Sender&lt;/soap:Value&gt;
                  &lt;/soap:Code&gt;
                  &lt;soap:Reason&gt;
                    &lt;soap:Text xml:lang="en"&gt;
                      WSE012: The input was not a valid SOAP message because
                      the following information is missing: action.
                    &lt;/soap:Text&gt;
                  &lt;/soap:Reason&gt;
                &lt;/soap:Fault&gt;
              &lt;/soap:Body&gt;
            &lt;/soap:Envelope&gt;
          &lt;/MessageLogTraceRecord&gt;
        &lt;/DataItem&gt;
      &lt;/TraceData&gt;
    &lt;/ApplicationData&gt;
  </code></pre>
  
  <h2>    </h2>
  
  <h2>Even more detail: ServiceNameSoap interface</h2>
  
  <p>As <a href="https://stackoverflow.com/users/941240/wiktor-zychla">Wiktor Zychla</a> has requested, here is the <code>ServiceNameSoap</code> interface declaration, from the autogenerated code, again edited only to fit better on screen (hence the <code>using</code>) and to redact the the client-confidential names:</p>
  
  <pre class="lang-cs prettyprint-override"><code>using System.ServiceModel;
  
  [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel","4.0.0.0")]
  [ServiceContractAttribute(Namespace="https://www.serviceprovider.com/",
      ConfigurationName="ServiceName.ServiceNameSoap")]
  public interface ServiceNameSoap
  {
      [OperationContractAttribute(
          Action="https://www.serviceprovider.com/ServiceName",
          ReplyAction="*")]
      [XmlSerializerFormatAttribute(SupportFaults=true)]
      [ServiceKnownTypeAttribute(typeof(ClientRequest))]
      [return: MessageParameterAttribute(Name="result")]
      ClientName.ProjectName.Services.ServiceName.Result CallServiceName(
          ClientName.ProjectName.Services.ServiceName.Request request);
  }
  </code></pre>