I was going to have my carpet cleaned after my tom cat sprayed in the living room. When I called the carpet cleaning man he said to use biological washing powder with warm water (althougth you should test a small patch first) this cleaned the carpet really well and the smell went instantly.
You can also try liberally sprinkling bicarb soda on the carpet and vacuuming it up after about 24 hours. The bicarb soda absorbs the smell really well.