我对ISPConfig和php soap技术非常陌生。我从下载了示例脚本http://www.ispconfig.org/page/en/addons/billing-module.html
但当我试图添加_invoice时,它告诉billing_invoice_add函数我得到了异常:
//* Create the SOAP client connection
$client = new SoapClient(null, array('location' => $soap_location,
'uri' => $soap_uri,
'trace' => 1,
'exceptions' => 1));
//* Login as remote user
if($session_id = $client->login($username,$password)) {
echo 'Logged successfull. Session ID:'.$session_id.'<br />';
}
//* We will create a invouce for the client with the following ID
$client_id = 4;
//* Optional parameters to override the client address or client settings
$params = array();
//* Add the invoice
$invoice_id = $client->billing_invoice_add($session_id, $client_id, $params); # Here I am getting exception.
echo 'InvoiceID: '.$invoice_id.'<br />';
我能够成功登录。
ispConfig版本:3.0
请建议任何将发票远程添加到服务器的方法。
我可以将其添加到仪表板中。
经过数小时的调试,终于明白了。该错误是由于$soap_location引起的$soap_location位置正在指向remote.php
通常,当我们为ispconfig创建任何模块时,模块类都应该继承自远程处理类。现在,当我们需要使用模块时,我们需要调用该模块位置。
例如,在我的案例中,计费是一个模块。它继承自远程处理类模块。因此,为了同时获得远程处理和计费的功能,我们需要将soapclient作为billing.php,而不是远程.php