The Schotten-Baumann reaction is an organic reaction used to convert an acyl halide or anhydride to an amide if reacted with an amine and base, or an ester if reacted with an alcohol and base. The reaction with the amine begins with the nitrogen attacking the carbonyl carbon of the acyl halide which rearranges to kick out the halide. Deprotonation with the base then provides the final amide product. The reaction with the alcohol would happen in a similar fashion.
Schotten, C. Ber. Dtsch. Chem. Ges. 1884, 17, 2544–2547.
Baumann, E. Ber. Dtsch. Chem. Ges. 1886, 19, 3218–3222.