How to workaround PHP’s SOAPClient bug when connecting over SSL
Today, while integrating SecPay (aka PayPoint) payment gateway with an ecommerce site I’m working on, I came across a very annoying problem with PHP’s SOAPClient implementation.
When talking to a SOAP interface the first thing you want to do is obviously connect to the endpoint:
This looks correct and innocent, however it produces this nasty error:
Changing SOAPClient parameters doesn’t help and disabling wsdl cache in php.ini doesn’t do much either.
After googling a bit I found a couple of bug reports. It turns out PHP has issues talking to endpoints over SSL. *Sigh*.
Here’s a workaround I came up with to force PHP to connect:
error_reporting(0);
$this->soap = new SoapClient(‘https://www.secpay.com/java-bin/services/SECCardService?wsdl’);
error_reporting($orig_error_reporting);
As you can see the idea is simple. Just turn off error reporting before instantiating soapclient and restore it afterwards.
I hope this helps some of you frustrated by this bug.









Leave a reply right here....