title: InvalidSecurity when I try to soap call my WCF with Username and Password
body: <p>Error <code>[a:InvalidSecurity] An error occurred when verifying security for the message.</code></p>
  
  <p>I try to call my service like this.</p>
  
  <p><strong>php</strong></p>
  
  <pre><code>&lt;?php
      $soapURL = "https://localhost:8888/wcf/?wsdl" ;
      $soapParameters = Array('userName' =&gt; "user23", 'password' =&gt; "pass123") ;
  
      $soapClient = new SoapClient($soapURL, $soapParameters);
  
      var_dump($soapClient-&gt;GetVersion());
  ?&gt;
  </code></pre>
  
  <p>I got it to work before with no authentication so the fault lies here in the php code or in my app.config on the WCF i believe.</p>
  
  <p>here is my <strong>app.config</strong></p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
    &lt;system.serviceModel&gt;
      &lt;services&gt;
        &lt;service
          behaviorConfiguration="MYDLL.Behavior"
          name="MYDLL.WCFService"&gt;
          &lt;endpoint
            address=""
            binding="basicHttpBinding"
            bindingConfiguration="UsernameAndSSL"
            name="basicHttpBinding"
            contract="MYDLL.IService"/&gt;
          &lt;endpoint
            address="mex"
            binding="mexHttpsBinding"
            bindingConfiguration=""
            name="MexBinding"
            contract="IMetadataExchange"/&gt;
          &lt;host&gt;
            &lt;baseAddresses&gt;
              &lt;add baseAddress="https://localhost:8734/wcf/"/&gt;
            &lt;/baseAddresses&gt;
          &lt;/host&gt;
        &lt;/service&gt;
      &lt;/services&gt;
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior name="MYDLL.Behavior"&gt;
            &lt;serviceMetadata httpsGetEnabled="true"/&gt;
              &lt;serviceCredentials&gt;
                &lt;userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="MYDLL.CustomUserNameValidator, MYDLL"/&gt;
                &lt;serviceCertificate findValue="localhost" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName"/&gt;
              &lt;/serviceCredentials&gt;
            &lt;useRequestHeadersForMetadataAddress /&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
      &lt;bindings&gt;
        &lt;basicHttpBinding&gt;
          &lt;binding name="UsernameAndSSL"&gt;
            &lt;security mode="TransportWithMessageCredential"&gt;
              &lt;transport clientCredentialType="Basic"/&gt;
              &lt;message clientCredentialType="UserName"/&gt;
            &lt;/security&gt;
          &lt;/binding&gt;
        &lt;/basicHttpBinding&gt;
      &lt;/bindings&gt;
    &lt;/system.serviceModel&gt;
    &lt;startup&gt;
      &lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/&gt;
    &lt;/startup&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>and the <strong>customusernamevalidator</strong></p>
  
  <pre><code>public class CustomUserNameValidator : UserNamePasswordValidator
  {
      public override void Validate(string userName, string password)
      {
          Console.WriteLine("User validation succeeded (Username: {0}; Password: {1})", userName, password);
      }
  }
  </code></pre>
  
  <p>What I dont get is if the fault are in my php code or in the config. the <strong>consolewrite</strong> does not run, and I just get that invalidSecurity exception so it seems it knows I have an customusernamevalidation that it cant find?</p>