Changed sequence of JSON-RPC messaging when executing commands

Change-Id: Ie65bca10334d568f354882bfe6690feab46b043c