wshttpbinding и custombinding не работают с PHP на soapClient - PullRequest
0 голосов
/ 07 января 2019


Я не могу сделать SoapClient в PHP для подключения к службе WCF с помощью TransportWithMessageCredential clientCredentialType UserName.
SoapClient говорит:
Невозможно обработать сообщение, потому что тип содержимого 'application / soap + xml; кодировка = 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

Мой код основан на двух ссылках:
Как использовать веб-службу WCF, которая использует пользовательскую проверку имени пользователя со страницей PHP?

[ Подключение к защищенной веб-службе WS-Security с помощью PHP

[3]: Подключение к защищенной WS-Security веб-службе с помощью PHP

Кто-нибудь знает, как этого избежать?
Заранее спасибо, С уважением,

...