2012-08-15 108 views
0

我有一个运行在IIS 7.5上的WCF(.NET 4.0)服务。我需要接受来自我无法控制的Java客户端的请求。根据客户端的人,他们将内容放入肥皂信封中,签名并通过HTTPS将其作为文本发布。听起来很简单,但是这个错误显示在跟踪日志中:WCF服务接受来自Java客户端的POST问题

由于EndpointDispatcher中的ContractFilter不匹配,无法在接收方处理带有操作'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> 
+1

我建议你构建一个示例.NET客户端,并尝试调用您的服务并检查使用Fiddler创建的原始请求,然后将其与Java客户端请求进行比较以找出差异。 – Rajesh 2012-08-16 08:57:53

回答

0

我最终改变我的INTERF ace到:

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

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