More Web Services

I have been working closely with Matthew Weier O’Phinney for the last week on bringing my Zend_Service_Server proposal to fruition.

There have been several changes, but the core has not moved too far. Matthew, Andi and I have decided that we will first implement the different server/client libraries, that is:

  • Zend_Rest_Server and Zend_Rest_Client
  • Zend_XmlRpc_Server and Zend_XmlRpc_Client (already released)

In addition to this, there will be a major WSDL supplement for the SOAP extension, this includes:

  • Zend_Soap_Wsdl – Generic WSDL creation, manual calls to create a custom WSDL
  • Zend_Soap_Wsdl_Parser – WSDL Parser
  • Zend_Soap_Wsdl_CodeGenerator (name pending) – WSDL -> PHP Code Skeleton
  • Zend_Soap_AutoDiscover – Following the same API as the servers above, this will allow you to automatically generate WSDL from a PHP class or functions.

The core to all of these is found under Zend_Server, these are:

  • Zend_Server_Reflection – PHP Class and Function Reflection, including docblock parses and the ability to serialize for caching
  • Zend_Server_Interface – Make a compatible Server of your own
  • Zend_Server_Abstract – Some stuff you’ll almost always need in a server

Furthermore, as an exercise today I spent an entire 20 minutes implementing Zend_Json_Server which works in the same way, register any normal class or functions and any responses will be returned as JSON. What this means is it is now super easy to deploy and utilize Server to Server SOAP/XML-RPC/REST services, and also Client to Server JSON or REST services – all with very little work. Code Re-use is definitely utilized to the maximum here.

We are still working out the finalities with Zend_Server_Reflection and also the Zend_Service_Server replacement, that is the unified API that will automatically dispatch to any of these services.

The final part of this will be the automated HTML documentation, based on the reflection. This will be optional to expose (defaults to on), but a great way to simply code and forget. Documentation is probably the single most important part of an external API – if nobody knows how to use it, well, then it’s just pointless.

This is very exciting for me, I hope others will see this a major step forward for “Enterprise” solutions.

– Davey