Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > General

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #21  
Old 29th October 2008, 07:12
dayjahone dayjahone is offline
Senior Member
 
Join Date: Jan 2007
Posts: 432
Thanks: 31
Thanked 0 Times in 0 Posts
Default

Which brand of Linux was remoting access written for? I don't mind re-installing everything...I just want it to work.
Reply With Quote
Sponsored Links
  #22  
Old 29th October 2008, 10:20
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 37,041
Thanks: 841
Thanked 5,661 Times in 4,468 Posts
Default

Quote:
Which brand of Linux was remoting access written for?
For all linux distributions supported by ISPCOnfig.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #23  
Old 29th October 2008, 10:31
jnsc jnsc is offline
rotaredoM
 
Join Date: Mar 2006
Location: Lausanne, Switzerland
Posts: 531
Thanks: 11
Thanked 175 Times in 79 Posts
Default

You shouhld set this debuging variables just after

Code:
$reseller_id = $nusoap_client->call('service',$params);
and if you still does not seen the debuging info, you should place it just after

Code:
// Login into 42go Server
$session_id = $nusoap_client->call('login',$parameters);
I just saw that you also renamed the $soapclient variable to $nusoap_client so the text sould also be

Code:
echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($nusoap_client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($nusoap_client->response, ENT_QUOTES) . '</pre>';
I'm using the remoting framework with debian, and everything is working fine.
Reply With Quote
  #24  
Old 29th October 2008, 14:52
dayjahone dayjahone is offline
Senior Member
 
Join Date: Jan 2007
Posts: 432
Thanks: 31
Thanked 0 Times in 0 Posts
Default

When I placed it under
Code:
// Login into 42go Server
$session_id = $nusoap_client->call('login',$parameters);
I got the following:
Code:
Request

POST /remote/index.php HTTP/1.0
Host: server1.mydomain.com:81
User-Agent: NuSOAP/0.7.3 (1.51)
Content-Type: text/xml; charset=ISO-8859-1
SOAPAction: ""
Content-Length: 538

<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns3263:login xmlns:ns3263="http://tempuri.org"><user xsi:type="xsd:string">roach</user><pass xsi:type="xsd:string">two</pass></ns3263:login></SOAP-ENV:Body></SOAP-ENV:Envelope>
Response

HTTP/1.1 200 OK
Date: Wed, 29 Oct 2008 12:48:41 GMT
Server: Apache
X-Powered-By: PHP/5.2.6
Set-Cookie: PHPSESSID=607fd47af0588e1e48411ca5fd901b00; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Transfer-Encoding: chunked
Content-Type: text/html

<br />
<b>Fatal error</b>:  Class 'soap_server' not found in <b>/home/admispconfig/ispconfig/web/remote/index.php</b> on line <b>10</b><br />
Error: Response not of type text/xml: text/html
I was asking about which brand of Linux because I've done this twice, neither time doing anything custom and neither time deviating from the perfect setup for ubuntu, and both times, it hasn't worked too well. The first time took a lot of posts and tinkering to get it to work. I was wondering if it was smoother with other brands. I picked ubuntu because I thought it was most common.
Reply With Quote
  #25  
Old 29th October 2008, 15:24
jnsc jnsc is offline
rotaredoM
 
Join Date: Mar 2006
Location: Lausanne, Switzerland
Posts: 531
Thanks: 11
Thanked 175 Times in 79 Posts
Default

In /home/admispconfig/ispconfig/web/remote/index.php replace soap_server with nusoap_server
Reply With Quote
  #26  
Old 29th October 2008, 15:45
dayjahone dayjahone is offline
Senior Member
 
Join Date: Jan 2007
Posts: 432
Thanks: 31
Thanked 0 Times in 0 Posts
Default

Here is that index.php file:

Code:
<?php

include("../../lib/config.inc.php");
include("../../lib/app.inc.php");

// Lade Soap Klasse
$go_api->uses_obj("soap");


$s = new nusoap_server;


$s->register('service');
$s->register('login');
$s->register('logout');


function login($user, $pass) {

        global $go_api, $go_info;

        // alte Sessions lschen
        $go_api->db->query("DELETE FROM remote_session WHERE tstamp < '".(time() - 1800)."'");

        if(empty($user) or empty($pass)) {
                return new soap_fault('Client','','username or password empty.');
        } else {

                $user = addslashes($user);
                $pass = addslashes($pass);

                $user = $go_api->db->queryOneRecord("SELECT * FROM remote_user WHERE username = '$user' and passwort = md5('$pass')");

                // Checke IP
                if($user["ip"] != '') {
                        if($_SERVER['REMOTE_ADDR'] != $user["ip"]) return new soap_fault('Client','','IP-Address not allowed.');
                }

                if($user["ruserid"] > 0) {

                        $session["user"] = $user;
                        $session_data = addslashes(serialize($session));
                        $session_id = md5 (uniqid (rand()));
                        $go_api->db->query("INSERT INTO remote_session (sid,ruserid,data,tstamp) VALUES ('$session_id','".$user["ruserid"]."','$session_data','".time()."')");
                        return $session_id;

                } else {
                        return new soap_fault('Client','','username or password incorrect.');
                }
        }
}

function logout($sid) {
        global $go_api, $go_info;
        if(empty($sid)) {
                return new soap_fault('Client','','sid empty.');
        } else {
                $sid = addslashes($sid);
                $sql = "DELETE FROM remote_session WHERE sid = '$sid'";
                $go_api->db->query($sql);
                return true;
        }
}


function service($sid, $module, $function, $params) {
        global $go_api, $go_info;

        // prfe ob session aktiv
        $session = addslashes($session);

        // lsche abgelaufene session records ( lter als 30 minuten)
        $go_api->db->query("DELETE FROM remote_session WHERE tstamp < ".time() + 1800);

        // hole Session
        $session_record = $go_api->db->queryOneRecord("SELECT * FROM remote_session WHERE sid = '$sid'");
        if(empty($session_record["data"])) {
                return new soap_fault('Server','','session not available.');
        } else {
                $session = unserialize(stripslashes($session_record["data"]));
                $ruserid = $session_record["ruserid"];
                unset($session_record);
        }

        // allowed Modules
        $allowed_modules[] = 'dns';
        $allowed_modules[] = 'slave';
        $allowed_modules[] = 'reseller';
        $allowed_modules[] = 'kunde';
        $allowed_modules[] = 'web';

        // berprfen ob modul und funktion bergeben wurden


        // Checke IP
        if($session["ip"] != '') {
                if($_SERVER['REMOTE_ADDR'] != $session["ip"]) return new soap_fault('Client','','IP-Address not allowed.');
        }


        if(in_array($module,$allowed_modules)) {
                $go_api->uses($module);
                if(class_exists($module)) {
                        if(method_exists($go_api->$module,$function)) {
                                $retval = $go_api->$module->$function($session,$params);
                                if($go_api->$module->errorMessage == '') {
                                        return $retval;
                                } else {
                                        return new soap_fault('Client','',$go_api->$module->errorMessage);
                                }
                        } else {
                                return new soap_fault('Client','','function does not exist.');
                        }
                } else {
                        return new soap_fault('Client','','moduleclass not available.');
                }
        } else {
                return new soap_fault('Client','','module not allowed.');
        }

}





$s->service($HTTP_RAW_POST_DATA);

?>
and here is the error I'm still getting:

Code:
Request

POST /remote/index.php HTTP/1.0
Host: server1.mydomain.com:81
User-Agent: NuSOAP/0.7.3 (1.51)
Content-Type: text/xml; charset=ISO-8859-1
SOAPAction: ""
Content-Length: 538

<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns2885:login xmlns:ns2885="http://tempuri.org"><user xsi:type="xsd:string">roach</user><pass xsi:type="xsd:string">two</pass></ns2885:login></SOAP-ENV:Body></SOAP-ENV:Envelope>
Response

HTTP/1.1 200 OK
Date: Wed, 29 Oct 2008 13:44:42 GMT
Server: Apache
X-Powered-By: PHP/5.2.6
Set-Cookie: PHPSESSID=08d4043c1357535830f5f22b779bc9c6; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Transfer-Encoding: chunked
Content-Type: text/html

<br />
<b>Fatal error</b>:  Call to undefined function xml_parser_create() in <b>/home/admispconfig/ispconfig/lib/classes/ispconfig_soap.obj.php</b> on line <b>6409</b><br />
Error: Response not of type text/xml: text/html
Reply With Quote
  #27  
Old 30th October 2008, 00:02
jnsc jnsc is offline
rotaredoM
 
Join Date: Mar 2006
Location: Lausanne, Switzerland
Posts: 531
Thanks: 11
Thanked 175 Times in 79 Posts
Default

This looks like you didn't had libxml2-dev installed when you installed ISPConfig.

what is the output of
Code:
sudo dpkg-query -W -f='${Status} ${Version}\n' libxml2-dev
If it's not installed you will need to install it
Code:
sudo apt-get install libxml2-dev
and then either recompile ISPConfigs PHP with XML support, or, the simply method, reinstall ISPConfig. Since 2.2.24 ISPConfig detects if libxml2-dev is installed and if yes it enables XML in the bundled PHP.
Reply With Quote
The Following User Says Thank You to jnsc For This Useful Post:
dayjahone (30th October 2008)
  #28  
Old 30th October 2008, 06:24
dayjahone dayjahone is offline
Senior Member
 
Join Date: Jan 2007
Posts: 432
Thanks: 31
Thanked 0 Times in 0 Posts
Default

Wow! So, it worked. The problem must have been that I installed the package after installing ISPConfig. So, I am still having problems with the form that I used on my old system. I am trying to check for a user and if the username doesn't exist, create it. If I just have the add user script, it works, but if it's already there, it doesn't give me an error, but echos the following:

Code:
Error: Response not of type text/xml: text/html
When I have both scripts, I get that error regardless and it doesn't create a user. Here are the functions I am using:

Code:
// Get a User
$params = array ( 'sid' => $session_id,
'module' => 'web',
'function' => 'user_get',
'params' => array ( user_username => $new_username_field // user_username or user_id
));

$user = $nusoap_client->call('service',$params);
if($err = $nusoap_client->getError()) die("Error: ".$err);
Code:
// Add User
$params = array (         'sid'        => $session_id,
                                        'module'         => 'web',
                                        'function'         => 'user_add',
                                        'params'        => array ( web_title => 'mydomain.com',  // web_title or web_id
                                        user_username => $new_username_field,
                                        user_name => $first_name,
                                        user_email => $new_username_field,
                                        user_passwort => $new_password_field,
                                        user_speicher => 0,
                                        user_mailquota => 1000,
                                        user_admin => 0
                                        ));

$user_id = $nusoap_client->call('service',$params);
if($err = $nusoap_client->getError()) die("Error: ".$err);

// 42go Server logout
$nusoap_client->call('logout',array('sid' => $session_id));

// Error Check
if($err = $nusoap_client->getError()) die("Error: ".$err);
This same code worked fine on the old system. I'm not sure what's wrong.

Last edited by dayjahone; 30th October 2008 at 15:01.
Reply With Quote
  #29  
Old 31st October 2008, 04:48
dayjahone dayjahone is offline
Senior Member
 
Join Date: Jan 2007
Posts: 432
Thanks: 31
Thanked 0 Times in 0 Posts
Default

Jnsc,

C'mon, it's soooo close....Please help with this last little piece.
Reply With Quote
  #30  
Old 31st October 2008, 10:30
jnsc jnsc is offline
rotaredoM
 
Join Date: Mar 2006
Location: Lausanne, Switzerland
Posts: 531
Thanks: 11
Thanked 175 Times in 79 Posts
 
Default

Try also to use the debugging function in the case you get "Error: Response not of type text/xml: text/html"
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
autosignup remoting framework howto detailed kextra1 Tips/Tricks/Mods 21 1st March 2012 07:59
Remoting Framework / xml instalation issue gauthier Installation/Configuration 7 9th October 2007 11:06
Adding a Web Remoting Framework bigger_travis General 1 13th July 2007 21:26
Remoting framework still show black block under tools mxc Installation/Configuration 2 26th February 2007 08:13
Remoting Framework mlz General 9 18th January 2007 23:52


All times are GMT +2. The time now is 15:05.


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