HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Developers' Forum (http://www.howtoforge.com/forums/forumdisplay.php?f=33)
-   -   SOAP API on IspConfig 3.0.3.1? (http://www.howtoforge.com/forums/showthread.php?t=59912)

AceLine 11th December 2012 14:32

SOAP API on IspConfig 3.0.3.1?
 
Hi Till,
Hi Falco,

I have one - for me - very important question:

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

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


If not: how to update to the 3.0.4.6 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 3.0.3.1 server version?


Thnx. in advance for your information and...

...best regards!


AceLine

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 3.0.4.6. Btw, if you want to keep your system secure and prevent data loss, then you should update regularily.

Quote:

If not: how to update to the 3.0.4.6 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:

http://www.howtoforge.com/forums/showthread.php?t=57659

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,

AceLine

Quote:

$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 ns3.artetplus.at:8080 aufbauen.

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

Thnx. in advance,

AceLine

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.

Ingmar


All times are GMT +2. The time now is 23:30.

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