Rollback soap server class to workable state, make login/logout work

This commit is contained in:
Miles Lott 2001-12-10 02:09:17 +00:00
parent 2b1bf39cd3
commit 9f568f8b33
6 changed files with 220 additions and 191 deletions

View File

@ -3,27 +3,9 @@
// for example usage, see the test_server.php file. // for example usage, see the test_server.php file.
/* changelog:
2001-07-05
- detection of character encoding in Content-Type header. server
will now call the soap_parser object with the specified encoding
- server will now return the Content-Type header with the sender's encoding type specified
must still learn more bout encoding, and figure out what i have to do to be able to
make sure that my response is *actually* encoded correctly
2001-07-21
- force proper error reporting for windows compatibility
2001-07-27
- get_all_headers() check for windows compatibility
*/
/* $Id$ */
// make errors handle properly in windows
error_reporting(2039);
class soap_server class soap_server
{ {
function soap_server() function soap_server($data='',$serviceNow=False)
{ {
// create empty dispatch map // create empty dispatch map
$this->dispatch_map = array(); $this->dispatch_map = array();
@ -31,20 +13,23 @@
$this->debug_str = ''; $this->debug_str = '';
$this->headers = ''; $this->headers = '';
$this->request = ''; $this->request = '';
$this->xml_encoding = 'UTF-8'; $this->result = 'successful';
$this->fault = false; $this->fault = false;
$this->fault_code = ''; $this->fault_code = '';
$this->fault_str = ''; $this->fault_str = '';
$this->fault_actor = ''; $this->fault_actor = '';
// for logging interop results to db
$this->result = 'successful'; if($serviceNow == 1)
{
$this->service($data);
}
} }
// parses request and posts response // parses request and posts response
function service($data) function service($data)
{ {
// $response is a soap_msg object // $response is a soap_msg object
$response = $this->parse_request($data); $response = $this->parseRequest($data);
$this->debug("parsed request and got an object of this class '".get_class($response)."'"); $this->debug("parsed request and got an object of this class '".get_class($response)."'");
$this->debug("server sending..."); $this->debug("server sending...");
// pass along the debug string // pass along the debug string
@ -65,51 +50,54 @@
} }
$header[] = "Server: SOAPx4 Server v0.344359s\r\n"; $header[] = "Server: SOAPx4 Server v0.344359s\r\n";
$header[] = "Connection: Close\r\n"; $header[] = "Connection: Close\r\n";
$header[] = "Content-Type: text/xml; charset=$this->xml_encoding\r\n"; $header[] = "Content-Type: text/xml; charset=UTF-8\r\n";
$header[] = "Content-Length: ".strlen($payload)."\r\n\r\n"; $header[] = "Content-Length: ".strlen($payload)."\r\n\r\n";
@reset($header); reset($header);
while(list($null,$hdr) = @each($header)) foreach($header as $hdr)
/* foreach($header as $hdr) */
{ {
header($hdr); header($hdr);
} }
print $payload; print $payload;
} }
function parse_request($data='') function parseRequest($data="")
{ {
global $HTTP_SERVER_VARS; global $HTTP_SERVER_VARS;
$this->debug('entering parse_request() on '.date('H:i Y-m-d')); $this->debug("entering parseRequest() on ".date("H:i Y-m-d"));
$request_uri = $HTTP_SERVER_VARS['REQUEST_URI']; $request_uri = $HTTP_SERVER_VARS["REQUEST_URI"];
$this->debug("request uri: $request_uri"); $this->debug("request uri: $request_uri");
// get headers // get headers
if(function_exists('getallheaders')) $headers_array = getallheaders();
{ foreach($headers_array as $k=>$v)
$this->headers = getallheaders();
while(list($k,$v) = @each($this->headers))
/* foreach($this->headers as $k=>$v) */
{ {
$dump .= "$k: $v\r\n"; $dump .= "$k: $v\r\n";
} }
// get SOAPAction header $dump .= "\r\n\r\n".$data;
if($this->headers['SOAPAction']) $this->headers = $headers_array;
$this->request = $dump;
// get SOAPAction header -> methodname
if($headers_array["SOAPAction"])
{ {
$this->SOAPAction = str_replace('"','',$this->headers['SOAPAction']); $action = str_replace('"','',$headers_array["SOAPAction"]);
$this->service = $this->SOAPAction; if(ereg("^urn:",$action))
}
// get character encoding
if(ereg("=",$this->headers['Content-Type']))
{ {
$this->xml_encoding = str_replace("\"","",substr(strstr($this->headers["Content-Type"],"="),1)); $this->service = substr($action,4);
} }
elseif(ereg("^text/xml",$this->headers['Content-Type'])) elseif(ereg(".php",$action))
{ {
$this->xml_encoding = 'us-ascii'; $this->service = ereg_replace('"|/','',substr(strrchr($action,".php"),4,strlen(strrchr($action,"/"))));
} }
$this->debug("got encoding: $this->xml_encoding"); $this->debug("got service: $this->service");
} }
$this->request = $dump."\r\n\r\n".$data; else
{
// throw a fault if no soapaction
$this->debug("ERROR: no SOAPAction header found");
}
// NOTE:::: throw a fault for no/bad soapaction here?
// parse response, get soap parser obj // parse response, get soap parser obj
$parser = CreateObject('phpgwapi.soap_parser',$data); $parser = CreateObject('phpgwapi.soap_parser',$data);
// get/set methodname // get/set methodname
@ -117,15 +105,29 @@
$this->debug("method name: $this->methodname"); $this->debug("method name: $this->methodname");
// does method exist? // does method exist?
if(function_exists($this->methodname)) $test = ereg_replace("\.",'_',$this->methodname);
if(function_exists($test))
{ {
$method = $this->methodname = $test;
$this->debug("method '$this->methodname' exists"); $this->debug("method '$this->methodname' exists");
} }
else else
{ {
/* phpgroupware customization - createobject based on methodname */ /* phpgroupware customization - createobject based on methodname */
list($app,$class,$method) = explode('.',$this->methodname); list($app,$class,$method) = explode('.',$this->methodname);
if(ereg("^service",$app))
{
$args = $class;
$class = 'service';
$app = 'phpgwapi';
$obj = CreateObject(sprintf('%s.%s',$app,$class),$args);
unset($args);
}
else
{
$obj = CreateObject(sprintf('%s.%s',$app,$class)); $obj = CreateObject(sprintf('%s.%s',$app,$class));
}
$this->debug('app: ' . $app . ', class: ' . $class . ', method: ' . $method);
/* /*
// "method not found" fault here // "method not found" fault here
$this->debug("method '$obj->method' not found!"); $this->debug("method '$obj->method' not found!");
@ -140,7 +142,7 @@
{ {
// parser debug // parser debug
$this->debug($parser->debug_str); $this->debug($parser->debug_str);
$this->result = 'fault: error in msg parsing or eval'; $this->result = "fault: error in msg parsing or eval";
$this->make_fault("Server","error in msg parsing or eval:\n".$parser->get_response()); $this->make_fault("Server","error in msg parsing or eval:\n".$parser->get_response());
// return soapresp // return soapresp
return $this->fault(); return $this->fault();
@ -149,7 +151,7 @@
else else
{ {
// get eval_str // get eval_str
$this->debug('calling parser->get_response()'); $this->debug("calling parser->get_response()");
// evaluate it, getting back a soapval object // evaluate it, getting back a soapval object
if(!$request_val = $parser->get_response()) if(!$request_val = $parser->get_response())
{ {
@ -157,7 +159,7 @@
} }
// parser debug // parser debug
$this->debug($parser->debug_str); $this->debug($parser->debug_str);
if(get_class($request_val) == 'soapval') if(get_class($request_val) == "soapval")
{ {
if (is_object($obj)) if (is_object($obj))
{ {
@ -191,40 +193,47 @@
{ {
if (is_object($obj)) if (is_object($obj))
{ {
$code = "\$method_response = call_user_method(\$method,\$obj,"; $code = "\$method_response = call_user_method($method,$obj,";
$this->debug("about to call method '$class -> $method'"); $this->debug("about to call object method '$class\-\>$method' with args");
} }
else else
{ {
$code = "\$method_response = call_user_func(\$this->methodname,"; $code = '$method_response = ' . $this->methodname . "('";
$this->debug("about to call method '$this->methodname'"); $args = implode("','",$request_data['return']);
$this->debug("about to call method '$this->methodname' with args: $args");
} }
/* call method with parameters */ /* call method with parameters */
$this->debug("about to call method '$class -> $method'"); $code .= implode("','",$request_data['return']);
/*
while(list($x,$y) = each($request_data)) while(list($x,$y) = each($request_data))
{ {
$code .= "\$request_data[$x]" . ','; $code .= "\$request_data[$x]" . ',';
} }
$code = substr($code,0,-1) .');'; $code = substr($code,0,-1) .");";
*/
$code .= "');";
$this->debug('CODE: ' . $code);
if(eval($code)) if(eval($code))
{ {
if (is_object($obj)) if (is_object($obj))
{ {
$this->make_fault("Server","Method call failed for '$obj->method' with params: ".join(",",$request_data)); $this->make_fault("Server","Object method call failed for '$class\-\>$method' with params: ".join(',',$request_data));
} }
else else
{ {
$this->make_fault("Server","Method call failed for '$this->methodname' with params: ".join(",",$request_data)); $this->make_fault("Server","Method call failed for '$this->methodname' with params: ".join(',',$request_data));
} }
return $this->fault(); return $this->fault();
} }
$this->debug('Response: ' . $method_response);
// _debug_array($method_response);
} }
else else
{ {
/* call method w/ no parameters */ /* call method w/ no parameters */
if (is_object($obj)) if (is_object($obj))
{ {
$this->debug("about to call method '$obj->method'"); $this->debug("about to call object method '$obj\-\>$method'");
if(!$method_response = call_user_method($method,$obj)) if(!$method_response = call_user_method($method,$obj))
{ {
$this->make_fault("Server","Method call failed for '$obj->method' with no params"); $this->make_fault("Server","Method call failed for '$obj->method' with no params");
@ -253,48 +262,43 @@
{ {
$code .= "\$request_data[$x]" . ','; $code .= "\$request_data[$x]" . ',';
} }
$code = substr($code,0,-1) .');'; $code = substr($code,0,-1) .");";
$this->debug("about to call method '$obj->method'"); $this->debug("about to call object method '$obj\-\>$method'");
eval($code); eval($code);
} }
else else
{ {
/* call method w/ no parameters */ /* call method w/ no parameters */
$this->debug("about to call method '$obj->method'"); if(is_object($obj))
{
$this->debug("about to call object method '$obj\-\>$method'");
call_user_method($method,$obj); call_user_method($method,$obj);
} }
}
/* return fault */
if(get_class($method_response) == 'soapmsg')
{
if(eregi('fault',$method_response->value->name))
{
$this->fault = True;
}
$return_msg = $method_response;
}
else else
{ {
/* return soapval object */ $this->debug("about to call method '$method'");
call_user_func($method);
}
}
}
if(get_class($method_response) == 'soapval')
{
$return_val = $method_response;
/* create soap_val object w/ return values from method, use method signature to determine type */ /* create soap_val object w/ return values from method, use method signature to determine type */
} if(get_class($method_response) != 'soapval')
else
{ {
$return_val = CreateObject('phpgwapi.soapval',$method,$this->return_type,$method_response); $return_val = CreateObject('phpgwapi.soapval',$method,$this->return_type,$method_response);
} }
else
{
$return_val = $method_response;
}
$this->debug($return_val->debug_str); $this->debug($return_val->debug_str);
/* response object is a soap_msg object */ /* response object is a soap_msg object */
$return_msg = CreateObject('phpgwapi.soapmsg',$method.'Response',array($return_val),$this->service); $return_msg = CreateObject('phpgwapi.soapmsg',$method.'Response',array($return_val),$this->service);
}
if($this->debug_flag) if($this->debug_flag)
{ {
$return_msg->debug_flag = true; $return_msg->debug_flag = true;
} }
$this->result = 'successful'; $this->result = "successful";
return $return_msg; return $return_msg;
} }
else else
@ -312,7 +316,7 @@
$this->debug("ERROR: parser did not return soapval object: $request_val ".get_class($request_val)); $this->debug("ERROR: parser did not return soapval object: $request_val ".get_class($request_val));
$this->result = "fault: parser did not return soapval object: $request_val"; $this->result = "fault: parser did not return soapval object: $request_val";
// return fault // return fault
$this->make_fault('Server',"parser did not return soapval object: $request_val"); $this->make_fault("Server","parser did not return soapval object: $request_val");
return $this->fault(); return $this->fault();
} }
} }
@ -321,7 +325,7 @@
function verify_method($request) function verify_method($request)
{ {
//return true; //return true;
$this->debug('entered verify_method() w/ request name: '.$request->name); $this->debug("entered verify_method() w/ request name: ".$request->name);
$params = $request->value; $params = $request->value;
// if there are input parameters required... // if there are input parameters required...
if($sig = $this->dispatch_map[$this->methodname]["in"]) if($sig = $this->dispatch_map[$this->methodname]["in"])
@ -329,10 +333,8 @@
$this->input_value = count($sig); $this->input_value = count($sig);
if(is_array($params)) if(is_array($params))
{ {
$this->debug('entered verify_method() with '.count($params).' parameters'); $this->debug("entered verify_method() with ".count($params)." parameters");
@reset($params); foreach($params as $v)
while(list($null,$v) = @each($params))
/* foreach($params as $v) */
{ {
$this->debug("param '$v->name' of type '$v->type'"); $this->debug("param '$v->name' of type '$v->type'");
} }
@ -341,9 +343,7 @@
{ {
$this->debug("got correct number of parameters: ".count($sig)); $this->debug("got correct number of parameters: ".count($sig));
// make array of param types // make array of param types
@reset($params); foreach($params as $param)
while(list($null,$param) = @each($params))
/* foreach($params as $param) */
{ {
$p[] = strtolower($param->type); $p[] = strtolower($param->type);
} }
@ -354,7 +354,7 @@
if(strtolower($sig[$i]) != strtolower($p[$i])) if(strtolower($sig[$i]) != strtolower($p[$i]))
{ {
$this->debug("mismatched parameter types: $sig[$i] != $p[$i]"); $this->debug("mismatched parameter types: $sig[$i] != $p[$i]");
$this->make_fault('Client',"soap request contained mismatching parameters of name $v->name had type $p[$i], which did not match signature's type: $sig[$i]"); $this->make_fault("Client","soap request contained mismatching parameters of name $v->name had type $p[$i], which did not match signature's type: $sig[$i]");
return false; return false;
} }
$this->debug("parameter type match: $sig[$i] = $p[$i]"); $this->debug("parameter type match: $sig[$i] = $p[$i]");
@ -364,8 +364,8 @@
} }
else else
{ {
$this->debug('oops, wrong number of parameter!'); $this->debug("oops, wrong number of parameter!");
$this->make_fault('Client',"soap request contained incorrect number of parameters. method '$this->methodname' required ".count($sig)." and request provided ".count($params)); $this->make_fault("Client","soap request contained incorrect number of parameters. method '$this->methodname' required ".count($sig)." and request provided ".count($params));
return false; return false;
} }
// oops, no params... // oops, no params...
@ -373,7 +373,7 @@
else else
{ {
$this->debug("oops, no parameters sent! Method '$this->methodname' requires ".count($sig)." input parameters!"); $this->debug("oops, no parameters sent! Method '$this->methodname' requires ".count($sig)." input parameters!");
$this->make_fault('Client',"soap request contained incorrect number of parameters. method '$this->methodname' requires ".count($sig)." parameters, and request provided none"); $this->make_fault("Client","soap request contained incorrect number of parameters. method '$this->methodname' requires ".count($sig)." parameters, and request provided none");
return false; return false;
} }
// no params // no params
@ -394,9 +394,9 @@
// get string return type from dispatch map // get string return type from dispatch map
function get_return_type() function get_return_type()
{ {
if(count($this->dispatch_map[$this->methodname]['out']) >= 1) if(count($this->dispatch_map[$this->methodname]["out"]) >= 1)
{ {
$type = array_shift($this->dispatch_map[$this->methodname]['out']); $type = array_shift($this->dispatch_map[$this->methodname]["out"]);
$this->debug("got return type from dispatch map: '$type'"); $this->debug("got return type from dispatch map: '$type'");
return $type; return $type;
} }
@ -415,22 +415,22 @@
// add a method to the dispatch map // add a method to the dispatch map
function add_to_map($methodname,$in,$out) function add_to_map($methodname,$in,$out)
{ {
$this->dispatch_map[$methodname]['in'] = $in; $this->dispatch_map[$methodname]["in"] = $in;
$this->dispatch_map[$methodname]['out'] = $out; $this->dispatch_map[$methodname]["out"] = $out;
} }
// set up a fault // set up a fault
function fault() function fault()
{ {
return CreateObject('phpgwapi.soapmsg', return CreateObject('phpgwapi.soapmsg',
'Fault', "Fault",
array( array(
'faultcode' => $this->fault_code, "faultcode" => $this->fault_code,
'faultstring' => $this->fault_str, "faultstring" => $this->fault_str,
'faultactor' => $this->fault_actor, "faultactor" => $this->fault_actor,
'faultdetail' => $this->fault_detail.$this->debug_str "faultdetail" => $this->fault_detail.$this->debug_str
), ),
'http://schemas.xmlsoap.org/soap/envelope/' "http://schemas.xmlphpgwapi.org/soap/envelope/"
); );
} }

View File

@ -40,13 +40,13 @@
function soapmsg($method,$params,$method_namespace='http://testuri.org',$new_namespaces=False) function soapmsg($method,$params,$method_namespace='http://testuri.org',$new_namespaces=False)
{ {
// globalize method namespace // globalize method namespace
global $methodNamespace; $GLOBALS['methodNamespace'] = $method_namespace;
$methodNamespace = $method_namespace; $namespaces = $GLOBALS['namespaces'];
// make method struct // make method struct
$this->value = CreateObject('phpgwapi.soapval',$method,"struct",$params,$method_namespace); $this->value = CreateObject('phpgwapi.soapval',$method,"struct",$params,$method_namespace);
if(is_array($new_namespaces)) if(is_array($new_namespaces))
{ {
global $namespaces;
$i = count($namespaces); $i = count($namespaces);
@reset($new_namespaces); @reset($new_namespaces);
while(list($null,$v) = @each($new_namespaces)) while(list($null,$v) = @each($new_namespaces))
@ -63,7 +63,7 @@
function make_envelope($payload) function make_envelope($payload)
{ {
global $namespaces; $namespaces = $GLOBALS['namespaces'];
@reset($namespaces); @reset($namespaces);
while(list($k,$v) = @each($namespaces)) while(list($k,$v) = @each($namespaces))
/* foreach($namespaces as $k => $v) */ /* foreach($namespaces as $k => $v) */

View File

@ -39,8 +39,6 @@
// function soapval($name='',$type=False,$value=-1,$namespace=False,$type_namespace=False) // function soapval($name='',$type=False,$value=-1,$namespace=False,$type_namespace=False)
function soapval($name='',$type=False,$value=0,$namespace=False,$type_namespace=False) function soapval($name='',$type=False,$value=0,$namespace=False,$type_namespace=False)
{ {
global $soapTypes, $typemap, $namespaces, $methodNamespace;
// detect type if not passed // detect type if not passed
if(!$type) if(!$type)
{ {
@ -74,7 +72,7 @@
$type = 'int'; $type = 'int';
} }
$this->soapTypes = $soapTypes; $this->soapTypes = $GLOBALS['soapTypes'];
$this->name = $name; $this->name = $name;
$this->value = ''; $this->value = '';
$this->type = $type; $this->type = $type;
@ -88,11 +86,11 @@
if($namespace) if($namespace)
{ {
$this->namespace = $namespace; $this->namespace = $namespace;
if(!isset($namespaces[$namespace])) if(!isset($GLOBALS['namespaces'][$namespace]))
{ {
$namespaces[$namespace] = "ns".(count($namespaces)+1); $GLOBALS['namespaces'][$namespace] = "ns".(count($GLOBALS['namespaces'])+1);
} }
$this->prefix = $namespaces[$namespace]; $this->prefix = $GLOBALS['namespaces'][$namespace];
} }
// get type prefix // get type prefix
@ -103,11 +101,11 @@
} }
elseif($type_namespace) elseif($type_namespace)
{ {
if(!isset($namespaces[$type_namespace])) if(!isset($GLOBALS['namespaces'][$type_namespace]))
{ {
$namespaces[$type_namespace] = 'ns'.(count($namespaces)+1); $GLOBALS['namespaces'][$type_namespace] = 'ns'.(count($GLOBALS['namespaces'])+1);
} }
$this->type_prefix = $namespaces[$type_namespace]; $this->type_prefix = $GLOBALS['namespaces'][$type_namespace];
} }
// if type namespace was not explicitly passed, and we're not in a method struct: // if type namespace was not explicitly passed, and we're not in a method struct:
@ -117,7 +115,7 @@
if(!$this->type_prefix = $this->verify_type($type)) if(!$this->type_prefix = $this->verify_type($type))
{ {
// else default to method namespace // else default to method namespace
$this->type_prefix = $namespaces[$methodNamespace]; $this->type_prefix = $GLOBALS['namespaces'][$GLOBALS['methodNamespace']];
} }
} }
@ -141,7 +139,7 @@
} }
else else
{ {
//if($namespace == $methodNamespace){ //if($namespace == $GLOBALS['methodNamespace']){
$this->type_code = 3; $this->type_code = 3;
$this->addStruct($value); $this->addStruct($value);
//} //}
@ -433,16 +431,16 @@
{ {
if ($type) if ($type)
{ {
// global $namespaces,$soapTypes,$typemap; // global $GLOBALS['namespaces'],$GLOBALS['soapTypes'],$GLOBALS['typemap'];
global $namespaces,$typemap; // global $GLOBALS['namespaces'],$GLOBALS['typemap'];
@reset($typemap); @reset($GLOBALS['typemap']);
while(list($namespace,$types) = @each($typemap)) while(list($namespace,$types) = @each($GLOBALS['typemap']))
/* foreach($typemap as $namespace => $types) */ /* foreach($GLOBALS['typemap'] as $namespace => $types) */
{ {
if(in_array($type,$types)) if(in_array($type,$types))
{ {
return $namespaces[$namespace]; return $GLOBALS['namespaces'][$namespace];
} }
} }
} }

View File

@ -103,8 +103,7 @@
{ {
$rtrn = array(CreateObject('phpgwapi.soapval','GOAWAY','string',$username)); $rtrn = array(CreateObject('phpgwapi.soapval','GOAWAY','string',$username));
} }
$r = CreateObject('phpgwapi.soapmsg','system_loginResponse',$rtrn); return $rtrn;
return $r;
} }
function system_logout($m1,$m2) function system_logout($m1,$m2)
@ -112,13 +111,12 @@
$sessionid = $m1; $sessionid = $m1;
$kp3 = $m2; $kp3 = $m2;
$username = $GLOBALS['phpgw']->session->account_lid; $later = $GLOBALS['phpgw']->session->destroy($sessionid,$kp3);
$later = $GLOBALS['phpgw']->session->destroy();
if($later) if($later)
{ {
$rtrn = array( $rtrn = array(
CreateObject('phpgwapi.soapval','GOODBYE','string',$username) CreateObject('phpgwapi.soapval','GOODBYE','string','XOXO')
); );
} }
else else
@ -127,7 +125,31 @@
CreateObject('phpgwapi.soapval','OOPS','string','WHAT?') CreateObject('phpgwapi.soapval','OOPS','string','WHAT?')
); );
} }
$r = CreateObject('phpgwapi.soapmsg','system_logoutResponse',$rtrn); return $rtrn;
return $r;
} }
/*
function system_listApps()
{
$GLOBALS['phpgw']->db->query("SELECT * FROM phpgw_applications WHERE app_enabled<3",__LINE__,__FILE__);
$apps = array();
if($GLOBALS['phpgw']->db->num_rows())
{
while ($GLOBALS['phpgw']->db->next_record())
{
$name = $GLOBALS['phpgw']->db->f('app_name');
$title = $GLOBALS['phpgw']->db->f('app_title');
$status = $GLOBALS['phpgw']->db->f('app_enabled');
$version= $GLOBALS['phpgw']->db->f('app_version');
$apps[$name] = array(
CreateObject('phpgwapi.soapval','title','string',$title),
CreateObject('phpgwapi.soapval','name','string',$name),
CreateObject('phpgwapi.soapval','status','string',$status),
CreateObject('phpgwapi.soapval','version','string',$version)
);
}
}
return $apps;
}
*/
?> ?>

View File

@ -19,18 +19,17 @@
/* $Id$ */ /* $Id$ */
$server->add_to_map( $GLOBALS['server']->add_to_map(
'hello', 'hello',
array('string'), array('string'),
array('string') array('string')
); );
function hello($serverid) function hello($serverid)
{ {
global $phpgw_info; return CreateObject('soap.soapval','return','string',$GLOBALS['phpgw_info']['server']['site_title']);
return CreateObject('soap.soapval','return','string',$phpgw_info['server']['site_title']);
} }
$server->add_to_map( $GLOBALS['server']->add_to_map(
'echoString', 'echoString',
array('string'), array('string'),
array('string') array('string')
@ -40,7 +39,7 @@
return CreateObject('soap.soapval','return','string',$inputString); return CreateObject('soap.soapval','return','string',$inputString);
} }
$server->add_to_map( $GLOBALS['server']->add_to_map(
'echoStringArray', 'echoStringArray',
array('array'), array('array'),
array('array') array('array')
@ -50,7 +49,7 @@
return $inputStringArray; return $inputStringArray;
} }
$server->add_to_map( $GLOBALS['server']->add_to_map(
'echoInteger', 'echoInteger',
array('int'), array('int'),
array('int') array('int')
@ -60,7 +59,7 @@
return $inputInteger; return $inputInteger;
} }
$server->add_to_map( $GLOBALS['server']->add_to_map(
'echoIntegerArray', 'echoIntegerArray',
array('array'), array('array'),
array('array') array('array')
@ -70,7 +69,7 @@
return $inputIntegerArray; return $inputIntegerArray;
} }
$server->add_to_map( $GLOBALS['server']->add_to_map(
'echoFloat', 'echoFloat',
array('float'), array('float'),
array('float') array('float')
@ -80,7 +79,7 @@
return $inputFloat; return $inputFloat;
} }
$server->add_to_map( $GLOBALS['server']->add_to_map(
'echoFloatArray', 'echoFloatArray',
array('array'), array('array'),
array('array') array('array')
@ -90,7 +89,7 @@
return $inputFloatArray; return $inputFloatArray;
} }
$server->add_to_map( $GLOBALS['server']->add_to_map(
'echoStruct', 'echoStruct',
array('SOAPStruct'), array('SOAPStruct'),
array('SOAPStruct') array('SOAPStruct')
@ -100,7 +99,7 @@
return $inputStruct; return $inputStruct;
} }
$server->add_to_map( $GLOBALS['server']->add_to_map(
'echoStructArray', 'echoStructArray',
array('array'), array('array'),
array('array') array('array')
@ -110,7 +109,7 @@
return $inputStructArray; return $inputStructArray;
} }
$server->add_to_map( $GLOBALS['server']->add_to_map(
'echoVoid', 'echoVoid',
array(), array(),
array() array()
@ -119,7 +118,7 @@
{ {
} }
$server->add_to_map( $GLOBALS['server']->add_to_map(
'echoBase64', 'echoBase64',
array('base64'), array('base64'),
array('base64') array('base64')
@ -129,7 +128,7 @@
return base64_encode(base64_decode($b_encoded)); return base64_encode(base64_decode($b_encoded));
} }
$server->add_to_map( $GLOBALS['server']->add_to_map(
'echoDate', 'echoDate',
array('timeInstant'), array('timeInstant'),
array('timeInstant') array('timeInstant')
@ -139,13 +138,13 @@
return $timeInstant; return $timeInstant;
} }
$server->add_to_map( $GLOBALS['server']->add_to_map(
'system_auth', 'system_auth',
array('string','string','string'), array('string','string','string'),
array('array') array('array')
); );
$server->add_to_map( $GLOBALS['server']->add_to_map(
'system_auth_verify', 'system_auth_verify',
array('string','string','string'), array('string','string','string'),
array('array') array('array')

View File

@ -21,9 +21,9 @@
include('./header.inc.php'); include('./header.inc.php');
$server = CreateObject('phpgwapi.soap_server'); $GLOBALS['server'] = CreateObject('phpgwapi.soap_server');
/* _debug_array($server);exit; */ /* _debug_array($GLOBALS['server']);exit; */
//include(PHPGW_API_INC . '/soaplib.soapinterop.php'); /* include(PHPGW_API_INC . '/soaplib.soapinterop.php'); */
$headers = getallheaders(); $headers = getallheaders();
@ -37,23 +37,33 @@
if($GLOBALS['phpgw']->session->verify($sessionid,$kp3)) if($GLOBALS['phpgw']->session->verify($sessionid,$kp3))
{ {
$server->authed = True; $GLOBALS['server']->authed = True;
} }
elseif($GLOBALS['phpgw']->session->verify_server($sessionid,$kp3)) elseif($GLOBALS['phpgw']->session->verify_server($sessionid,$kp3))
{ {
$server->authed = True; $GLOBALS['server']->authed = True;
} }
} }
$server->add_to_map( $GLOBALS['server']->add_to_map(
'system_login', 'system_login',
array('string','string','string'), array('soapstruct'),
array('array') array('soapstruct')
); );
$server->add_to_map( $GLOBALS['server']->add_to_map(
'system_logout', 'system_logout',
array('string','string'), array('soapstruct'),
array('array') array('soapstruct')
); );
$server->service($HTTP_RAW_POST_DATA);
if(function_exists('system_listapps'))
{
$GLOBALS['server']->add_to_map(
'system_listApps',
array(),
array('soapstruct')
);
}
$GLOBALS['server']->service($HTTP_RAW_POST_DATA);
?> ?>