GRE-247: fix XML command serialization and added test cases.