added support for xml and json for handle response