I'd say you have narrowed the problem down to a MIDI setup problem in Sonar.
That MIDI-OX test is my first choice whenever I think there is a MIDI problem somewhere in my setup.
If MIDI-OX can see your controller sending notes, and you can play standalone software instruments, you will probably do best by focusing on Sonar.
Did you already try rebooting, while making sure that your controller was connected and powered on during the boot? And definitely on when launching Sonar?
Does your controller show as an available MIDI input in Sonar preferences?