
20th February 2013, 14:19
|
|
Junior Member
|
|
Join Date: Mar 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
SOAP Error: Could not connect to host
Hi, I want to use the API of ISPConfig 3.0.4.6 and therefore I have made a test script (using example), simply to connect to the SOAP server.
It runs on a Ubuntu 12.04.2 LTS precise server.
I have to mention that I had for about 4 months ago a working script, but now, after I have upgraded the server, it no longer works.
The script is very common:
$username = 'remoteusr';
$password = 'password';
$soap_location = 'https://myserverip:8080/remote/index.php';
$soap_uri = 'https://myserverip:8080/remote/';
$client = new SoapClient(null, array('location' => $soap_location,
'uri' => $soap_uri,
'trace' => 1));
// ini_set('soap.wsdl_cache_enabled',0);
// ini_set('soap.wsdl_cache_ttl',0);
try {
//* Login to the remote server
if($session_id = $client->login(trim($username),trim($password))) {
echo 'Logged into remote server sucessfully. The SessionID is '.$session_id.' - <br>';
}
//* Logout
if($client->logout($session_id)) {
echo "Logout for session ".$session_id;
}
} catch (SoapFault $e) {
var_dump($client->__getLastRequest())."<br>";
var_dump($client->__getLastResponse())."<br>";
echo "<br>Please contact the server administator<br>";
die('SOAP Error: '.$e->getMessage());
}
The getLastRequest gives me the username and password back
The getLastResponse gives me NULL
I don't get what is wrong here, especially where it did work before!!
|

20th February 2013, 14:48
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,872
Thanks: 689
Thanked 4,185 Times in 3,202 Posts
|
|
The error "SOAP Error: Could not connect to host" indicates that either $soap_location or $soap_uri are incorrect so that sopa could not reach a server under that url.
|

20th February 2013, 15:18
|
|
Junior Member
|
|
Join Date: Mar 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Yes that could be possible, but... The $soap_location AND the $soap_uri are right. They are besides the /remote part the same as what I use to login to my ISPConfig. Offcourse the 'myserverip' should be replaced by the IP or URL of the real server, but I will not encourage anyone to hack my server at this moment ;-)
When I enter the whole URL in a browser, I get a blank screen as well. I think at least it should display something...
|

20th February 2013, 15:31
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,872
Thanks: 689
Thanked 4,185 Times in 3,202 Posts
|
|
Quote:
|
When I enter the whole URL in a browser, I get a blank screen as well. I think at least it should display something...
|
No, it has to be blank. When you connect to a soap server with a web borwser, then nothing gets displayed.
Did you run the browser on the same server that you run the php script on, so the connection is made from same network interface and IP?
|

20th February 2013, 15:35
|
|
Junior Member
|
|
Join Date: Mar 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Yes, I developped it on my Desktop PC and call the servers SOAP from there. It did work in the past as I did mention earlyer and I was able to add a user as well in the API, but now it does not work anymore. As far as I can see nothing has changed, besides the upgrade of the (Ubuntu) server OS.
|

20th February 2013, 15:46
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,872
Thanks: 689
Thanked 4,185 Times in 3,202 Posts
|
|
maybe the php soap extension is not installed of the server anymore. You can e.g. check that with the phpinfo() function if soap is available.
|

20th February 2013, 17:57
|
|
Junior Member
|
|
Join Date: Mar 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Nope, this have I already checked. SOAP is available.
|

22nd February 2013, 07:35
|
|
Junior Member
|
|
Join Date: Mar 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
It even getting stranger: When I use the script on a different server, or from my home location, where 'myserverip' is my server IP address or my server URL like this :
$soap_location = 'https://myserverip:8080/remote/index.php';
$soap_uri = 'https://myserverip:8080/remote/';
I got a SOAP Fault.
When I run the same script on the SOAP server itself using
$soap_location = 'https://localhost:8080/remote/index.php';
$soap_uri = 'https://localhost:8080/remote/';
it works fine!!!
When I call the SOAP servers ISPConfig admin screen from a different server, using
'https://myserverip:8080' or 'https://myserverURL:8080' I got the login screen of ISPConfig, so it could not be a DNS problem.
I'm confused because I have tried it on different servers with ISPConfig and everywhere got the same result....
Last edited by minddigger; 22nd February 2013 at 07:37.
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +2. The time now is 01:51.
|
Recent comments
1 day 16 hours ago
2 days 1 hour ago
2 days 4 hours ago
2 days 5 hours ago
2 days 7 hours ago
2 days 8 hours ago
2 days 10 hours ago
2 days 11 hours ago
3 days 3 hours ago
3 days 4 hours ago