title: Issues with WCF and SOAP WS-Security PlainText Username (No SSL)
body: <p>We need to consume a SOAP 1.1 Web Service, developed using Java, from within a C#/.Net 4.0 application.  We have no access to the service programming or the server it resides on.  The service is exposed over a non SSL connection and requires WS-Security, Username/PasswordText.</p>
  
  <p>Using SoapUI (http://soapui.org/) we are able to consume the web service simply by creating a project, pointing it to the WSDL and setting up a simple Username/PasswordText WS-Security configuration.</p>
  
  <p>The issue is that we are unable to consume the Web Service using WCF. After some researching, we found information that leads us to believe that the issue may be an incompatibility between SOAP 1.1, WS-Security, and the wsHttpBinding.  The C# code used is the following:</p>
  
  <pre><code>        //The WSService.ServiceClient class is generated by the Service Reference
          var client = new WSService.ServiceClient(); 
  
          client.ClientCredentials.UserName.UserName = "Username";
          client.ClientCredentials.UserName.Password = "Password";
  
          var response = client.MethodToBeConsumed();
  </code></pre>
  
  <p>The binding created is the following:</p>
  
  <pre><code>            &lt;binding name="GeneratedBinding" closeTimeout="00:01:00"
                  openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                  allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                  maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                  messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                  useDefaultWebProxy="true"&gt;
                  &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                      maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
                  &lt;security mode="None"&gt;
                      &lt;transport clientCredentialType="None" proxyCredentialType="None"
                          realm="" /&gt;
                      &lt;message clientCredentialType="UserName" algorithmSuite="Default" /&gt;
                  &lt;/security&gt;
              &lt;/binding&gt;
  </code></pre>
  
  <p>The binding created by the Service Reference is a basicHttpBinding.  We understand that we need to use a wsHttpBinding for WS-Security (SOAP 1.2), but since the serivice uses SOAP 1.1, these two appear to not be compatible.</p>
  
  <p>The correct request message should be (as generated by SOAPUI):</p>
  
  <pre><code>POST http://server:port/Service HTTP/1.1
  Accept-Encoding: gzip,deflate
  Content-Type: text/xml;charset=UTF-8
  SOAPAction: ""
  Authorization: Basic ENCRYPTEDPASSWORD
  User-Agent: Jakarta Commons-HttpClient/3.1
  Host: server:port
  Content-Length: 324
  
  &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:service.version.details"&gt;
     &lt;soapenv:Header/&gt;
     &lt;soapenv:Body&gt;
        &lt;urn:methodName&gt;
           &lt;arg0&gt;1&lt;/arg0&gt;
           &lt;arg1&gt;1&lt;/arg1&gt;
        &lt;/urn:method&gt;
     &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>Is there really no way to achieve this using WCF?  Can this be solved using a customBinding?  Is our only available choice to craft the headers/messages manually and parse the responses?  Do I have to assasinate a web service developer for using WS-Security with SOAP 1.1 over a non SSL connection?</p>