|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-10-22 16:33 UTC] sebastian dot habeker at roli dot com
Description: ------------ I am trying to use PHP as a SOAP client with a MSSQL 2005 SOAP endpoint. I can query the wsdl in my browser without a problem, but in PHP I get the error: Warning: SoapClient::SoapClient(http://myuri?wsdl) [function.SoapClient-SoapClient]: failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version not supported in C:\scripts\test.php on line 2 Warning: SoapClient::SoapClient() [function.SoapClient-SoapClient]: I/O warning : failed to load external entity "http://myuri?wsdl" in C:\scripts\test.php on line 2 Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://myuri?wsdl' in C:\scripts\test.php:2 Stack trace: #0 C:\scripts\test.php(2): SoapClient->SoapClient('http://...', Array) #1 {main} thrown in C:\scripts\test.php on line 2 A TCP trace shows the following: GET /uri?wsdl HTTP/1.0 Host: 10.20.30.40 HTTP/1.1 505 HTTP Version not supported Content-Length: 0 Server: Microsoft-SQL/9.0 Microsoft-HTTPAPI/1.0 Date: Mon, 22 Oct 2007 15:44:13 GMT Connection: close Reproduce code: --------------- <? $client = new SoapClient('http://myuri?wsdl'); ?> Expected result: ---------------- It should be able to use HTTP/1.1 instead of HTTP/1.0 for the SOAP client request. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 18:00:02 2025 UTC |
The problem is in soap_xmlParseFile(): old_allow_url_fopen = PG(allow_url_fopen); PG(allow_url_fopen) = 1; ctxt = xmlCreateFileParserCtxt(filename); PG(allow_url_fopen) = old_allow_url_fopen; The code is trying to take advantage of the php's tcp wrapper functionality around fopen calls so it can use xmlCreateFileParserCtxt() with a URL. Unfortunately, the tcp wrapper functionality only supports HTTP/1.0. This may fixable by using xmlCreateURLParserCtxt() instead of xmlCreateFileParserCtxt(). The documentation says it supports files and URLs (source: http://www.xmlsoft.org/html/libxml-parserInternals.html#xmlCreateURLParserCtxt). I have no endpoint with which to test against this bug. Someone please apply the following patch and test it or email me (hermanradtkePLZNOSPAM at gmail dot com) the URL to an endpoint that only supports HTTP/1.1. Patch: http://www.hermanradtke.com/php-43069-soap-client-http1_1.patchFixed in CVS HEAD and PHP_5_3 (not in PHP_5_2). Now ext/soap uses HTTP/1.1 by default, but it's possible to switch back to HTTP/1.0 using stream context $ctx = stream_context_create(array( 'http'=>array( 'protocol_version'=> 1.0, ))); $soap = new SoapClient($wsdl,array("stream_context"=>$ctx));