ID: 49226 User updated by: richard at rjharrison dot org Reported By: richard at rjharrison dot org Status: Open Bug Type: SOAP related Operating System: linux PHP Version: 5.3.0 New Comment:
"Its not in the PHP 5.3 release, rather its a bug in the Zend AutoDiscover class" If it works fine in 5.2(.6) but not in 5.3 then something changed in 5.3 that made things break, which suggests a bug in 5.3. If adding a content-length header fixes things then that's great as a quick-fix, but SoapServer should be able to deal with chunk-encoded responses which don't, by their nature, have a content-length. Previous Comments: ------------------------------------------------------------------------ [2009-08-12 14:01:26] stig dot woxholt at fotoknudsen dot no The service works when using a local file. I did some more tests, and have identified the actual problem. Its not in the PHP 5.3 release, rather its a "bug" in the Zend AutoDiscover class provided by Zend. I assume the reporter also might be using this to generate the WSDL's ? I guess that in php 5.3 the soap server expects the content length to be set in the header inorder to parse the complete wsdl, but the AutoDiscover class does not send this. By adding header('Content-Length: '.strlen($this->_wsdl->toXML())); to the handle function in the AutoDiscover class things are working I'll report the findings on the Zend bugtracker. ------------------------------------------------------------------------ [2009-08-12 13:05:41] richard at rjharrison dot org @sjoerd, When I load the WSDL over HTTP there is no content-length header, as the response is sent chunk-encoded. As stated in the original report, if I save the WSDL to disk then it works, for example:- <?php $data = file_get_contents('http://myserver/path?wsdl'); file_put_contents("wsdl.xml", $data); $serv = new SoapServer("wsdl.xml"); // works ?> @stig, The behaviour you describe with different size WSDL might backup the theory that it's chunk-encoding related. With a small body size, I think PHP *does* send a content-length header; but if the body is larger than the output buffer (?) it will switch to chunk-encoding to allow for the unknown, variable length. ------------------------------------------------------------------------ [2009-08-12 11:39:05] sjoerd-php at linuxonly dot nl Thank you for your bug report. When you retrieve the WSDL over HTTP, does the Content-Length header match the length of the WSDL? You can try saving the WSDL to disk and load that one instead. ------------------------------------------------------------------------ [2009-08-12 10:52:46] stig dot woxholt at fotoknudsen dot no We have started porting our soap services from 5.2.x to 5.3 and see the same problem here. I have spend quite some time trying to identify the problem, and it seemes to me that when the wsdl reaches a certain size it stops working. Ie. i have a service with 10 exposed methods. When all these methods are exposed i get an error, same as Richards. If i cut down on the number of exposed methods, to ie. 3 on the service it works. This is services that is used in production on the 5.2.x builds, and works perfectly there. Looks to me that there might be a bug in the XML parsing of the WSDL somewhere. ------------------------------------------------------------------------ [2009-08-11 19:30:45] richard at rjharrison dot org Description: ------------ SoapServer is failing on construction. I pass an URL with *valid* WSDL xml, which is generated automatically. - If I save the WSDL locally and load from disk it works. - If I serve the WSDL remotely from a static .xml file it works. - If I load the WSDL-url in my browser I get a well-formed XML response. - I can access the dodgy-wsdl URL via file_get_contents. - Using 5.2.6 on another machine it works fine. I inspected the http requests and think it could be related to chunked encoding (it fails on the chunked encoding response). Reproduce code: --------------- <?php $url = 'http://myserver/path?wsdl'; $serv = new SoapServer($url); ?> I can probably provide a sample url privately. Expected result: ---------------- $serv to be instantiated Actual result: -------------- SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://myserver/path?wsdl' : Premature end of data in tag definitions line 2 Below are the headers of the response that fails:- Date: Tue, 11 Aug 2009 19:15:29 GMT Server: Apache/2.2.8 (Unix) DAV/2 PHP/5.3.0 X-powered-by: PHP/5.3.0 Vary: Accept-Encoding,User-Agent Connection: close Transfer-encoding: chunked Content-type: text/xml ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49226&edit=1