繁体   English   中英

WSDL第一个WCF服务器,其中客户端不发送SOAPAction

[英]WSDL first WCF server where client does not send SOAPAction

我正在实现一个WCF Web服务,该服务与我无法控制的代码进行交互。 WSDL由客户端提供。

我使用SvcUtil从WSDL生成C#文件,除了这里讨论的错误我没有问题。

在启用了SSL的IIS 7.0中托管服务(客户端需要)后,我试图让客户端向服务发出请求。

此时我收到以下错误:

The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver.  Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).

我验证了我可以使用服务发布的元数据和SOAPUI来发出相同的请求。 这很好。

然后,我尝试使用客户端提供的WSDL来使用SOAPUI。 这失败,上面出现同样的空操作错误。

然后我连接了Wireshark(启用SSL解密)并验证从客户端发送的消息确实缺少SOAPAction,因此看起来这肯定是个问题。

因为我无法更改客户端是否有办法让WCF Web服务与这样的客户端进行交互? 我猜它需要接受没有SOAPAction的请求,而是从SOAP信封中的请求对象类型派生所需的请求?

以下为我工作(基于线程):

  1. 下载Microsoft WCF示例。
  2. 从WF_WCF_Samples \\ WCF \\ Extensibility \\ Interop \\ RouteByBody \\ CS \\ service将以下文件添加到项目中
    • DispatchByBodyOperationSelector.cs
    • DispatchByBodyBehaviorAttribute.cs
  3. 将以下属性添加到您的界面( ServiceContract旁边)
    • XmlSerializerFormat
    • DispatchByBodyBehavior
  4. 将以下内容添加到服务界面

     [OperationContract(Action = "")] public void DoNothing() { } 
  5. 对于我的服务,WrapperName和Wrappernamespace对于所有消息都为null 我不得不进入DispatchByBodyBehaviorAttribute并编辑ApplyDispatchBehavior()以添加以下行来检查:

      if (qname.IsEmpty) { qname = new XmlQualifiedName(operationDescription.Messages[0].Body.Parts[0].Name, operationDescription.Messages[0].Body.Parts[0].Namespace); } 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM