Service Component Architecture (SCA) for PHP
My buddy Southard and I are working on a little side-project: developing web services for an electronics wholesaler. They’re not paying us in any direct way, but we’ll be the first to launch a storefront that runs directly from the web services, and we might resell our own solution as a turnkey product.
At the Zend Conference, one of the highlights was a presentation by Graham Charters entitled “Web Services with SOA with the Service Component Architecture”. My dad told me years ago that web services would dominate the architecture of the future, and I tend to believe him, so I’m very glad to say that SCA makes exposing services (especially web services) ridiculously easy.
SCA uses special annotations, in PHPDocumentor syntax, to turn ordinary classes and public methods into web services magically. Check out the examples, and then dive into the documentation (still short enough to read in a sitting) if you feel like diving deeper.
Using SCA can be useful for more than just the web services you need to implement now. Since SCA allows local and remote services to be treated in exactly the same way, separating services to different servers — or moving remote services in-house — requires only simple changes to the annotations where the moved services are being consumed.
Mr. Charters must have had a version of SCA newer than what is available from the SCA website, because his version had a working JSON binding, which meant that SCA services could automatically produce and consume JSON. More bindings, like REST, are sure to be added in the future, which is why I think developing with SCA sooner rather than later might be a darn good idea. Soon, exposing the same service as SOAP, JSON, and REST will be a trivial (and maybe occasionally advisable) exercise. It will be a no-brainer to use the same service to integrate with remote SOAP-eating enterprise components that you use to do lightweight AJAJ (AJAX - XML + JSON).
SCA is so new to PHP that it only runs on PHP 5.2, released just a few days ago. There is no official Debian/Ubuntu package yet, so Southard upgraded PHP from the Linux Compatible repository. Which brings me to where we are now: Southard, the unfortunate sysadmin of this project, is struggling to get bootleg PHP 5.2 fully operational. Before the upgrade, we were successfully generating valid WSDLs on the fly from our SCA-pimped classes, so I’m confident that our services will be ready for consumption with just a little more prodding of the Ubuntu LAMP machine.







November 13th, 2006 at 10:11 am
Hi Greg,
I’m glad you liked the SCA presentation and demo. This was the first time we’d given the technology and airing, so it is particularly nice to hear that the approach makes sense.
You are correct in observing that I was using a newer version than that on the osoa.org Web site. The json-rpc support was still prototype at the time. We are hoping to put this all up on the PECL site (http://pecl.php.net/packages/sca_sdo) in the next couple of weeks.
Regards, Graham.