Lucas Vargas
Lucas Vargas

Reputation: 1

wshttpbinding and custombinding don't work with soapClient PHP


I can't do a SoapClient in PHP for connect to a WCF Service with with TransportWithMessageCredential clientCredentialType UserName.
SoapClient says:
Cannot process the message because the content type 'application/soap+xml; charset=utf-8; action="http://tempuri.org/ISecurityService/GetDocuments"' was not the expected type 'text/xml; charset=utf-8'.

This is my code of 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>

And this is my code in PHP https://pastebin.com/ctVEKX6w

My code is based in two links:
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

Does anyone know how to avoid this?
Thanks in advance, Regards,

Upvotes: 0

Views: 548

Answers (0)

Related Questions