Can soldiers violate the UCMJ if they're ordered to?

I meant to say that the offense is in issuing the unlawful order and the perpetrator of the offense is the one issuing said unlawful order. It is also an offense to obey an unlawful order.