【发布时间】:2020-03-12 15:11:36
【问题描述】:
使用VS2019,ASP.NET项目运行.net 4.0。
我创建了将服务引用添加到 wsdl 文件的 soap 客户端。现在我正在配置证书和调用方法。
这种方式在旧的soap 服务器中有效,但现在soap 服务器发生了变化。我使用相同的基本身份验证配置对 SoapUI 进行了测试,并且可以完美运行,但不适用于我的 .Net 4.0 客户端...
Web.config
<system.serviceModel>
<bindings>
<customBinding>
<binding name="PLATAFORMA">
<textMessageEncoding messageVersion="Soap11WSAddressing10" />
<security
authenticationMode="MutualCertificateDuplex"
messageProtectionOrder="SignBeforeEncrypt"
messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10">
<secureConversationBootstrap />
</security>
<httpsTransport />
</binding>
</customBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="CERT">
<clientCredentials>
<clientCertificate findValue="ClientCert" storeLocation="CurrentUser" storeName="My" x509FindType="FindBySubjectName" />
<serviceCertificate>
<defaultCertificate findValue="*.ServerCert.com" storeLocation="CurrentUser" storeName="My" x509FindType="FindBySubjectName" />
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint
address="endpointURI"
binding="customBinding"
bindingConfiguration="PLATAFORMA"
behaviorConfiguration="CERT"
contract="ServiceReference1.RequestPort1"
name="Request.Request1">
<identity>
<dns value="*.ServerCert.com" />
</identity>
</endpoint>
</client>
</system.serviceModel>
XML Outoing header(被拦截器捕获):
<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<a:Action s:mustUnderstand="1">peticionSincrona</a:Action>
<a:MessageID>urn:uuid:e3a5c4bd-f159-48c1-8f3f-cf22da6b7e3b</a:MessageID>
<ActivityId CorrelationId="035f2491-0772-4b1e-a286-9be30720d5ea" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">4d7f76c2-0486-4a81-93ad-32aecf02b035</ActivityId>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<VsDebuggerCausalityData xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink">uIDPo9ph/BcvvnBFuLQYdch+LyYAAAAAHsOKxYeqzk+Do5pQmamNIPUdiXOiYjpBl1dsV5pp+SMACQAA</VsDebuggerCausalityData>
</s:Header>
我了解需要一些信息,如何指定以 XMLDsig 签名?为什么不是肥皂/信封/编码?我需要帮助来配置soap客户端。
服务器返回错误 500 并带有默认的 tomcat 错误,甚至不是 soapenv:fault 或类似错误。我认为请求信封没有正确生成。
编辑:必须超过soap11
【问题讨论】:
标签: asp.net wcf soap x509certificate ws-security