Johnco Johnco - 7 months ago 61
PHP Question

SSL: Broken pipe accesing SOAP service with PHP's SoapClient

I have a SOAP WS which I access through PHP's SoapClient (wrapped with Zend Framework's Soap Client). The webservice runs through https, and the calls take quite some time (a few minutes each).

I am making 4 calls, one after another through the same instance of SoapClient. However, after some time running, and at a random point (not allways on the same method call) I see the following error:

Warning: SoapClient::__doRequest(): SSL: Broken pipe in pathtomyfile


I still have no idea why this happened, but I've got some extra insight and a workaround.

The issue arises when, after a SOAP call that took really long to run, I try to use the same connection for another request. The first one will succeed, but upon the new call, the error raises.

This means, that as long as you don't NEED the connection to be same (which is usually the case on SOAP web services), you can just reset the connection between calls. Not the most efficient use of resources, but will work flawlessly.