The callback has to be public:
public function respondWithString()
And in your register_rest_route()
call, set the callback
to [ $this, 'respondWithString' ]
:
register_rest_route( $this->urlBase, 'dummy', [
'methods' => 'GET',
'callback' => [ $this, 'respondWithString' ],
] );