added error reporting for .xml and .json calls