Changed creatXMLObject to xmlToJSON. It seems to be working but I haven't fully tested it yet.