Johnco
Johnco

Reputation: 4150

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

Upvotes: 1

Views: 2826

Answers (2)

ywarnier
ywarnier

Reputation: 220

I found that adding the

'keep_alive' => false

option to

new SoapClient($url, $options)

solved the issue for me.

There is a related bug report here but very little documentation about it apart from that: https://bugs.php.net/bug.php?id=60329

Upvotes: 4

Johnco
Johnco

Reputation: 4150

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.

Upvotes: 3

Related Questions