0

我有一个 WCF 路由器设置,其中客户端使用可靠消息传递 (RMP) 通过 WS Http 绑定与目标服务进行通信。当客户端服务与路由器之间的连接是 WS HTTP 并且路由器与目标服务之间的连接是 WS HTTP 时,一切都按预期工作。我在 SOAP 数据包到达路由器时记录它们,它们看起来像:

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:r="http://docs.oasis-open.org/ws-rx/wsrm/200702" xmlns:a="http://www.w3.org/2005/08/addressing">
  <s:Header>
    <r:Sequence s:mustUnderstand="1">
      <r:Identifier>urn:uuid:76bac170-ace3-4a9b-8a5f-eba263cbdf57</r:Identifier>
      <r:MessageNumber>1</r:MessageNumber>
    </r:Sequence>
    <a:Action s:mustUnderstand="1">http://tempuri.org/Foo/Connect</a:Action>
    <a:MessageID>urn:uuid:d76b500f-f59e-41a1-9831-cb33e2f9eb3c</a:MessageID>
    <a:ReplyTo>
      <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
    </a:ReplyTo>
    <a:To s:mustUnderstand="1">http://foobox:62435/RouterService.svc</a:To>
  </s:Header>
  <s:Body>
    <Connect xmlns="http://tempuri.org/">
      <!-- Request body removed -->
    </Connect>
  </s:Body>
</s:Envelope>

这将返回一个有效的响应。

问题是当我切换到客户端服务和路由器之间的 HTTPS 连接并保持路由器和目标服务之间的 WS HTTP 连接时,它正在记录 WS-RM 消息:

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
  <s:Header>
    <a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence</a:Action>
    <a:MessageID>urn:uuid:96d7c674-471e-4c9d-8ba5-7a1c8ed3275b</a:MessageID>
    <a:To s:mustUnderstand="1">https://foobox:44300/RouterService.svc</a:To>
  </s:Header>
  <s:Body>
    <CreateSequence xmlns="http://schemas.xmlsoap.org/ws/2005/02/rm">
      <AcksTo>
        <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
      </AcksTo>
      <Offer>
        <Identifier>urn:uuid:de2129d5-58f2-4672-915f-eb3196d51bff</Identifier>
      </Offer>
    </CreateSequence>
  </s:Body>
</s:Envelope>

这会在客户端服务中生成以下 ActionNotSupported 异常:

由于 EndpointDispatcher 的 ContractFilter 不匹配,接收方无法处理带有 Action ' http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence ' 的消息。这可能是因为合约不匹配(发送方和接收方之间的操作不匹配)或发送方和接收方之间的绑定/安全不匹配。检查发送方和接收方是否具有相同的合同和相同的绑定(包括安全要求,例如消息、传输、无)。

考虑到服务接口不处理CreateSequence消息,这个错误是有道理的,但我不确定为什么切换到 SSL 会导致这些消息被显式发送到目标服务。

我该怎么做才能让路由器正确传递/处理 WS-RM 数据包?

更新:

WS HTTP over Transport Security 不允许(似乎)允许可靠消息传递(生成错误),因此客户端到路由器的连接使用具有可靠消息传递的 HTTPS 绑定。我认为问题在于路由器需要将 RM 操作消息转换为 WS HTTP 消息,但我不确定如何执行此操作。

4

1 回答 1

0

弄清楚了。

路由器上面向客户端服务的端点被设置为使用可靠消息传递与客户端的 HTTPS 绑定匹配的,WsHttpBinding而不是。CustomBinding将其更改为使用正确的绑定后,流量现在可以毫无问题地通过路由器。

于 2013-09-11T22:48:17.010 回答