You can use the dns-sd command to browse and discover services similar to how you use the ping or traceroute commands. The dns-sd command is primarily used interactively. The reason the command is used interactively is mainly because its command-line arguments and output format can change over time, which makes invoking the command from a shell script unpredictable and risky. Additionally, the asynchronous nature of DNS service discovery (DNS-SD) does not easily lend itself to script-oriented programming.
For examples, see Advertising Resources for DNS in Working With Oracle Solaris 11.4 Directory and Naming Services: DNS and NIS. See also the dns-sd(8) man page.