(1)Whenever in the course of a trial by court-martial, it appears to the trial judge advocate that the examination of a witness is necessary for the ends of justice and that the attendance of such witness cannot be procured without an amount of delay, expense or inconvenience which under the circumstances of the case would be unreasonable, the trial judge advocate may dispense with such attendance and may apply to the Judge Advocate General of the Navy to issue a commission to any metropolitan magistrate or judicial magistrate of the first class within the local limits of whose jurisdiction such witness resides, to take the evidence of such witness.