honor endpoint_type to detect service URL

use endpoint type to detect the service URL