Theoretical models of piezoelectric energy harvesting from railway systems using patch-type and stack-type piezoelectric transducers are studied. An infinite Euler-Bernoulli beam on a Winkler foundation subjected to moving multi-loads is adopted to describe the dynamic behavior of railway track. The voltage and electric power of piezoelectric transducers installed at the bottom of a steel rail are derived analytically. Comparisons with earlier works and experimental results are given, indicating that the present solutions are reliable. Additionally, a parametric study is conducted to discuss the effects of axle loads, running velocity and load resistors on the solutions. The numerical results show that patch-type and stack-type piezoelectric transducers can harvest the available energy from track vibration to supply power for a wireless sensor network node and can also serve as sensors to monitor basic train information, such as the running velocity, the location and the axle load. The present investigations provide a theoretical guide in the design of piezoelectric patch and stack energy harvesters used in railway systems, which can serve as power sources for distributed wireless sensor networks in remote areas. The research results also demonstrate the potential of piezoelectric patches and stack harvesters in designing self-powered wireless sensor networks used in railway systems to ensure train operation safety.