The goal of vaccines is to artificially induce a specific primary immune response(and the consequent formation of and memory cells) concerning a given infection or disease in order to immunize the individual against infections by the pathogenic agent in the future.
Since each antibody does not act against a variety of antigens but instead it acts only against its specific antigen, it is necessary for the immune system to make contact in some way with the antigen against which the immunization is wanted. The reconnaissance of specific molecular portions of each antigen causes the immune system to produce the specific variable portion of the immunoglobulins to attack that antigen. Therefore to induce the active immunization it is necessary to inoculate into the body small parts of the infectious agent or the agent entirely (dead or inactivated).