|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-01-06 16:28 UTC] daniel dot gorski at develnet dot org
Description:
------------
The \SoapClient (and probably the \SoapServer) stumble over WSDL files that are delivered via HTTP in chunks, carrying the HTTP response header "Transfer-Encoding: chunked".
Reproduce code:
---------------
$sc = \SoapClient('http://any.wsdl/that/is/delivered/in/chunks');
Expected result:
----------------
No error, intantiation and initialization of the \SoapClient object.
Actual result:
--------------
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from [URL]: Start tag expected, '<' not found in [FILE]
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
Workaround : Use a stream context specifying the protocol 1.0 of HTTP : $opts = array('http' => array('protocol_version' => '1.0')); $context = stream_context_create($opts); $this->client = new SoapClient($wsdl, array('stream_context' => $context));To test using the built-in web server: # create file header-test.php <?php $spaces = str_repeat(' ', $_GET['s']); header("Transfer-Encoding:{$spaces}Chunked"); echo "5\nHello\n0\n"; # Run server php -S localhost:8080 header-test.php & # Compare output with 1 vs 2 spaces $http_1_1_ctx = stream_context_create(["http" => ["protocol_version" => "1.1", "header" => "Connection: Close"]]); // Reports 'Hello', hides Transfer-Encoding header: file_get_contents('http://localhost:8080/?s=1', false, $http_1_1_ctx); var_dump($http_response_header); // Reports raw chunk data, shows Transfer-Encoding header: file_get_contents('http://localhost:8080/?s=2', false, $http_1_1_ctx); var_dump($http_response_header);