After RESTing, you may want to JSON your joints.

For example, jsonrpc4j – JSON-RPC for Java has interesting tingle in the name. One shall only see if problems known for XML-RPC perish also here. Good point, however, sounds to be that integrating calls into script languages can be more smooth.

Of course benefits of RPC vs. REST style depends of the goals. REST generally seems to require plenty of extra boilerplate when called from any script language; i.e. framework cannot manage automatic API mapping like in RPC approach. However, REST approach have nice concept of supporting different output types for same methods easily. Doing such in RPC requires either clumsy extra parameters in method calls, or adding separate methods. Both of those lead into nasty cluttering in API (which will hurt with API versioning).

What’s problem with XML-RPC. There is few, starting from standar spec, which supports only very limited datatypes (int32…, no long), and also fact that public API mapped into java interfaces work nicely, but only upto certain point. Problems arise with versioning of API, and if there is any need for varying args, then it becomes easily mess. For both issues, named parameters, instead of indexed (typed) parameters work more gradually. With named parametrers, ordering is more flexible, and also optional parameters are easy to support. However, seesing why there is problem isn’t immediately clear, but it awareness of it raises gradually if thinking a bit further (or perhaps actually trying to manage it).

Authentication
As long as RPC API doesn’t support transparent extra ”auth” parameters, then it requires having explicitly such in every RPC API call. In some way JSON-RPC spec viewpoint into issue seems to be ”not our problem”. Of course, inconvenience of extra auth param can be always resolved via extra layer of indirection, which can make such parameter invisible to actual client (doable with java RMI, so I don’t believe it should be impossible with this one either).

Google groups: JSON-RPC
The Quest for JSON-RPC [In]Security

References:
JSON-RPC 2
JSON-RPC 1
Wikipedia: JSON-RPC
jsonrpc4j – JSON-RPC for Java (higher level abstraction)
JSON-RPC 2.0 Base (low-level java API)
simple is better – RPC / JSON-RPC

/ Development, java , ,

Vastaa

Sähköpostiosoitettasi ei julkaista. Pakolliset kentät on merkitty *

This site uses Akismet to reduce spam. Learn how your comment data is processed.