JBilling’s php library is based on PEAR SOAP.
The module it self had numerous problems and I couldn’t get it to work with complex data types. The documentation it self on pear soap’s site wasn’t very useful.
SugarCRM uses nusoap library and I found it much easier to use then PEAR SOAP, specially calling AXIS web services with complex types. We use nusoap internally for SugarCRM JBilling toolkit and had no issues so far.
to get you up and running I create a sample code
<?php
/*
* Created on Mar 30, 2009
*
* By Parham D. Beheshti
* Email: parham@osintegra.com
* Blog: http://www.osintegra.com/blog/
*/
require_once (’lib/nusoap.php’);
// set JBilling soap user username
$ws_username = ’soap’;
// set JBilling Soap user Password
$ws_password = ’soap1234′;
// Set JBilling WSDL URL including username and password
$ws_url = ‘http://’ . $ws_username . ‘:’.$ws_password .’@localhost:8080/jboss-net/services/billing?wsdl’;
// create nusoap client
// Note: older versions of nusoap clients (the version that sugarcrm uses) are named nusoapclient instead of nusoap_client
$client = new nusoap_client($ws_url, array (’wsdl’ => true));
// set credentials. JBilling’s soap server uses basic authentication
$client->setCredentials($ws_username, $ws_password, ‘basic’, array ());
// set debug flag to true
$client->debug_flag = true;
// create a proxy for the wsdl
$proxy = $client->getProxy() or die($client->getDebug());
// you can call wsdl methods directly
// here we pass the server a username and get user’s id
$userid = $proxy->getUserId($ws_username) or die($client->getDebug());
// we pass the userid we got from the above method and get user’s object
$user =$proxy->getUserWS($userid) or die($client->getDebug());
print_r($user);
?>
/*
* Created on Mar 30, 2009
*
* By Parham D. Beheshti
* Email: parham@osintegra.com
* Blog: http://www.osintegra.com/blog/
*/
require_once (’lib/nusoap.php’);
// set JBilling soap user username
$ws_username = ’soap’;
// set JBilling Soap user Password
$ws_password = ’soap1234′;
// Set JBilling WSDL URL including username and password
$ws_url = ‘http://’ . $ws_username . ‘:’.$ws_password .’@localhost:8080/jboss-net/services/billing?wsdl’;
// create nusoap client
// Note: older versions of nusoap clients (the version that sugarcrm uses) are named nusoapclient instead of nusoap_client
$client = new nusoap_client($ws_url, array (’wsdl’ => true));
// set credentials. JBilling’s soap server uses basic authentication
$client->setCredentials($ws_username, $ws_password, ‘basic’, array ());
// set debug flag to true
$client->debug_flag = true;
// create a proxy for the wsdl
$proxy = $client->getProxy() or die($client->getDebug());
// you can call wsdl methods directly
// here we pass the server a username and get user’s id
$userid = $proxy->getUserId($ws_username) or die($client->getDebug());
// we pass the userid we got from the above method and get user’s object
$user =$proxy->getUserWS($userid) or die($client->getDebug());
print_r($user);
?>
Download sample code:phpjbilling_example
Tags: guide, Integration, JBilling, PHP, soap, web service
