• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

Using the GetAccountByName method

E

eric4gh

Guest
Hi. I am building an API between WHMcs and Sitebuilder. I have automatic user/site creation working. Now I wish to delete a certain account. However, I am receiving this error when using the GetAccountByName method.

Listed below this error message is the code where I am using that method.:

Type: SoapFault
Message: Generic error. Internal Sitebuilder error. Base_SyntaxException: PHP Notice : Undefined property: stdClass::$username file: /usr/local/sitebuilder/include/SB/Actions/Admin/User/GetAccount.php line: 60 code: 8
Fault code: ERROR_GENERIC
Details: Internal Sitebuilder error. Base_SyntaxException: PHP Notice : Undefined property: stdClass::$username file: /usr/local/sitebuilder/include/SB/Actions/Admin/User/GetAccount.php line: 60 code: 8
File: /home/goodhost/public_html/billing3/includes/actionhooks.php
Line: 340
Code: 0

Code the generates this error:

$struct->username = $vars["username"]; // retrieves user name from WHMcs system

print $vars["username"];
print "<p>";
print_r($struct->username);

$accountService = $this->_getWebService('/AccountWebService.asmx?WSDL');

// first we must search to see if the username exists as a site in sitebuilder.

$result = $accountService->GetAccountByName($struct->username);

// then if there is a match, delete that site

$result2 = $accountService->DeleteAccount(new SoapVar($result, SOAP_ENC_OBJECT));

~~~

I have also tried using the method by supplying a variable and the hardcoded string "sitetest1" for example, and the same error message above is generated.

I have also passed in an account object

$struct->username = $vars["username"];

$result = $accountService->GetAccountByName(new SoapVar($struct, SOAP_ENC_OBJECT));

but the same error is generated.

Can anyone tell me how I should be using the GetAccountByName API method to process correctly?

Thank you.
 
Back
Top