使用 SOAPUI 使用相互证书身份验证测试 WCF [英] Test WCF with Mutual Certificate Authentication using SOAPUI

查看:32
本文介绍了使用 SOAPUI 使用相互证书身份验证测试 WCF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 C# 上的客户端测试具有相互证书身份验证的 WCF 服务,并且它可以工作;现在我想使用 SOAP UI 测试该服务.

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.

这是服务配置:

  <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" />

我阅读了一些关于如何在 SOAPUI 上使用服务证书测试 WCF 服务的信息;但由于 WCF 配置(相互证书),我不知道如何配置 SOAP UI 以测试 WCF Web 服务.

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.

提前致谢.

推荐答案

当我们使用相互证书模式来验证客户端和保护服务器通信时.我们需要建立客户端和服务器之间的信任关系,然后我们在调用服务时在客户端提供客户端证书.对于某些使用消息安全创建的 WCF,我们可能需要在客户端提供服务器端使用的服务证书.
不管怎样,我们在客户端至少有一个客户端证书.在 SOAPUI 中,我们可以为一个请求或所有请求配置客户端证书.
以下是详细步骤.
1. 使用导出向导导出您的客户需要提供的证书.

2. 请勾选导出私钥"选项.

3. 输入您的密码.

4. 为所有请求设置证书.菜单位于主工具栏中的文件 > 首选项.

结果.

如需发送 https 请求,请参考以下链接.与这些步骤类似.
https://www.soapui.org/docs/functional-测试/发送-https-requests.html

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.

2. Please tick "export the private key" option.

3. Input your password.

4. Set up the certificate for all request. the menu locates in the main toolbar File > Preferences.

Result.

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.

这篇关于使用 SOAPUI 使用相互证书身份验证测试 WCF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆