Fix XMLRPC and add tests.

Change-Id: I4b7ae09f2d2ffcf7626d55c036e3fcbb3523b583