wshttpbinding和custombinding不适用于soapClient PHP

时间:2019-01-07 19:30:47

标签: php soap web-config soap-client wshttpbinding


我无法在PHP中使用SoapClient与TransportWithMessageCredential clientCredentialType UserName连接到WCF服务。
SoapClient说:
由于内容类型为'application / soap + xml,因此无法处理该消息; charset = utf-8; action =“ http://tempuri.org/ISecurityService/GetDocuments”'不是预期的类型'text / xml; charset = utf-8'。

这是我的web.config代码

<bindings>

  <wsHttpBinding>
    <binding name="wsSecureBinding">
      <security mode="TransportWithMessageCredential">
        <message clientCredentialType="UserName" />
      </security>
    </binding>
  </wsHttpBinding>
  <basicHttpsBinding>
    <binding name="BasicHttpsBinding_IService" closeTimeout="00:10:00"
      openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
      allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
      maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
      textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"
      messageEncoding="Text">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <security mode="Transport">
        <transport clientCredentialType="None" proxyCredentialType="None"
          realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>
  </basicHttpsBinding>
</bindings>

<services>
  <service
    name="Middleware.Services.SecurityService"
    behaviorConfiguration="ServiceWithMetaData">
    <endpoint name="wsSecureService"
              address=""
              binding="wsHttpBinding"
              bindingConfiguration="wsSecureBinding"
              contract="Middleware.Interfaces.ISecurityService"/>
  </service>
</services>

这是我在PHP中的代码 https://pastebin.com/ctVEKX6w

我的代码基于两个链接:
How to consume a WCF Web Service that uses custom username validation with a PHP page?

[Connecting to WS-Security protected Web Service with PHP

[3]:Connecting to WS-Security protected Web Service with PHP

有人知道如何避免这种情况吗?
提前致谢, 问候

0 个答案:

没有答案