Justices of the peace shall have the same power to issue subpoenas for witnesses in civil and criminal actions pending before them and in preliminary examinations being heard by them, where such witnesses reside outside of their counties, as is given by law in similar cases to the circuit court.