-
Webservices make everything easy
Posted on June 6th, 2009 No commentsScenario: PHP application has to use a couple of Webservices provided bei .NET/C#/IIS/whatever.
Should be easy, right? Not when you have to login with a separate webservice call to use the services you really want. This little fun thing requires the client to actually process cookies. Which the PHP SOAPClient does surprisingly well, without brute force required. But the server kept loosing the session sometimes. We tried different PHP versions, different operating systems, different internet connections, hell, I even hacked together a client in Java.
Then we finally figured it out: the server didn’t care if the Client says he only speaks HTTP 1.0, the server just asumed HTTP 1.1. Which essentially requires to make all the webservice calls over the same TCP connection. This is where it gets tricky.
The PHP SOAPClient allows you to reimplement a method named “__doRequest”, which does the actual network operations. So we took a HTTP 1.1 compliant connector (Zend_HTTP_Client), and implemented the request handling with it. Should be fine now, right?
Guess again, now we are actually getting to the strangest part. For some Reason, die SOAPClient crashed PHP right within __doRequest. While trying to debug it, I discoverd something REALLY strange. Tho following code, added to __doRequest, makes PHP crash less often:
ob_start();
print “abc”;
ob_end_clean();And to make it even stranger, if you replace the “print” with an “echo”, it doesn’t help anymore. WTF?!? My guess is, that __doRequest has a memory leak under certain conditions, which lets everything else go south from there on.
PHP, Rant .NET, bug, C#m, Java, Memory Leak, PHP, SOAP, SOAPClient, WebserviceLeave a reply


