My wife had a steamer for clothes and drapery. I took off the attachments and used it to clean the cosmoline in the rifle. That thing heats up the barrel/receiver very quickly so you have to use gloves.
Hot water and WD40 seem easiest. At the range I use Windex, and old cut up flannel cloth to scrub barrel/action after shooting. Oil n go after that.
After you think it's clean, leave it on the patio, in the direct sun with newspapers under it, and see how much cosmo still leaches out. Don't be to surprised to see stains under the papers.
Line a small garbage can with a bag and get a hand held Shark Steamer. Blast away and let the goo drip into the bag. It's by far the least messy way I've ever tried and I've done several cosmo packed mil-surp rifles. The steam is a great way to reduce the dings in wood stocks too.
As someone else mentioned, I find that non-chlorinated brake cleaner spray works great. Strips off the cosmo and evaporates almost instantly. Keep it away from any wood parts though, unless you're planning to strip the finish off of them too. After that, lube with a good gun oil or spray protectant (QCG or Eezox work well). I'd stay away from WD40 unless you're going to do additional cleaning and lube. The WD40 will get gummy if it sits for awhile.
I knew a gun dealer in Louisiana that told me he would get a shipment of Mosin Nagants packed in cosmoline and he put the entire rifle in a tank full of kerosene.
strip it down, put the slide, frame, other big parts in the little thing you put your silverware in, put some soap in and BAM!, make sure you take it out as soon as it's done so it won't rust. If it's blued or parked you shouldnt have a problem, if it has a painted on finish like a CZ, you might be missing some of it when your done.
run the dishwasher empty when your done to cleean it out
I used 'valuecraft' carb cleaner from autozone on my firearms to remove the stuff...It isnt like the gumout brand, seems to be more like off road diesel fuel its even red in color...it works really well. and cheaper than wd-40
Electrical contact cleaner works very well. As where break parts cleaner usually leaves a residue and is pretty harsh,contact cleaner is non-residue and is metal safe. Has worked well for me in the past.