Pikemen are especially effective if they manage to get close. A practical approach though, is to use cavalry - especially light cavalry which are somewhat less susceptible to missile damage. Cavalry can close in fast and quite effective in groups.
Massed war wagon are pretty hard to beat and will take down much of your pikemen or cavalry before they get close. One alternative approach that I've seen used (but never used myself) is to use a small group of onagers. The onagers are kept behind other units for protection so they don't get attacked right away, and they all attack at once once they get in range. This only works if they are fully upgraded, and even then this is basically a sacrificial strategy, you you will end up losing your onagers to the war wagons that survive the initial attack. But it does destroy a number of war wagons and weaken the others, and give a better chance for other units to close in.