Add the GetObject method to dbus_utility

There are currently many files that use the GetObject method.
Since they are a general method, they are defined in the
dbus_utility.hpp file and refactors them.

Tested: Built bmcweb successfully and Validator passes.

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: If2af77294389b023b611987252ee6149906fcd25
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index abf255e..9f99d18 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -29,8 +29,10 @@
 #include <sdbusplus/asio/property.hpp>
 #include <sdbusplus/unpack_properties.hpp>
 
+#include <array>
 #include <optional>
 #include <string>
+#include <string_view>
 #include <vector>
 
 namespace redfish
@@ -425,11 +427,12 @@
                               CallbackFunc&& callback)
 {
 
-    const std::array<const char*, 2> interfaces = {ldapEnableInterface,
-                                                   ldapConfigInterface};
+    constexpr std::array<std::string_view, 2> interfaces = {
+        ldapEnableInterface, ldapConfigInterface};
 
-    crow::connections::systemBus->async_method_call(
-        [callback, ldapType](const boost::system::error_code ec,
+    dbus::utility::getDbusObject(
+        ldapConfigObjectName, interfaces,
+        [callback, ldapType](const boost::system::error_code& ec,
                              const dbus::utility::MapperGetObject& resp) {
         if (ec || resp.empty())
         {
@@ -580,9 +583,7 @@
             callback(true, confData, ldapType);
             },
             service, ldapRootObject, dbusObjManagerIntf, "GetManagedObjects");
-        },
-        mapperBusName, mapperObjectPath, mapperIntf, "GetObject",
-        ldapConfigObjectName, interfaces);
+        });
 }
 
 /**