This is how I plan to do my top rail.
legs 50x50x3 steel box
top rail 100x50x3 steel box
6mm or maybe 10mm plates welded on top of the legs and welded to the underside of the top rail.
Bolts will pass through the plates on the legs and will screw into threaded holes in the top rail plates and right through into the box.
These joints will be shimmed to level the top surface of the rail and to ensure both sides are in the same plane.
Before bolting the pieces together I will grind the surfaces of the plates flat, checking with a straight edge
It would be easy to weld 2 further intermediate points if this found to be flexing.

Click image for larger version. 

Name:	toprail.jpg 
Views:	1102 
Size:	67.0 KB 
ID:	10440