Remoting objects

Discussion in 'General' started by Tommahawk, Jun 6, 2007.

  1. Tommahawk

    Tommahawk New Member

    How can I know what elements are available to me with the soap remoting facility because I am creating new clients OK but am having trouble creating new sites any help appreciated.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    All available elements are listed in the example file that comes with the remoting framework. If a option is not listed there, then it is not implemented yet.
     
  3. Tommahawk

    Tommahawk New Member

    Adding a new client works OK, but adding a new site fails for me how can I know why a remoting call has failed? is it logged anywhere?

    Thanks in advance
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    All available errors were send back to the remoting client script.
     
  5. Tommahawk

    Tommahawk New Member

    In regard to remoting where in ispconfig does it check if a username already exists or a similar because I am thinking that this may be causing new websites not to be added.

    for example 'kunde_title' => $username in the remoting scripts stops the same username being added twice

    BTW (I get no error stating this, I instead get
    <b>Catchable fatal error</b>: Object of class soap_fault could not be converted to string in <b>/home/admispconfig/ispconfig/lib/classes/ispconfig_soap.obj.php</b> on line <b>2000</b><br />

    &

    2007-06-28 11:53:15.087733 soapclient: Error: Response not of type text/xml

    When I delete the user and empty the user from the recycle bin the transaction goes OK and a new user is added
    Adding a website causes the same (ispconfig_soap.obj.php on line 2000) error exact but no website exists previously and no website is added, the error occurs when using nusoap 0.7.2 version using the nusoap 0.6 version that comes with ISPConfig returns no error at all but the new website is still NOT created. To upgrade the nusoap framework I simply replaced the 0.7.2 nusoap.php file with the one released with ispconfig and renamed the file ispconfig_soap.obj.php in /home/admispconfig/ispconfig/lib/classes/ I also did the same in the sample script. However I tested both using both versions of nusoap and the behaviour is identical in both cases. My script looks something like this ...

    // Add A New Client
    $paramA = array ('sid' => $session_id,
    'module' => 'kunde',
    'function' => 'kunde_add',
    'params' => array ('reseller_title' => 'admin',
    'kunde_title' => $username,
    'kunde_anrede' => $title,
    'kunde_firma' => $company,
    'kunde_vorname' => $firstname,
    'kunde_name' => $lastname,
    'kunde_strasse' => $address,
    'kunde_plz' => $postcode,
    'kunde_ort' => $suburb,
    'kunde_land' => $country,
    'kunde_telefon' => $telephone,
    'kunde_fax' => '',
    'kunde_email' => $email,
    'kunde_internet' => $domain,
    'webadmin_user' => $username,
    'webadmin_passwort' => $password,
    'kunde_province' => $state));

    // Adding a Web
    $paramB = array ('sid' => $session_id,
    'module' => 'web',
    'function' => 'web_add',
    'params' => array ('kunde_title' => $username, // reseller_title or reseller_group
    'web_title' => $domain,
    'web_host' => 'www',
    'web_domain' => $domain,
    'web_ip' => '192.168.0.2',
    'web_speicher' => '250', // MB
    'web_dns' => '1',
    'web_userlimit' => '100',
    'web_domainlimit' => '100',
    'web_shell' => '1',
    'web_cgi' => '1',
    'web_standard_cgi' => '1',
    'web_php' => '1',
    'web_php_safe_mode' => '1',
    'web_ssi' => '1',
    'web_ftp' => '1',
    'web_frontpage' => '0',
    'web_mysql' => '1',
    'web_mysql_anzahl_dbs' => '2',
    'web_ssl' => '1',
    'web_anonftp' => '1',
    'web_anonftplimit' => '250',
    'web_wap' => '1',
    'web_individual_error_pages' => '1'));


    $kunde_id = $soapclient->call('service', $paramA);
    if ($err = $soapclient->getError()) {
    echo '<textarea rows="40" cols=75">Registration Error 2: ' . $err;
    echo '<h2>Request</h2><pre>' . htmlspecialchars($soapclient->request, ENT_QUOTES) . '</pre>';
    echo '<h2>Response</h2><pre>' . htmlspecialchars($soapclient->response, ENT_QUOTES) . '</pre>';
    echo '<h2>Debug</h2><pre>' . htmlspecialchars($soapclient->debug_str, ENT_QUOTES) . '</pre></textarea>';
    }

    echo "<br><br>";

    $web_id = $soapclient->call('service', $paramB);

    if ($err = $soapclient->getError()) {
    echo '<textarea rows="40" cols=75">Registration Error 2: ' . $err;
    echo '<h2>Request</h2><pre>' . htmlspecialchars($soapclient->request, ENT_QUOTES) . '</pre>';
    echo '<h2>Response</h2><pre>' . htmlspecialchars($soapclient->response, ENT_QUOTES) . '</pre>';
    echo '<h2>Debug</h2><pre>' . htmlspecialchars($soapclient->debug_str, ENT_QUOTES) . '</pre></textarea>';
    }

    $soapclient->call('logout',array('sid' => $session_id));
     
    Last edited: Jun 28, 2007
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    The remoting framework runs the same checks on the input data then the interface.
     
  7. Tommahawk

    Tommahawk New Member

    -----------------------------------------
    The fix - ispconfig_web.lib.php on :approx LINE 210 reads
    -----------------------------------------

    if(!$kunde_webadmin_userid = $this->kunde_get_webadmin_userid($session,$params)){
    $this->errorMessage .= "Parameter: cannot find client";
    return "Parameter: cannot find client";
    }

    looks to me like it should read


    if(!$kunde_webadmin_userid == $this->kunde_get_webadmin_userid($session,$params)){
    $this->errorMessage .= "Parameter: cannot find client";
    return "Parameter: cannot find client";
    }

    or better

    if($kunde_webadmin_userid != $this->kunde_get_webadmin_userid($session,$params)){
    $this->errorMessage .= "Parameter: cannot find client";
    return "Parameter: cannot find client";
    }


    = assignment vs == equality vs != nonequality


    ---------------------

    or which running the script for me $kunde_webadmin_userid is empty & $this->kunde_get_webadmin_userid($session,$params) = 0 but add the new site OK
     
    Last edited: Jun 29, 2007
  8. NTAuthority

    NTAuthority New Member

    I also have this exact same problem: http://howtoforge.com/forums/showthread.php?t=13721

    It looks like the remoting code is missing a bit of code which adds the user to sys_user... :| And so, the user can not log in. :(

    Oh, and that single = is normal, as it also assigns the user id to the thing that is retrieved, and, if it's false, runs the if. :)
     
    Last edited: Jun 29, 2007
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    The remoting users are never stored in sys_user, remoting users have their own usertable. Please add a remoting user as described on the download page of the remoting framework.

    @Tommahawk The PHP code in the remoting framework is ok and does not need to be altered.
     
  10. NTAuthority

    NTAuthority New Member

    No, no, I've done that. ;) I mean the clients, which are also the reason that webadmin_userid is empty. :)
     
  11. Tommahawk

    Tommahawk New Member

    I would like to know more about what is going on here. What does the code do? I also see that $kunde_webadmin_userid is never set anywhere in the ispconfig_web.lib.php file and I also see that you are testing for equality not assigning causing the script to bomb out. The issue is solved by changing the script to read....

    if($kunde_webadmin_userid != $this->kunde_get_webadmin_userid($session,$params)){

    from

    if(!$kunde_webadmin_userid = $this->kunde_get_webadmin_userid($session,$params)){

    which does not make programming sense

    for me the new website is added and the issue is fixed. I will go back and test to see if ISPConfig creates the new website correctly such as DNS and FTP access etc
     
    Last edited: Jun 30, 2007

Share This Page