added support for xml and json format in handle response