Refactor GetSubTreePaths method

Since the GetSubTreePaths method has been implemented in dbus_utility
and this commit is to integrate all the places where the
GetSubTreePaths method is called, and use the method in dbus_utility
uniformly.

Requires https://gerrit.openbmc.org/c/openbmc/sdbusplus/+/60020 to
build.

Tested: Redfish Validator Passed

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ie4140d4484a7e4f4b943013f4371ffd2d44a22e9
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index 8a46964..a65f33c 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -1,17 +1,20 @@
 #pragma once
 
+#include "dbus_utility.hpp"
 #include "utils/dbus_utils.hpp"
 
 #include <app.hpp>
 #include <async_resp.hpp>
 #include <boost/system/linux_error.hpp>
-#include <dbus_utility.hpp>
 #include <http_response.hpp>
 #include <query.hpp>
 #include <registries/privilege_registry.hpp>
 #include <sdbusplus/asio/property.hpp>
 #include <sdbusplus/unpack_properties.hpp>
 
+#include <array>
+#include <string_view>
+
 namespace redfish
 {
 namespace certs
@@ -212,9 +215,12 @@
                        const nlohmann::json::json_pointer& listPtr,
                        const nlohmann::json::json_pointer& countPtr)
 {
-    crow::connections::systemBus->async_method_call(
+    constexpr std::array<std::string_view, 1> interfaces = {
+        certs::certPropIntf};
+    dbus::utility::getSubTreePaths(
+        basePath, 0, interfaces,
         [asyncResp, listPtr, countPtr](
-            const boost::system::error_code ec,
+            const boost::system::error_code& ec,
             const dbus::utility::MapperGetSubTreePathsResponse& certPaths) {
         if (ec)
         {
@@ -265,11 +271,7 @@
         }
 
         asyncResp->res.jsonValue[countPtr] = links.size();
-        },
-        "xyz.openbmc_project.ObjectMapper",
-        "/xyz/openbmc_project/object_mapper",
-        "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", basePath, 0,
-        std::array<const char*, 1>{certs::certPropIntf});
+        });
 }
 
 /**