4 // 0. Include GForge files for access to GForge system
5 require_once '../env.inc.php';
6 require_once $gfwww.'include/squal_pre.php';
7 require_once $gfcommon.'include/gettext.php';
9 $uri = 'http://'.$sys_default_domain;
10 // 1. include client and server
11 require_once $gfwww.'soap/nusoap.php';
13 // 2. instantiate server object
14 $server = new soap_server();
15 //configureWSDL($serviceName,$namespace = false,$endpoint = false,$style='rpc', $transport = 'http://schemas.xmlsoap.org/soap/http');
16 //$server->configureWSDL('GForgeAPI',$uri);
17 $server->configureWSDL('GForgeAPI',$uri,false,'rpc','http://schemas.xmlsoap.org/soap/http',$uri);
20 $server->wsdl->addComplexType(
27 array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]')),
31 $server->wsdl->addComplexType(
38 array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:integer[]')),
42 $server->wsdl->addComplexType(
49 array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:long[]')),
53 $server->wsdl->addComplexType(
60 array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:int[]')),
64 // session/authentication
67 array('userid'=>'xsd:string','passwd'=>'xsd:string'),
68 array('loginResponse'=>'xsd:string'),
74 array('session_ser'=>'xsd:string'),
75 array('logoutResponse'=>'xsd:string'),
80 // Include Group Functions
82 require_once $gfwww.'soap/common/group.php';
85 // Include User Functions
87 require_once $gfwww.'soap/common/user.php';
90 // Include tracker & tracker query Functions
92 require_once $gfwww.'soap/tracker/tracker.php';
93 require_once $gfwww.'soap/tracker/query.php';
96 // Include Docman Functions
98 require_once $gfwww.'soap/docman/docman.php';
101 // Include task manager Functions
103 require_once $gfwww.'soap/pm/pm.php';
104 require_once $gfwww.'soap/reporting/timeentry.php';
107 // Include frs Functions
109 require_once $gfwww.'soap/frs/frs.php';
112 // Include SCM Functions
114 require_once $gfwww.'soap/scm/scm.php';
117 $wsdl_data = $server->wsdl->serialize();
120 if ($wsdl == "save") {
121 $fp = fopen ("/tmp/SoapAPI1.wsdl", 'w');
122 fputs ($fp, $wsdl_data);
133 * continueSession - A utility method to carry on with an already established session
135 * @param string The session key
137 function continue_session($sessionKey) {
138 session_continue($sessionKey);
141 // session/authentication
143 * login - Logs in a SOAP client
145 * @param string userid The user's unix id
146 * @param string passwd The user's passwd in clear text
148 * @return string the session key
150 function login($userid, $passwd) {
151 global $feedback, $session_ser;
153 setlocale (LC_TIME, _('en_US'));
155 $res = session_login_valid($userid, $passwd);
158 return new soap_fault('1001', 'user', "Unable to log in with userid of ".$userid, $feedback);
165 * logout - Logs out a SOAP client
167 * @param string sessionkey The session key
169 function logout($session_ser) {
170 continue_session($session_ser);
176 // 4. call the service method to initiate the transaction and send the response
177 $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
178 $server->service($HTTP_RAW_POST_DATA);
180 if(isset($log) and $log != ''){
181 harness('nusoap_r2_base_server',$server->headers['User-Agent'],$server->methodname,$server->request,$server->response,$server->result);