我在IIS 7.5上运行了WCF(.NET 4.0)服务。我需要接受来自Java客户端的请求,我无法控制。根据客户端的人员,他们将内容放入肥皂信封中,签名并通过HTTPS将其作为文本发布。听起来很简单但是这个错误出现在跟踪日志中:
由于EndpointDispatcher上的ContractFilter不匹配,无法在接收方处理带有Action'xxxxxxx'的消息。这可能是由于合同不匹配(发送方与接收方之间的操作不匹配)或发送方与接收方之间的绑定/安全性不匹配。检查发件人和收件人是否具有相同的合同和相同的约束(包括安全要求,例如邮件,传输,无)。
相关配置:
<basicHttpBinding>
<binding name="XXhttpBinding">
<security mode="Transport">
</security>
</binding>
</basicHttpBinding>
<service name="XXXWcfLib.XXMessageService" behaviorConfiguration="XXBehavior">
<endpoint address="ProcessMessage" binding="basicHttpBinding" bindingConfiguration="XXhttpBinding" contract="XXXWcfLib.IXXMessageService" name="ProcessMessage">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<host>
<baseAddresses>
<add baseAddress="https://sub.domain.com/XXService/XXXService.svc" />
</baseAddresses>
</host>
</service>
ServiceContract接口:
<OperationContract()>
Function ProcessMessage(ByVal Message As String) As String
编辑:
来自java客户端帖子的标题:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<SOAP-SEC:Signature SOAP:mustUnderstand="1" xmlns:SOAP- SEC="http://schemas.xmlsoap.org/soap/security/2000-12" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> </CanonicalizationMethod>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"> </SignatureMethod>
<Reference URI="#Body">
<Transforms>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></Transform>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod>
<DigestValue>----------------------</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>---------------------</SignatureValue>
<KeyInfo>
<X509Data>
<X509Certificate></X509Certificate>
<X509IssuerSerial>
<X509IssuerName>-------------------</X509IssuerName>
<X509SerialNumber>################</X509SerialNumber>
</X509IssuerSerial>
</X509Data>
</KeyInfo>
</Signature>
</SOAP-SEC:Signature>
<To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">https://sub.domain.com/xxse rvice/xxservice.svc/ProcessMessage</To>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">appaction</Action>
</s:Header>
答案 0 :(得分:0)
我最终将界面更改为:
<OperationContract()>
Function ProcessMessage(ByVal Message As Stream) As String
然后我在我的实现中手动处理了验证消息。