I've taken that oath at least twelve times that I can remember. Enlistment in the Army, accepting a commission as an Army Officer, admission to the practice of law in about nine jurisdictions, and to take public office twice.
I've never understood any of them to require obedience to unlawful orders. Either does the Army or Congress understand it that way. Illegality of orders is a complete defense in a court martial. The Uniform Code of Military Justice, a law passed by Congress and signed by President Truman, provides for that defense. Illegality can be based on the Constitution. Even statutes can be unconstitutional. If they are unconstitutional, they are invalid, void. The federal courts have recognized that since Marbury v. Madison early in the Nineteenth Century.
There is much virtue in what Snowden has done.
http://www.paulcraigroberts.org/2013...craig-roberts/
__________________
Extremism in the defense of Liberty is no vice. . . Restraint in the pursuit of Justice is no virtue.
Senator Barry Goldwater, 1964