PHP SoapClient __get_last_response() cut off? Max response size? Stream closed?
===

I am trying to use PHP SoapClient to make a SOAP call. The response I get back is quite large.

I have looked at the resulting TCP stream with Wireshark and verified the SOAP request and response look correct. The XML is well-formed on both sides.

However, in the PHP side, I am seeing strange things. About half the time I make the request, I get back an "Error Fetching HTTP Headers" response. The other half, I get back a "looks like we got no XML document" error.

Now, that's very confusing, given that I can verify in Wireshark that there is actually a valid XML document coming back.

I enabled the "trace" option on SoapClient and logged the response to a file:

    file_put_contents("/var/tmp/test", $this->soap_client->__getLastResponse());

And what I see is surprising. The file always gets cut off at the same point:

    $ wc -c /var/tmp/test 
    1140658 /var/tmp/test

And it's an incomplete response, because, well, it's cut off. But Wireshark shows it as a complete response.

I tried adjusting the SoapClient connection_timeout and the default_socket_timeout in php.ini and neither change seems to have done anything for me.

Anyone have any ideas?