Attached is a complete Drupal 7 version. The module has been refactored for D7 & Services 3 APIs. Also the code has been cleaned up. The server class JsonRpcServer is clean and improved.

Improvements

  1. Drupal 7 port.
  2. Services 3 compatibility.
  3. Code cleanup & coding standards fixes.
  4. PHP 5.3 compatibility.
  5. The "GET" method is now collapsing multiple parameters with the same name in arrays.
  6. The "GET" method can be disabled from the endpoint configuration form.
  7. Added also support for HTTP Content-Type(s): application/json-rpc, application/jsonrequest along with application/json. This is a JSON-RPC recommendation.
  8. Removed support for other Content-Types as they break recommendations.
  9. Simplified the whole flow in JsonRpcServer::handle().
  10. JSON-RPC 2.0: Check against positional and named parameters mixture.
  11. JSON-RPC 1.1: Check if there are 2 candidate parameters for the same argument. This may happen only in JSON-RPC 1.1 where a positional parameter may overlap a named parameter or viceversa.
  12. Fill unsent optional parameter with their "default value" or with NULL.
  13. Fixed #1255006: Return application's error code. Now if the application is responding with an error code it will replace the standard JSON-RPC error codes.

7.x-1.x branch

Till a maintained Drupal 7 branch will be created here, use the sandbox project JSON-RPC Server for Drupal 7

Backport

There will be no backport for the new features or improvements for Drupal 6. However, anybody can create backport patches and post them back to JSONRPC Server.

Comments

claudiu.cristea’s picture

Issue summary: View changes

Updated issue summary.

Daniel_KM’s picture

Hi,

Thanks for this version!

@Hugo Wetterberg: When will the claudiu.cristea 7.x version of JSON-RPC server be merged here? It works fine. You have nothing to do: simply add him as a committer. It's important, because some companies doesn't accept modules in sandboxes and because a stable version should be marked as stable.

Thanks,

Sincerely,

Daniel Berthereau
Infodoc & Knowledge management

djg_tram’s picture

Claudiu, any progress with integrating the D7 version into this project? I already found two bugs and it would be nice to be able to send a patch. :-)

The first one is the version problem also mentioned in your sandbox project issue queue, the second one is jsonrpc_server.class.inc, line 265, function validateParam(). The first if should read:

if (!$arg['optional'] && !isset($param)) {

Using empty() instead of isset() causes a perfectly valid parameter with a value of zero (int or string) to be dismissed as non-existent.

djg_tram’s picture

May I also suggest shorter error messages, more in sync with the specification (also, correcting one or two grammar problems)? Like, for instance:

  • Invalid request.
  • Parse error.
  • Method "@method" not found.
  • Invalid params (@params sent, @args expected)
  • Invalid params (both named and positional).
  • Invalid params ("@name" unknown).
  • Invalid params (argument "@arg" required).

Also see http://www.jsonrpc.org/specification .

djg_tram’s picture

Issue summary: View changes

Updated issue summary.