Conclusion

It is desirable to use a timeout for SOAP requests, so that you can inform the user that something is wrong within a reasonable time. When using HTTP, this can be configured using socket_default_timeout. When using HTTPS, it is quite hard to configure a timeout. In fact, you have to implement a subset of HTTP yourself, something which PHP should take care of. Our example code shows how to send the request and wait for a response, using a timeout, while still using most of the functionality of the built-in SoapClient class.