Like Gloster, I have no claim to expertise on this, but traditionally I understand cleaning to have involved a protective coat of oil or tallow. IIRC one of the ideas behind Bullied's "air smoothed casing" was to facilitate mechanical cleaning/washing (which implies a soap and water approach), though I'm not sure this actually materialised. Others will know more.
What is certain is that standards of engine cleaning were much higher in the Victorian era than subsequently. According to Campbell Cornwell, William Stroudley on the LBSC, when finding the handrail on one of "his" locos just slightly greasy, peered at his gloves, said nothing but gave "the driver a look of mournful reproach which spoke volumes." At the other end of the country, Hugh Smellie on the GSWR detailed two cleaners to spend an entire week cleaning a loco in preparation for working a Royal Train - after which he inspected it with "a fine tooth comb". D L Smith records that Smellie said the cleaners had "done a good job - which from Smellie was equivalent to knighthood"!