I understand the difference between soldering and welding. What I'm confused with is how do you chose which one to use, when is one more suitable than the other and when one should be avoided. I hope someone here could explain.
For the benefit of other readers, let me start with a brief explanation, and I'll expand the terminology to include brazing. Soldering and brazing are the same process, the difference is the temperature at which it happens. Both involve using a filler metal that melts far below the temperature of the base metal to be joined; when this process happens below 842°F it's called soldering, above that temperature it's called brazing.
Welding involves melting the base metal so the liquid metal from the two pieces to be joined flows together. Additional metal of the same kind can be melted and added as filler. This creates a single, solid piece of the base metal. The strength of the joint will be determined by the amount of metal there and how the "heat treatment" of the melting process affects it.
If we ignore spot welding for this discussion, where sheets of metal are overlapped and then melted together at small spots, welding is typically an "edge" process. Pieces are butted against each other and the edges are melted together, or the edge of one piece is melted to the face of another piece. Welding typically takes place on an exposed surface, and strength is achieved by filling or building to create the desired thickness of metal.
Soldering / Brazing
Soldering and brazing are a bit like hot gluing metal together with other metal. Metal with a melting temperature much lower than the base metal is melted and used like glue to stick the base metal pieces together (done by heating the base metal to above the melting point of the filler metal, and that melts the filler metal). The solder or brazing material forms a metallurgical bond with the base metal, but it doesn't have the mechanical strength of the base metal. So you can't butt two pieces of base metal together, connect them with some solder, and expect the solder to perform as if you have a solid piece of base metal.
Solder and brazing joints rely on a different principle. The mechanical strength comes from the base metal; typically, two pieces of the base metal overlap and a thin layer of the solder or brazing material between them keeps them from sliding or pulling apart. The liquefied solder or brazing material flows over the base metal surface in a thin layer through wetting the surface and flowing as a liquid, and by being drawn into gaps via capillary action.
The strength doesn't come from the filler metal. The filler metal is typically just a few thousandths of an inch thick. The strength comes from a large surface area, where the stresses are trying to shear a lot of filler metal the "long" way, or trying to pull it apart across a large surface.
As Chris H points out in a comment, brazing can also be used for some welding-style joints. If you use a filler metal that has mechanical strength and melts below the temperature of the base metal, it can be melted and built up around the joint so that the filler metal is providing the mechanical strength of the joint (called "fillet brazing"). In this case, the strength of the joint depends on the mechanical properties of the filler metal, how thick it is, and how much area of base metal it's bonded to.
When to use which
Both approaches can have similar, or at least adequate, strength. Ignoring the fact that welding takes specialized equipment and more skill, there are a number of considerations that go into the choice of approach.
Nature of the joint. As described above, the type of joint may point to one method or the other. For example, if you need to butt two edges together, soldering/brazing generally won't be a good solution. If you need to join two thin nesting tubes and ensure the joint will hold liquid or gas under pressure (think copper plumbing or refrigeration systems), welding is not a good solution.
Strength requirement. If strength is a critical factor and the joint needs to have at least the same strength as the base metal, some joint configurations may require welding.
Size. Soldering/brazing requires heating a large surface to above the melting temperature of the filler. Two massive metal base pieces may conduct heat away too fast for soldering/brazing to be practical, or to evenly heat the entire joint. Welding uses very localized heat, so large pieces can be joined with a series of welds.
At the other size extreme, welding is too crude. For a weld to have useful strength, it needs to involve a substantive amount of metal, and the melt area will be large enough to readily see. Welding isn't typically suitable for something like assembling jewelry components. The melt area will visibly affect the shape of the piece. And if you need to fix the shape by grinding the weld, you're often wasting precious metals. So jewelry-making normally uses soldering.
Material to be joined. The heat required for welding might distort the pieces to be joined. Thin material can melt and flow away from the surrounding material, destroying the shape or integrity of the material. Soldering or brazing keeps everything below the melting temperature of the base metal.
The type of base metal may introduce considerations. Soldering or brazing requires use of a filler metal that will wet and bond with the base metal. At welding temperatures, some metals quickly oxidize, so welding may require use of special equipment that keeps the molten metal in a chemically inert atmosphere.
The need to join dissimilar metals. Soldering and brazing allow you to join two different base metals, which you can't do with welding.
Post-joining requirements. If the joined pieces might ever need to be separated, soldering/brazing would allow that (e.g., reworking copper plumbing). If the joined pieces might be exposed to high heat, either in subsequent fabrication steps or the environment in which it will be used, welding might be required to prevent the joint from falling apart.
Appearance and cleanup. Welding typically doesn't leave a nice finished appearance. If appearance is important, the joint usually requires grinding. If soldering or brazing leaves excess material, it is easily melted so it self-levels or can be wiped away. It is also typically softer than the base metal and is easily abraded in a controlled way to give it a finished appearance.
Industrial process. In an industrial or mass production setting, there can be considerations of speed and cost.
These aren't all of the considerations, but it will provide a flavor of the decision factors.