0

我有一个在 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>

服务合约接口:

<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>
4

1 回答 1

0

我最终将我的界面更改为:

  <OperationContract()>
    Function ProcessMessage(ByVal Message As Stream) As String

然后我在我的实现中手动处理了消息的验证。

于 2013-01-21T22:02:42.020 回答