You don't really need flux to solder wire to rail if you use a rosin-core solder. If you are using it, use it sparingly. Whether you use it or not, be sure to clean the rail with a file or some fine sandpaper before you solder. Tin the tip of the hot iron with the solder, and wipe it off on a wet sponge.
Make sure your wire is in place before you touch the iron to anything. Solder is not a replacement for a good physical connection. Lay the wire next to the rail (on the spot you cleaned), then touch the tip of the iron to the wire and the rail (the idea is you want to heat them both up at the same time).
Let the iron warm up the wire and the rail, then touch the solder to the rail just above the wire. If the rail is hot enough, the solder will melt and flow onto the rail and wick into the wire. As soon as you see that happen, take the iron away.
The solder should cool with a shiny surface. If it appears to be dull, it means that the wire was moving while the solder cooled, and you won't have a good joint. If it is dull, press the wire against the rail with a screwdriver (not your fingers!) and touch the tip of the iron to the wire. Once the solder melts, take the iron away, but don't move the screwdriver until the solder has cooled.
Good luck!