Recent Changes - Search:



Related Projects

Powered by PmWiki



Why don't use CURL to perform remote calls?

CURL, created by Daniel Stenberg, it's an excellent library to communicate with remote servers, however there was difficulties making it work with the Hessian protocol.

It can easily perform a POST request to a url and correctly send headers and post fields but I was not able to correctly send Hessian binary data in the body of the request, not even as a file upload attachment. After some attempts, I was able to communicate with a HessianPHP web service, but not with Caucho's Java server which is the reference implementation.

Another problem I had was SSL. I have set up a web server with SSL enabled but I couldn't make CURL communicate with it, PHP complains that SSL is not supported in my distribution. (PHP 4.3.8 Win32).

So I decided to create a simple HTTP caller (HttpConnection class) using sockets and so far it has worked very well. I will keep researching CURL and other libraries like PEAR::HTTP_Request and Snoopy, but for now, current implementation works fine and it keeps external dependencies to the minimum.

UPDATE: Finally I was able to get CURL send the correct data to Hessian Java but only by performing a file upload using a temporal file that gets created and deleted for each call. This is one of the most ugly hacks in the entire face of earth since there is NO chance to send binary data with CURL to a Hessian Java service unless you open a *real* file pointer and pretend to upload a file. Doesn´t work with custom stream wrappers neither. Maybe someone will fix this in a later version of PHP. (Tested against Hessian 3.0.8/ Resin 3.0.10)

NEW UPDATE (for RC1) : Unfortunately CURL support was removed from HessianPHP because of two reasons. First, several new tests did not show any performance increase compared with the pure PHP solution, mostly due to the use of the temporary file; and Second, for some reason CURL's binary transfer doesn't seem to get along with Tomcat server and since this is one of the most popular servers for Java deployment I think it makes no sense to mantain CURL support anymore.

Edit - History - Print - Recent Changes - Search
Page last modified on December 24, 2005, at 01:41 AM

PmWiki can't process your request

Cannot acquire lockfile

We are sorry for any inconvenience.