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=18)
-   -   till please look at this (http://www.howtoforge.com/forums/showthread.php?t=36941)

afandino 23rd June 2009 23:09

till please look at this
 
till,

I have written a couple of functions one works, the other won't,
one function has been placed in ispconfig_web.lib.php. the other in the reseller_web.lib.php
class file. I have been having a hard time trying to trap errors that occur on the soap server side trying to debug the functions. any ideas on how to set up my environment.

lets get to the code
/*
Function web_plans
params
return Array with all web plans from invoicing
*/

function web_plans($session,$params) {
global $go_api, $go_info;


if($session["user"]["web_query"] != 1) {
$this->errorMessage .= "method not allowed for user\r\n";
return false;

}

$wplans = $go_api->db->queryAllRecords("SELECT isp_fakt_artikel.artikelbezeichnung AS web_plan, isp_fakt_artikel.artikelpreis FROM isp_fakt_artikel WHERE isp_fakt_artikel.artikeltyp = 'Web' ORDER BY isp_fakt_artikel.artikelbezeichnung");


if(!empty($wplans)) {
foreach($wplans as $plan) {

$out[$plan["web_plan"]] = $plan;

}
return $out;


} else {
$this->errorMessage .= "no records found\r\n";
return false;

}

}

The way it is right now this will not return the array or an error to the soap server. Can you see anything? bellow is some test code i used to call the function through the soap connector.


<?php
include_once('soap.lib.php');
include('err_lib.php');
// Insert here your ispconfig server
$server_url = "https://xxxxx.xxxxx:81";

// creating object for soap_client
$soap_client = new soap_client($server_url.'/remote/index.php');
//echo ($server_url.'/remote/index.php');
//echo "<br>";


// Username and Password of the remoting user (not identical
// with the user to log into the web interface!)

$parameters = array('user' => 'xxxxxxx',
'pass' => 'xxxxxx');

// Login into ispconfig Server
$session_id = $soap_client->call('login',$parameters);
//echo "<br> Calling soap client" ;

// Error Check
if($err = $soap_client->getError()) die("Error: ".$err);



$df2 = 1 ;

//if($_POST['p_df'] == 1) {
//$df2 =1 ;
//}


if($df2==1) {


//get web plans list as an array
// and fill in the select menu

$paramsL = array ( 'sid' => $session_id,
'module' => 'web',
'function' => 'web_plans',
'params' => array( 'reseller_title' => "AJFNET.COM", // Reseller1, admin, all
'kunde_id' => '1' // kunde_title or kuunde_id (kunde_title/kunde_id overrides reseller_title)
));

$Planlist = $soap_client->call('service',$paramsL);

// Error Check

if($err = $soap_client->getError()) die("Error: ".$err);
print_r($Planlist) ;


print_r('<form name="formPlan" method="post" action="auto.php">
<select name="planSelect">');
echo "\n";


foreach($Planlist as $plan => $plan["web_plan"] ) {
#
echo "<option>$plan</option>\n";
}
//$df2 = 0 ;
print_r('</select>
<input type="submit" name="Submit" value="Submit">
<input type="hidden" name="p_df" value= "');
echo $df2;
print_r('">
</form>');


}
print_r($Planlist) ;
$soap_client->call('logout',array('sid' => $session_id));
?>

till 29th June 2009 12:19

And the other remoting functions are working?

afandino 29th June 2009 13:38

yes the other functions are working

afandino 30th June 2009 20:14

I guess i'll post the solution myself. It appears that the query returned an array but the way i walked through the array was wrong. The function was returning a multidimensional array which the loop could not handle, array(array(array))).
So getting back on track now...

Tony Fandino


All times are GMT +2. The time now is 09:33.

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