Take a 2 litre soda, pour out 1/2 cup and replace it with 1/2 cup white vinegar; soak the area with this solution, then wet a towel large enough to cover the area with solution and cover area. Walk on towel to pick up surface odour/stain. Replace with another towel. The first day you may need to replace the towel 2 or 3 times. When the towel comes up clean with no stain or odour the treatment is done. It is a pain but seems to work - you might want to try a small area first.
A number of pet owners use and like Nature's Miracle, Simple Solution. Whichever product you use, make sure it is enzyme based. These treatments do not harm carpets, and are great to keep around to quickly care for accidents.