与客户端证书身份验证的WCF与soapui不起作用
我有一个带有basicHttpBinding,消息安全模式和证书客户端凭证类型的wcf服务。我可以通过wcf客户端来使用这个服务,但是这个服务也必须在另一个带有java客户端的系统中使用。我正在使用soapui进行测试,但是我获得了空的响应或安全消息错误。我已经尝试variuos soapui配置来加载客户端证书,但没有一个工作。我通过http(非https)公开了服务,这是服务器wcf配置:与客户端证书身份验证的WCF与soapui不起作用
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicEndPoint" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8"
transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647"/>
<security mode="Message">
<message clientCredentialType="Certificate" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="customBehavior">
<clientCredentials>
<clientCertificate findValue="ClientSide" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My"/>
<serviceCertificate>
<defaultCertificate findValue="ServerSide" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My"/>
<authentication certificateValidationMode="PeerOrChainTrust"/>
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint address="http://localhost:8080/WebServices/ExternalServices.svc"
behaviorConfiguration="customBehavior" binding="basicHttpBinding"
bindingConfiguration="basicEndPoint" contract="ServiceReference1.IExternalServices"
name="BasicHttpBinding_IExternalServices" >
<identity>
<certificateReference findValue="ServerSide" storeName="My" storeLocation="LocalMachine" x509FindType="FindBySubjectName" />
<dns value="ServerSide"/>
</identity>
</endpoint>
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange"/>
</client>
</system.serviceModel>
这个设置有什么问题? 在此先感谢
我不是WCF
专家(甚至没有用户:P),但基于配置:
<endpointBehaviors>
<behavior name="customBehavior">
<clientCredentials>
<clientCertificate findValue="ClientSide" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My"/>
<serviceCertificate>
<defaultCertificate findValue="ServerSide" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My"/>
<authentication certificateValidationMode="PeerOrChainTrust"/>
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
似乎是为了打你的服务器端点必须出示证明客户端凭据。
所以要从SOAPUI调用您的服务,您可以做两件事情,首先使用https公开您的服务,以便客户端可以提供证书凭证。其次配置SOAPUI为遵循客户端证书发送到端点:
从菜单中选择文件>首选项,然后SSL设置。在此面板中选择包含有效的服务客户端密钥和证书密钥库,并把存储密码,可选择标示所需的客户端身份验证:
注:根据您的配置:
<clientCertificate findValue="ClientSide"
x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My"/>
有效客户证书必须是在位于服务器的Windows本地密钥库中的证书颁发机构颁发的最终实体证书。
我很难设置SOAPUI进行WCF客户端证书认证测试。最后我得到了它的工作。 面对不同的问题,如:SNI支持问题,无符号'To'标题Getting WCF to accept unsigned 'To' Header和其他。
我建议打开WCF跟踪,您可以在服务器上获得详细的错误信息:https://msdn.microsoft.com/en-us/library/ms732023(v=vs.110).aspx因此可以轻松排除故障。
欢迎来到StackOverflow!将链接中的相关材料复制到答案可能是一个好主意,因此如果链接发生变化,您的答案仍然有帮助 – DeadChex
感谢您的回复。我已经尝试过这些配置;在使用basichttpbinding之前,我已经使用https设置了wshttpbinding,并且选择了密钥存储和密码,但没有成功。谷歌搜索,我读到wshttpbinding不是很好的互操作性,所以我改变它basichttpbinding和尝试没有https。我很想知道是否有某些地方存在一些关于如何使用soap wcf身份验证证书开发服务的官方指南,这些证书不仅与wcf客户端兼容。 – VariableName
@VariableName我有一些关于PKI,SSL等的知识。但正如我在答案中所说的,我没有* WCF *的混合体验......我想这个主题肯定有gudelines,但我不'不知道在哪里可以找到它,对不起。 – albciff