Channel protocol possibilities

From: Date: Wed, 03 Mar 2004 18:44:56 +0000
Subject: Channel protocol possibilities
Groups: php.pear.core 
Request: Send a blank email to pear-core+get-167@lists.php.net to get a copy of this message
Hi, I wanted to run by one possible way of implementing Jon Parise's suggestion. First of all, I think the description of what XML-RPC methods are available can be specified down to the method level. One possibility: <protocol type="xml-rpc" name="PEAR"> <!-- allow future types like Stig's dream of php-rpc based around the serialize()/unserialize() functions --> <class name="user"> <implements version="1.0">remove</implements> <implements version="1.0">rejectRequest</implements> <implements version="1.0">activate</implements> <implements version="1.0">isAdmin</implements> <implements version="1.0">listAdmins</implements> <implements version="1.0">exists</implements> <!-- etc. --> </class> </protocol> In this possibility, each method could implement a different API version, and as long as the installer knew which one it was working with, it could be designed to work with both older and newer servers, or fail if the xml-rpc server implements a newer API than the installer. The API could also be defined using xml, and publicly available. I don't think there is any chance that it could be processed by machines, except perhaps in unit testing to verify that the server conforms to the protocol. Mostly it would be for programmers to know what is available. <api type="xml-rpc" name="PEAR" version="1.0"> <class name="user"> <method name="remove"> <param optional="no">string</param> <return>bool</return> </method> <method name="remove"> <param optional="no">string</param> <return>bool</return> </method> <method name="foo"> <param optional="no">string</param> <param optional="yes">bool</param> <return> <object type="PEAR_Userinfo" /> </return> </method> <method name="foo"> <param optional="no">string</param> <param optional="yes">bool</param> <return> <array type="assoc" count="2">
    <index name="bar">string</index>
    <index name="releases">
     <array type="numeric" count="*">
      <array type="assoc" count="4">
       <index name="version">int</index>
       <index name="date">string</index>
      </array>
     </array>
    </index>
</array> </return> </method> </class> </api> It might be better to use wddx to represent the return values, as this is already well defined. This way, users can know right away if their PEAR version will work with the channel, or whether they will need some kind of extension that the channel uses to parse a different API, etc. Even if they don't know, the installer will, and won't do any terrible junk by misinterpreting the XML-RPC data that is returned. Greg

« previous php.pear.core (#167) next »