Section 27. In cases against juvenile offenders, an officer who attends as a witness at a place other than that of his residence may be allowed by the court or justice his increased necessary expenses, not exceeding the witness fee before such court or justice, and the reasonable necessary expense of serving a mittimus.