cristhian caldas
cristhian caldas

Reputation: 1

Test WCF with Mutual Certificate Authentication using SOAPUI

I´m trying to test a WCF service with mutual certificates authentication using a client on C# and it works; now I want to test the service using SOAP UI.

This is the service configuration:

  <system.serviceModel>
<services>
  <service behaviorConfiguration="ServiceBehavior"  name="WS_XXXXX.WcfXXXX">
    <endpoint address="" 
        binding="customBinding" bindingConfiguration="XXXSoap" bindingNamespace=""
        contract="IXXXSoap" >
    </endpoint>
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:47037/"/>
      </baseAddresses>
    </host>
  </service>
</services>
<bindings>
  <customBinding>
    <binding name="XXXSoap">
      <security authenticationMode="SecureConversation"
                   requireSignatureConfirmation="false"
                   canRenewSecurityContextToken="true"
                   messageProtectionOrder="SignBeforeEncrypt"
                   messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11"
                   requireDerivedKeys="false" >
      <secureConversationBootstrap 
           authenticationMode="MutualCertificate"
           requireSignatureConfirmation="true"
                   canRenewSecurityContextToken="true"
                   messageProtectionOrder="SignBeforeEncrypt"
                   messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11"
                   requireDerivedKeys="false">
      </secureConversationBootstrap>
      </security>
      <textMessageEncoding messageVersion ="Soap11WSAddressingAugust2004"  >
      </textMessageEncoding>
      <httpTransport />
    </binding>
  </customBinding>


</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="ServiceBehavior" >
      <serviceCredentials>

        <serviceCertificate findValue="WCfClient"
                            storeLocation="CurrentUser"
                            storeName="My"
                            x509FindType="FindBySubjectName" />
      </serviceCredentials>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

I read some info on how to test a WCF service with service certificate on SOAPUI; but because of the WCF configuration (mutual certificates), I don´t know how to configure the SOAP UI for test the WCF web service.

Thanks in advance.

Upvotes: 0

Views: 1369

Answers (1)

Abraham Qian
Abraham Qian

Reputation: 7522

When we use mutual certificate mode to authenticate the client and protect the server communication. We need to establish the trust relationship between the client and the server, then we provide the client certificate on the clients-side when calling the service. For some kinds of WCF created with message security, we might need to on the client-side provide the service certificate that the server-side used.
Anyhow, we at least a client certificate on the client-side. In SOAPUI, we are able to configure the client certificate for one request or all request.
Here are steps details.
1. Export your certificate that your client needs to provide by using the export wizard.
enter image description here
2. Please tick “export the private key” option.
enter image description here
3. Input your password.
enter image description here
4. Set up the certificate for all request. the menu locates in the main toolbar File > Preferences.
enter image description here
Result.
enter image description here
For sending https request for one, please refer to the below link. It is similar to these steps.
https://www.soapui.org/docs/functional-testing/sending-https-requests.html

Feel free to let me know if the problem still exists.

Upvotes: 1

Related Questions