Download & Extend

Replace XML-RPC with REST API

Project:Mollom
Version:7.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:sun
Status:closed (duplicate)

Issue Summary

Replace the low-level XML-RPC communication with a new REST API.

Do not apply this patch, it breaks the module's functionality and your site.

With that being said, here's the plan:

  1. Replace the XML-RPC communication and response handling with REST/drupal_http_request(), but still keep everything in mollom().
  2. Ensure the REST API understands the identical request parameters and returns the identical values.
  3. Ensure that error handling still works as expected.
  4. For now, Drupal 7 resp. PHP5 only.

    In Drupal 6, we can't rely on native PHP5 XML helpers and Drupal's built-in XML parser helper functions (relying on xml_parse()) is not able to parse the returned XML for unknown reasons currently. Therefore, separate issue.

  5. To focus on the actual replacement, the current patch simply converts/maps the old mollom.fooBar methods to new REST methods within mollom().

    This may change once the functionality works - OTOH, each method can only be called in a unique way, so instead of adding separate $request_method and $path parameters to mollom() and updating all the calling code, it might make more sense and be smarter to keep this idea/direction and advance on it instead (PHP class).

  6. Especially the new CAPTCHA methods need attention.

    The old XML-RPC API always had to be called in order to retrieve a CAPTCHA URL, whereas the new REST way simply allows to retrieve a CAPTCHA in different formats on a certain URL. This requires us to parse out, store/remember, and re-use the server name and session ID. The consequence of doing so is that the client-side server/load balancing only kicks in once, initially when requesting/creating the CAPTCHA resource.

  7. Various methods are still missing in the new REST API on the backend. Therefore, not everything can be converted yet.
AttachmentSizeStatusTest resultOperations
mollom-rest.0.patch20.18 KBIgnored: Check issue status.NoneNone

Comments

#1

This one works to some extent already; still contains a couple of workarounds for backend responses.

AttachmentSizeStatusTest resultOperations
mollom.rest_.1.patch19.78 KBIgnored: Check issue status.NoneNone

#2

Status:needs work» closed (duplicate)

Marking as duplicate of #446994: Implement a generic Mollom PHP class, since I started to work on a class with the goal to support either REST or XML-RPC to get this code into the master branch earlier.

Even though it's likely that we're going to remove the XML-RPC client code entirely, the class half-way exists now, it only makes sense to bite into the bullet and solve two major issues at once.

nobody click here