HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (
-   Developers' Forum (
-   -   SOAP API on IspConfig (

AceLine 11th December 2012 14:32

SOAP API on IspConfig
Hi Till,
Hi Falco,

I have one - for me - very important question:

I have installed ISPC on my server. Now I had a look at the api examples in the tar.gz-folder of ISPC

Can I use this SOAP-Examples 1:1 on the version?

If not: how to update to the version with 100% prevention of loosing data...? (the server is on production state and no data should be lost)

Or can I just copy the api folder contents to the server version?

Thnx. in advance for your information and... regards!


till 11th December 2012 15:05

This is a very old version and you can not use the api of a newer version with that version of course. Just update your sytm to Btw, if you want to keep your system secure and prevent data loss, then you should update regularily.


If not: how to update to the version with 100% prevention of loosing data...? (the server is on production state and no data should be lost)
Just follow the normal update procedure as described in the release note:

AceLine 11th December 2012 16:32

hi Till,

thnx. for your answer. I did the update now but I get a SOAP Error: Could not connect to host error. :confused:

what could I check (port 8080, where to check if it is active, etc.) to get closer to the problem?

Hope, you have any help for me...

Best regards from Austria,



$uid = $_POST['uid'];
$username = strtolower(umlaute(str_replace(" ", ".", $_POST['username'])));
$prefix = $_POST['emailPrefix'];
$email = urldecode($username).$prefix."@"._sitename;

$qry = sql_insert("INSERT INTO email_prefix (email_prefix,uid) VALUES ('".$username.$prefix."',".$uid.")", 2);

$username = 'admin';
$password = 'geheimespasswort';

$soap_location = 'http://localhost:8080/ispconfig3/interface/web/remote/index.php';
$soap_uri = 'http://localhost:8080/ispconfig3/interface/web/remote/';

$soap_location = 'http://localhost:8080/remote/index.php';
$soap_uri = 'http://localhost:8080/remote/';

$client = new SoapClient(null, array('location' => $soap_location,
'uri' => $soap_uri,
'trace' => 1,
'exceptions' => 1));

try {
if($session_id = $client->login($username,$password)) {
echo 'Logged successfull. Session ID:'.$session_id.'<br />';

//* Set the function parameters.
$client_id = 1;
$params = array(
'server_id' => 1,
'email' => $email,
'login' => $email,
'password' => $username.$uid,
'name' => $_SESSION['username'],
'uid' => (5000+intval($uid)),
'gid' => (5000+intval($uid)),
'maildir' => '/var/www/'._sitename.'/'.$username.$prefix,
'quota' => 10000000000,
'cc' => '',
'homedir' => '',
'autoresponder' => 'n',
'autoresponder_start_date' => '',
'autoresponder_end_date' => '',
'autoresponder_text' => 'hallo',
'move_junk' => 'n',
'custom_mailfilter' => 'spam',
'postfix' => 'y',
'access' => 'n',
'disableimap' => 'n',
'disablepop3' => 'n',
'disabledeliver' => 'n',
'disablesmtp' => 'n'

$affected_rows = $client->mail_user_add($session_id, $client_id, $params);

echo "New user: ".$affected_rows."<br>";

if($client->logout($session_id)) {
echo 'Logged out.<br />';

} catch (SoapFault $e) {
echo $client->__getLastResponse();
die('SOAP Error: '.$e->getMessage());

echo "ok";

till 11th December 2012 21:01

Ensure that you use the correct URL that matches your server hostname and http/https in these variables, you must be able to open the url in your web browser:

$soap_location = 'http://localhost:8080/remote/index.php';
$soap_uri = 'http://localhost:8080/remote/';

AceLine 11th December 2012 21:14

ok, I will change the URLs... but I cant get connection through browser:

Fehler: Verbindung fehlgeschlagen
Firefox kann keine Verbindung zu dem Server unter aufbauen.

Do you have any idea? The firewall is set to "TCP from any port to 8080 allow access".

Thnx. in advance,


PS: Changed the URLs but still no SOAP connection possible

till 12th December 2012 08:20

Have you tried https instaed of http?

AceLine 12th December 2012 08:23

yes Ive tried it with https. also the same. firefox can not connect to server. is TCP ok in the firewall?

till 12th December 2012 08:29

The soap connection is the same then the one that you use to access the ispconfig interface in the browser. So if you are able to login to ispconfig at all, then you must be able to access the soap interface as well, soap is just a different subfolder ( /remote/ ) of the same base URL.

AceLine 12th December 2012 08:44

Ok... :o) That changes a lot... I do not use ISPC 3 on standard port... now it connects.

Thanx. a lot!!!

Best regards,

Ingmar aka AceLine

AceLine 12th December 2012 08:56

Sorry, Till... Ive got one more question to this:

It allways shows me a SOAP-Error that the password is wrong. I used the admin username with its password (I very often login manualy) and I used the user that belongs to the mailboxes to add to.

Can you give me one more time an idea?

Thnx. in advance.


All times are GMT +2. The time now is 08:56.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.