Loading ...
Sorry, an error occurred while loading the content.

Omitting procedure return object wrapper

Expand Messages
  • Weston Ruter
    As I just noted previously in another post, I have been developing a JSON/XML-RPC server class in PHP, implementing the current XML-RPC spec and the JSON-RPC
    Message 1 of 1 , Jul 22, 2007
    View Source
    • 0 Attachment
      As I just noted previously in another post, I have been developing a JSON/XML-RPC server class in PHP, implementing the current XML-RPC spec and the JSON-RPC 1.1 draft spec. In addition to seeing the need to address cross-site requests (as I described in another post), I also want to begin discussing the need to provide the option to omit the procedure return object wrapper.

      In an application that I have been developing, I am using Ext's Tree widget. One of the features of the widget is to be able to build the tree dynamically via Ajax. For example, the initialization code I'm using:

      tree = new Tree.TreePanel('tree', {loader: new Tree.TreeLoader({dataUrl:'server.php/getTreeForExt?JSON-omit-response-wrapper=1'}) });

      The data required by the TreeLoader is pure JSON data as returned by the server function "getTreeForExt". However, the JSON-RPC specification dictates that all procedures must return the method's result wrapped within a procedure return object. This, however, breaks Ext's TreeLoader. So in my implementation of the JSON-RPC server, I introduced a new parameter "JSON-omit-response-wrapper" to enable what Ext's TreeLoader requires. This parameter is not passed to the invoked method.

      By incorporating an HTTP GET parameter such as "JSON-omit-response-wrapper", all JSON data served by the server may be provided through one interface. The client itself is then able to determine how it should receive the data returned by the JSON-RPC service.

      Thoughts?
      Weston
    Your message has been successfully submitted and would be delivered to recipients shortly.