php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43069 SoapClient causes 505 HTTP Version not supported error message
Submitted: 2007-10-22 16:33 UTC Modified: 2008-12-01 09:54 UTC
Votes:17
Avg. Score:4.2 ± 1.1
Reproduced:14 of 14 (100.0%)
Same Version:8 (57.1%)
Same OS:5 (35.7%)
From: sebastian dot habeker at roli dot com Assigned: dmitry (profile)
Status: Closed Package: SOAP related
PHP Version: 5.2.6 OS: Windows 2000
Private report: No CVE-ID: None
 [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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-11-15 11:44 UTC] sebastian dot habeker at roli dot com
I downloaded http://snaps.php.net/win32/php5.2-win32-installer-latest.msi but still got the same problem. Is there anything else to configure, in the php.ini or as an option in the SoapClient constructor?
 [2008-01-25 10:56 UTC] rob dot smith at gmx dot de
Same problem here.

OS: Windows XP
PHP: 5.2.6
 [2008-03-25 20:49 UTC] nick dot riggan at gmail dot com
I am having the same exact problem.  I am running MSSQL 2005 also and have set up an endpoint.  I can load in the browser without issues but not with the SOAP client in PHP.  Has anyone solved this?
 [2008-10-31 06:59 UTC] umerfarooq dot online at gmail dot com
I am using Rest Request/ response mechanism for web services and i am also getting this error.Is there any solution to this besides having to upgrade or change the php version.
 [2008-11-28 19:27 UTC] hradtke@php.net
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.patch

 [2008-12-01 09:54 UTC] dmitry@php.net
Fixed 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));

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC