/**
  * Create a SoftLayer API XML-RPC Client
  *
  * Retrieve a new XmlRpcClient object for a specific SoftLayer API
  * service using either the class' constants API_USER and API_KEY or a
  * custom username and API key for authentication. Provide an optional id
  * value if you wish to instantiate a particular SoftLayer API object.
  *
  * @param string $serviceName The name of the SoftLayer API service you wish to query
  * @param int $id An optional object id if you're instantiating a particular SoftLayer API object. Setting an id defines this client's initialization parameter header.
  * @param string $username An optional API username if you wish to bypass XmlRpcClient's built-in username.
  * @param string $username An optional API key if you wish to bypass XmlRpcClient's built-in API key.
  * @param string $endpointUrl The API endpoint base URL you wish to connect to. Set this to XmlRpcClient::API_PRIVATE_ENDPOINT to connect via SoftLayer's private network.
  * @return XmlRpcClient
  */
 public static function getClient($serviceName, $id = null, $username = null, $apiKey = null, $endpointUrl = null)
 {
     $serviceName = trim($serviceName);
     $id = trim($id);
     $username = trim($username);
     $apiKey = trim($apiKey);
     if ($serviceName == null) {
         throw new \Exception('Please provide a SoftLayer API service name.');
     }
     $client = new self();
     /*
      * Default to use the public network API endpoint, otherwise use the
      * endpoint defined in API_PUBLIC_ENDPOINT, otherwise use the one
      * provided by the user.
      */
     if (isset($endpointUrl)) {
         $endpointUrl = trim($endpointUrl);
         if ($endpointUrl == null) {
             throw new \Exception('Please provide a valid API endpoint.');
         }
         $client->_endpointUrl = $endpointUrl;
     } elseif (self::API_BASE_URL != null) {
         $client->_endpointUrl = self::API_BASE_URL;
     } else {
         $client->_endpointUrl = self::API_PUBLIC_ENDPOINT;
     }
     if ($username != null && $apiKey != null) {
         $client->setAuthentication($username, $apiKey);
     } else {
         $client->setAuthentication(self::API_USER, self::API_KEY);
     }
     $client->_serviceName = $serviceName;
     if ($id != null) {
         $client->setInitParameter($id);
     }
     return $client;
 }