Search code examples
.netwcfsoapuiws-security

How to get SoapUI to work with ws-security mode 'TransportWithMessageCredential'


I'm trying to create an example request in SoapUI, but i'm not sure how to get it working.

This is a working example in C#:

            var myService = new MyServiceClient("WSHttpBinding_MyService");

            myService .ClientCredentials.UserName.UserName = "User";
            myService .ClientCredentials.UserName.Password = "Password";

            var response = myService.MyMethod("parameter1");

Configuration:

  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="WSHttpBinding_IMyService">
          <security mode="TransportWithMessageCredential">
            <transport clientCredentialType="None" />
            <message clientCredentialType="UserName" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://myWebsite.com:8000/MyService.svc"
          binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMyService"
          contract="MyService.IMyService" name="WSHttpBinding_IMyService" />
    </client>
  </system.serviceModel>

It seems to be that it should not be that hard to get this working in SoapUI, but i keep getting all kind of errors.

Does anyone has a working example for this?


Solution

  • Solved it by disabling 'establishSecurityContext' in the wcf configuration. After doing that, SoapUI is able to make a call.

    Configuration:

      <system.serviceModel>
        <bindings>
          <wsHttpBinding>
            <binding name="WSHttpBinding_IMyService">
              <security mode="TransportWithMessageCredential">
                <transport clientCredentialType="None" />
                <message clientCredentialType="UserName" negotiateServiceCredential="true"
                    establishSecurityContext="false" algorithmSuite="Default" />
              </security>
            </binding>
          </wsHttpBinding>
        </bindings>
        <client>
          <endpoint address="https://myWebsite.com:8000/MyService.svc"
              binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMyService"
              contract="MyService.IMyService" name="WSHttpBinding_IMyService" />
        </client>
      </system.serviceModel>
    

    And check the wsa:To box in SoapUI to get it working:

    enter image description here