Soap Dispenser works intermitently

The soap dispenser works intermitenly. What activates it? If it has to be replaced, how do you remove it from the door? I seems like it is glued in.