creating factory for consuming rest web services, initial state of controllers