IIS7 PHP WSDL issue

If you ever run into a scenario where you need to run a PHP SOAP webservice in an IIS environement, you might encounter the following problem. When generating a client proxy in .NET/WCF this exception is thrown;

The server committed a protocol violation. Section=ResponseHeader Detail=CR must be followed by LF

The problem, as it turns out, is that ASP.NET appends the HTTP X-Powered-By header. This header seems to confuse the proxy generation code. To fix the issue you need to remove this IIS header. Head to your IIS Manager > You website > The folder your PHP webservice is located > Click HTTP Response header. Then remove the X-Powered-By header. Now enjoy generating proxies!

Some evil internet voices claim that you should set useUnsafeHeaderParsing to false in your clients’ application configuration to make .NET ignore the inconsistency in your webservice WSDL output. This however is a workaround, not a solution. So if you run the webservice apply the header fix as described above.

Remove IIS headers

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>