【问题标题】:Sending SOAP request to WCF from a not .NET client从非 .NET 客户端向 WCF 发送 SOAP 请求
【发布时间】:2014-10-27 17:02:40
【问题描述】:

如果我从 WPF 客户端应用程序 调用它,我有一个 WCF 网络服务 可以正常工作,该应用程序不在同一台机器或同一域中。客户端应用的 app.config 是:

 <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IMyService" closeTimeout="00:05:00"
          openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00"
          allowCookies="false" bypassProxyOnLocal="false" maxBufferPoolSize="1524288000"
          maxReceivedMessageSize="1524288000" useDefaultWebProxy="true">
          <readerQuotas maxDepth="2000" maxStringContentLength="819200" maxArrayLength="163840" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="TransportWithMessageCredential" />
        </binding>
      </basicHttpBinding>
    </bindings>

    <client>
      <endpoint address="https://my.service.com/MyService.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyService"
        contract="LicenseService.IMyService" name="BasicHttpBinding_IMyService" />
    </client>

调用 WCF 服务后,我用 fiddler 嗅探 SOAP 信封,修改时间戳,复制/粘贴客户端中的内容,例如 Chrome Postman,将请求发送到 WCF我收到一个错误。下面是 SOAP 请求信封和给定的错误,这太笼统了,我在任何地方都找不到好的解决方案。我最好的猜测是它与 WPF 处理安全令牌的方式有关,但我找不到问题所在。令牌只能使用一次吗?有人可以帮忙吗?

错误信息:

由于 EndpointDispatcher 的 ContractFilter 不匹配,接收方无法处理带有 Action '' 的消息。这可能是 因为合同不匹配(不匹配的操作之间 发送者和接收者)或发送者之间的绑定/安全不匹配 和接收器。检查发送方和接收方是否相同 合同和相同的约束力(包括安全要求,例如 消息,传输,无)。

SOAP 信封:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
  <s:Header>
    <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <u:Timestamp u:Id="_0">
        <u:Created>2014-10-24T09:39:11.198Z</u:Created>
        <u:Expires>2014-10-24T09:44:11.198Z</u:Expires>
      </u:Timestamp>
      <o:UsernameToken u:Id="token">
        <o:Username>MyUsername</o:Username>
        <o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</o:Password>
      </o:UsernameToken>
    </o:Security>
  </s:Header>
  <s:Body>
    <GetProduct xmlns="http://tempuri.org/">
      <productGuid>productGuid</productGuid>
    </GetProduct>
  </s:Body>
</s:Envelope>

【问题讨论】:

    标签: wcf soap authorization token


    【解决方案1】:

    WCF 服务将 CustomValidation 与 WS-Security 结合使用。客户端不支持 WS-Security,因此它无法处理 SOAP 消息的标头。此外,客户端中的 WS 令牌未刷新,它已被 WCF 服务使用

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多