The tubules are long thin outgrowths of the alimentary canal each consisting a single layer of cells and closed off at the end; they join the canal at the junction between the midgut and hindgut. Scale insects have just two, while large types of locusts may have up to 200; aphids are the only type of insect with no tubules.
Pre-urine is formed in the tubules, when the nitrogenous waste and electrolytes (sodium, potassium and uric acid) are actively transported through the ends of the tubules. Water follows thereafter. The pre-urine, along with digested food, merge in the hindgut. At this time, uric acid precipitates out, and sodium and potassium are actively absorbed by the hindgut, along with water following through osmosis. Uric acid is left to mix with feces, where they are then ready for excretion.
References
P. J. Gullan and P. S. Cranston, The Insects: an Outline of Entomology, 2nd ed. (Blackwell Science, 2000)
Scott Freeman, Biological Science (Upper Saddle River: Prentice Hall, 2002)
It is unclear as to whether the Malpighiantubules of arachnids and those of the Uniramia are homologous or the result of convergent evolution.
Malpighiantubules are slender tubes normally found in the posterior regions of arthropod alimentary canals.
Hemipteran insects use tubules that permit movement of solutes into the distal portion of the tubules while reabsobtion of water and essential ions directly to the hemolymph occurs in the proximal portion and the rectum.