diff --git a/phpgwapi/inc/class.interserver.inc.php b/phpgwapi/inc/class.interserver.inc.php index 1555457906..cfed7022ac 100644 --- a/phpgwapi/inc/class.interserver.inc.php +++ b/phpgwapi/inc/class.interserver.inc.php @@ -152,7 +152,7 @@ $f = CreateObject('phpgwapi.xmlrpcmsg', $method_name, $arr,'struct'); $this->debug("
" . htmlentities($f->serialize()) . "
\n",$debug); $c = CreateObject('phpgwapi.xmlrpc_client',$this->urlparts['xmlrpc'], $hostpart, 80); - $c->setDebug(1); + $c->setDebug(0); $r = $c->send($f,0,True); if (!$r) { @@ -213,88 +213,55 @@ function _send_soap_ssl($method_name, $args, $url, $debug=True) { - /* Not working */ - return; - preg_match('/^(.*?\/\/.*?)(\/.*)/',$url,$matches); - $hostpart = $matches[1]; - $uri = $matches[2]; - - $this->debug("opening curl to $url", $debug); - - if(gettype($args) != 'array') + $method_name = str_replace('.','_',$method_name); + list($uri,$hostpart) = $this->_split_url($url . $this->urlparts['soap']); + $hostpart = ereg_replace('https://','',$hostpart); + $hostpart = ereg_replace('http://','',$hostpart); + while(list($key,$val) = @each($args)) { - $args[] = $args; + $arr[] = CreateObject('phpgwapi.soapval',$key, 'string',$val); + } + $soap_message = CreateObject('phpgwapi.soapmsg',$method_name,$arr,'http://soapinterop.org'); + /* print_r($soap_message);exit; */ + $soap = CreateObject('phpgwapi.soap_client',$uri,$hostpart); + /* _debug_array($soap);exit; */ + if($r = $soap->send($soap_message,$method_name)) + { + $this->debug('
I got this value back
' . htmlentities($r->serialize()) . '

',$debug); + /* _debug_array($soap); */ + /* echo $soap->debug_str; */ + return $r; } else { - while(list($key,$val) = @each($args)) - { - $arr[$key] = CreateObject('phpgwapi.xmlrpcval',$val, 'string'); - } + $this->debug('Fault Code: ' . $r->ernno . ' Reason "' . $r->errstring . '"
',$debug); } - $f = CreateObject('phpgwapi.xmlrpcmsg',$method_name,array($arr)); - $content_len = strlen($f->serialize()); - - $cliversion = $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']; - $http_request = 'POST ' . $uri . ' HTTP/1.0' . "\r\n" - . 'User-Agent: phpGroupware/' . $cliversion . '(PHP) ' . "\r\n" - . 'X-PHPGW-Server: ' . $method_name . ' ' . "\r\n" - . 'Content-Type: text/xml' . "\r\n" - . 'Content-Length: ' . $content_len . "\r\n" . "\r\n" - . $f->serialize(); - - $this->debug("sending http request:\n" . $http_request . "\n", $debug); - - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL,$hostpart); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $http_request); - curl_setopt($ch, CURLOPT_HEADER, 0); - $response_buf = curl_exec($ch); - curl_close($ch); - - $this->debug("got response:.\n$response_buf\n\n", $debug); - - $retval = ''; - if (strlen($response_buf)) - { - $xml_begin = substr($response_buf, strpos($response_buf, "debug('Error: no xml start found from'.$hostpart.'!'); - } - } - else - { - $this->debug('Error: no response from '.$hostpart.'!'); - } - - return $retval; } function _send_soap_($method_name, $args, $url, $debug=True) { - /* Not working */ - return; + $method_name = str_replace('.','_',$method_name); + list($uri,$hostpart) = $this->_split_url($url . $this->urlparts['soap']); + $hostpart = ereg_replace('https://','',$hostpart); + $hostpart = ereg_replace('http://','',$hostpart); while(list($key,$val) = @each($args)) { - $arr[$key] = CreateObject('phpgwapi.soapval',$val, 'string'); + $arr[] = CreateObject('phpgwapi.soapval',$key, 'string',$val); } - $soap_message = CreateObject('phpgwapi.soapmsg', - $method, - $method_params[$method], - $server['methodNamespace'] - ); + $soap_message = CreateObject('phpgwapi.soapmsg',$method_name,$arr,'http://soapinterop.org'); /* print_r($soap_message);exit; */ - $soap = CreateObject('phpgwapi.soap_client',$server['endpoint']); - /* print_r($soap);exit; */ - if($return = $soap->send($soap_message,$server['soapaction'])) + $soap = CreateObject('phpgwapi.soap_client',$uri,$hostpart); + /* _debug_array($soap);exit; */ + if($r = $soap->send($soap_message,$method_name)) { - return $return; + $this->debug('
I got this value back
' . htmlentities($r->serialize()) . '

',$debug); + /* _debug_array($soap); */ + /* echo $soap->debug_str; */ + return $r; + } + else + { + $this->debug('Fault Code: ' . $r->ernno . ' Reason "' . $r->errstring . '"
',$debug); } } diff --git a/phpgwapi/inc/class.soap_client.inc.php b/phpgwapi/inc/class.soap_client.inc.php index a510b2ce2e..e0f52f3d00 100644 --- a/phpgwapi/inc/class.soap_client.inc.php +++ b/phpgwapi/inc/class.soap_client.inc.php @@ -42,7 +42,7 @@ $this->server = $server; $this->errno; $this->errstring; - $this->debug_flag = False; + $this->debug_flag = True; $this->debug_str = ''; $this->username = ''; $this->password = ''; diff --git a/phpgwapi/inc/class.soap_server.inc.php b/phpgwapi/inc/class.soap_server.inc.php index f006bc7c46..063a61978f 100644 --- a/phpgwapi/inc/class.soap_server.inc.php +++ b/phpgwapi/inc/class.soap_server.inc.php @@ -115,7 +115,7 @@ // get/set methodname $this->methodname = $parser->root_struct_name; $this->debug("method name: $this->methodname"); - + // does method exist? if(function_exists($this->methodname)) { @@ -181,7 +181,7 @@ } $this->debug("request data: $request_data"); } - + /* if there are return values */ if($this->return_type = $this->get_return_type()) { diff --git a/phpgwapi/inc/soap_functions.inc.php b/phpgwapi/inc/soap_functions.inc.php index c97cbdaf2e..684e7e54b8 100644 --- a/phpgwapi/inc/soap_functions.inc.php +++ b/phpgwapi/inc/soap_functions.inc.php @@ -67,4 +67,27 @@ */ $GLOBALS['soap_defencoding'] = 'UTF-8'; + + function system_auth($m1,$m2,$m3) + { + $serverdata['server_name'] = $m1; + $serverdata['username'] = $m2; + $serverdata['password'] = $m3; + + list($sessionid,$kp3) = $GLOBALS['phpgw']->session->create_server($serverdata['username'].'@'.$serverdata['server_name'],$serverdata['password']); + + if($sessionid && $kp3) + { + $rtrn = array( + CreateObject('phpgwapi.soapval','sessionid', 'string',$sessionid), + CreateObject('phpgwapi.soapval','kp3','string',$kp3) + ); + } + else + { + $rtrn = array(CreateObject('phpgwapi.soapval','GOAWAY','string','XOXO')); + } + $r = CreateObject('phpgwapi.soapmsg','system_authResponse',$rtrn); + return $r; + } ?>