PHP Bugs  
php.net | support | documentation | report a bug | advanced search | search howto | statistics | login

go to bug id or search bugs for  

Bug #43069 SoapClient causes 505 HTTP Version not supported error message
Submitted:22 Oct 2007 4:33pm UTC Modified: 1 Dec 2008 9:54am UTC
From:sebastian dot habeker at roli dot com Assigned to:dmitry
Status:Closed Category:SOAP related
Version:5.2.6 OS:Windows 2000
Votes:17 Avg. Score:4.2 ± 1.1 Reproduced:14 of 14 (100.0%)
Same Version:8 (57.1%) Same OS:5 (35.7%)
View/Vote Developer Edit Submission

[22 Oct 2007 4:33pm 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.

[12 Nov 2007 10:15am UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi

[15 Nov 2007 11:44am 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?
[25 Jan 2008 10:56am UTC] rob dot smith at gmx dot de
Same problem here.

OS: Windows XP
PHP: 5.2.6
[25 Mar 2008 8:49pm 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?
[31 Oct 2008 6:59am 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.
[28 Nov 2008 7:27pm 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#xmlCreateURLPars
erCtxt).

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
[1 Dec 2008 9:54am 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));

RSS feed | show source 

PHP Copyright © 2001-2009 The PHP Group
All rights reserved.
Last updated: Sat Nov 21 10:30:49 2009 UTC