In this paper, the steady flow characteristics around 3-dimensional cavitating or noncavitating bodies (such as hydrofoils, struts and ships) inside a numerical towing tank (NTT) are investigated by an iterative boundary element method (IBEM). The iterative nonlinear method is based on Green's theorem, which is applied to the surfaces of the cavitating or noncavitating surface-piercing body, to the walls of the NTT and to the free surface. The integral equation based on Green's theorem is divided into 5 parts: the surface-piercing body; the free surface; the NTT's right sidewall, left sidewall and bottom surface. Those 5 problems are solved separately, with the effects they have on one another being accounted for in an iterative manner. The cavitating or noncavitating 3-D surface-piercing body is modeled with constant strength dipole and constant strength source panels, distributed over the body surface including the cavity surface. The free-surface part and the NTT's sides and bottom surface are also modeled with constant strength dipole and source panels. The method is first applied to a rectangular surface-piercing hydrofoil and validated with experimental measurements. The method is then applied to a cavitating rectangular hydrofoil, and the effects of the reflected waves from the NTT's sidewalls on cavity characteristics and Kelvin wave pattern are discussed.