Both. When the damage get calculated, you prevent most damage by having balance between HP and defense stats. So, if you want a Pokemon - with high HP stat -, to be your wall, then it's best to invest EV's in Def/SDef.
My source is pure experience :)
Hope this helped!