.net WCF服务从Java客户端接受POST时出现问题
我有一个WCF(.NET 4.0)服务在IIS 7.5上运行。我需要接受来自Java客户机的请求,但我无法控制该请求。据客户端的家伙说,他们将内容放入soap信封中,签名并通过HTTPS以文本形式发布。听起来很简单,但此错误显示在跟踪日志中: 由于EndpointDispatcher上的ContractFilter不匹配,无法在接收方处理具有操作“xxxxxxx”的消息。这可能是因为合同不匹配(发送方和接收方之间的操作不匹配)或发送方和接收方之间的绑定/安全不匹配。检查发送方和接收方是否具有相同的合同和相同的绑定(包括安全要求,例如消息、传输、无) 相关配置:.net WCF服务从Java客户端接受POST时出现问题,.net,wcf,web-services,.net,Wcf,Web Services,我有一个WCF(.NET 4.0)服务在IIS 7.5上运行。我需要接受来自Java客户机的请求,但我无法控制该请求。据客户端的家伙说,他们将内容放入soap信封中,签名并通过HTTPS以文本形式发布。听起来很简单,但此错误显示在跟踪日志中: 由于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
函数ProcessMessage(ByVal消息作为字符串)作为字符串
编辑:
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>
----------------------
---------------------
-------------------
################
https://sub.domain.com/xxse service/xxservice.svc/ProcessMessage
惊吓
我最终将界面更改为:
<OperationContract()>
Function ProcessMessage(ByVal Message As Stream) As String
函数ProcessMessage(ByVal消息作为流)作为字符串
然后,我在实现中手动处理验证消息。我建议您构建一个示例.NET客户端,并尝试调用您的服务,检查Fiddler发出的原始请求,然后将其与Java客户端请求进行比较,以找出差异。