New methods are presented for the numerical integration of ordinary differential equations of the important family of Hamiltonian dynamical systems. These methods preserve the Poincare invariants and, therefore, mimic relevant qualitative properties of the exact solutions. The methods are based on a Runge-Kuttatype ansatz for the generating function to realize the integration steps by canonical transformations. A fourth-order method is given and its implementation is discussed. Numerical results are presented for the Henon-Heiles system, which describes the motion of a star in an axisymmetric galaxy.