Revision: 3633
Author: seba.wagner
Date: Sat Jan 8 07:43:22 2011
Log: update lib
http://code.google.com/p/openmeetings/source/detail?r=3633
Modified:
/trunk/plugins/moodle_plugin/lib/nusoap.php
/trunk/plugins/moodle_plugin/openmeetings_gateway.php
=======================================
--- /trunk/plugins/moodle_plugin/lib/nusoap.php Wed Aug 11 04:32:27 2010
+++ /trunk/plugins/moodle_plugin/lib/nusoap.php Sat Jan 8 07:43:22 2011
@@ -1,7 +1,7 @@
<?php
/*
-$Id: nusoap.php,v 1.114 2007/11/06 15:17:46 snichol Exp $
+$Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $
NuSOAP - Web Services Toolkit for PHP
@@ -24,8 +24,7 @@
The NuSOAP project home is:
http://sourceforge.net/projects/nusoap/
-The primary support for NuSOAP is the mailing list:
[email protected]
+The primary support for NuSOAP is the Help forum on the project home page.
If you have any questions or comments, please email:
@@ -51,17 +50,28 @@
* RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1
* RFC 2617 HTTP Authentication: Basic and Digest Access Authentication
*/
-
-/*
- *
- * This is a modified version of nusoap for usage of Axis2
- * for some reason it does not marshall the SOAP Body correct for Axis2 on
Linux Platforms
- *
- */
+
+/* load classes
+
+// necessary classes
+require_once('class.soapclient.php');
+require_once('class.soap_val.php');
+require_once('class.soap_parser.php');
+require_once('class.soap_fault.php');
+
+// transport classes
+require_once('class.soap_transport_http.php');
+
+// optional add-on classes
+require_once('class.xmlschema.php');
+require_once('class.wsdl.php');
+
+// server class
+require_once('class.soap_server.php');*/
// class variable emulation
// cf.
http://www.webkreator.com/php/techniques/php-static-class-variables.html
-$GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel = 9;
+$GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'] = 9;
/**
*
@@ -69,10 +79,10 @@
*
* @author Dietrich Ayala <[email protected]>
* @author Scott Nichol <[email protected]>
-* @version $Id: nusoap.php,v 1.114 2007/11/06 15:17:46 snichol Exp $
+* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $
* @access public
*/
-class nusoap_base_om {
+class nusoap_base {
/**
* Identification for HTTP headers.
*
@@ -86,14 +96,14 @@
* @var string
* @access private
*/
- var $version = '0.7.3';
+ var $version = '0.9.5';
/**
* CVS revision for HTTP headers.
*
* @var string
* @access private
*/
- var $revision = '$Revision: 1.114 $';
+ var $revision = '$Revision: 1.123 $';
/**
* Current error string (manipulated by getError/setError)
*
@@ -138,8 +148,8 @@
* @var string
* @access public
*/
- //var $soap_defencoding = 'ISO-8859-1';
- var $soap_defencoding = 'UTF-8';
+ var $soap_defencoding = 'ISO-8859-1';
+ //var $soap_defencoding = 'UTF-8';
/**
* namespaces in an array of prefix => uri
@@ -212,8 +222,8 @@
*
* @access public
*/
- function nusoap_base_om() {
- $this->debugLevel =
$GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel;
+ function nusoap_base() {
+ $this->debugLevel =
$GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'];
}
/**
@@ -223,7 +233,7 @@
* @access public
*/
function getGlobalDebugLevel() {
- return
$GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel;
+ return
$GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'];
}
/**
@@ -233,7 +243,7 @@
* @access public
*/
function setGlobalDebugLevel($level) {
- $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel =
$level;
+ $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'] =
$level;
}
/**
@@ -275,7 +285,6 @@
* @access public
*/
function appendDebug($string){
- //echo "## appendDebug: ".$string."<br/>";
if ($this->debugLevel > 0) {
// it would be nice to use a memory stream here to use
// memory more efficiently
@@ -552,7 +561,7 @@
case (is_array($val) || $type):
// detect if struct or array
$valueType = $this->isArraySimpleOrStruct($val);
- if($valueType=='arraySimple' || ereg('^ArrayOf',$type)){
+ if($valueType=='arraySimple' ||
preg_match('/^ArrayOf/',$type)){
$this->debug("serialize_val: serialize
array");
$i = 0;
if(is_array($val) && count($val)> 0){
@@ -697,9 +706,6 @@
}
$headers = "<SOAP-ENV:Header>".$headers."</SOAP-ENV:Header>";
}
- //echo "####<br/>";
- //echo $body;
- //echo "<br/>####<br/>";
// serialize envelope
return
'<?xml version="1.0" encoding="'.$this->soap_defencoding .'"?'.">".
@@ -758,7 +764,7 @@
*/
function expandQname($qname){
// get element prefix
- if(strpos($qname,':') && !ereg('^http://',$qname)){
+ if(strpos($qname,':') && !preg_match('/^http:\/\//',$qname)){
// get unqualified name
$name = substr(strstr($qname,':'),1);
// get ns prefix
@@ -890,15 +896,24 @@
/**
* convert unix timestamp to ISO 8601 compliant date string
*
-* @param string $timestamp Unix time stamp
+* @param int $timestamp Unix time stamp
* @param boolean $utc Whether the time stamp is UTC or local
+* @return mixed ISO 8601 date string or false
* @access public
*/
-/*
function timestamp_to_iso8601($timestamp,$utc=true){
$datestr = date('Y-m-d\TH:i:sO',$timestamp);
+ $pos = strrpos($datestr, "+");
+ if ($pos === FALSE) {
+ $pos = strrpos($datestr, "-");
+ }
+ if ($pos !== FALSE) {
+ if (strlen($datestr) == $pos + 5) {
+ $datestr = substr($datestr, 0, $pos + 3) . ':' .
substr($datestr, -2);
+ }
+ }
if($utc){
- $eregStr =
+ $pattern = '/'.
'([0-9]{4})-'. // centuries & years CCYY-
'([0-9]{2})-'. // months MM-
'([0-9]{2})'. // days DD
@@ -906,26 +921,27 @@
'([0-9]{2}):'. // hours hh:
'([0-9]{2}):'. // minutes mm:
'([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss...
- '(Z|[+\-][0-9]{2}:?[0-9]{2})?'; // Z to indicate UTC, -/+HH:MM:SS.SS...
for local tz's
-
- if(ereg($eregStr,$datestr,$regs)){
+ '(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS...
for local tz's
+ '/';
+
+ if(preg_match($pattern,$datestr,$regs)){
return
sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]);
}
return false;
} else {
return $datestr;
}
-}*/
+}
/**
* convert ISO 8601 compliant date string to unix timestamp
*
* @param string $datestr ISO 8601 compliant date string
+* @return mixed Unix timestamp (int) or false
* @access public
*/
-/*
function iso8601_to_timestamp($datestr){
- $eregStr =
+ $pattern = '/'.
'([0-9]{4})-'. // centuries & years CCYY-
'([0-9]{2})-'. // months MM-
'([0-9]{2})'. // days DD
@@ -933,8 +949,9 @@
'([0-9]{2}):'. // hours hh:
'([0-9]{2}):'. // minutes mm:
'([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss...
- '(Z|[+\-][0-9]{2}:?[0-9]{2})?'; // Z to indicate UTC, -/+HH:MM:SS.SS...
for local tz's
- if(ereg($eregStr,$datestr,$regs)){
+ '(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS...
for local tz's
+ '/';
+ if(preg_match($pattern,$datestr,$regs)){
// not utc
if($regs[8] != 'Z'){
$op = substr($regs[8],0,1);
@@ -953,7 +970,7 @@
} else {
return false;
}
-}*/
+}
/**
* sleeps some number of microseconds
@@ -962,7 +979,6 @@
* @access public
* @deprecated
*/
-/*
function usleepWindows($usec)
{
$start = gettimeofday();
@@ -975,7 +991,7 @@
}
while ($timePassed < $usec);
}
-*/
+
?><?php
@@ -985,10 +1001,10 @@
* Mainly used for returning faults from deployed functions
* in a server instance.
* @author Dietrich Ayala <[email protected]>
-* @version $Id: nusoap.php,v 1.114 2007/11/06 15:17:46 snichol Exp $
+* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $
* @access public
*/
-class nusoap_fault_om extends nusoap_base_om {
+class nusoap_fault extends nusoap_base {
/**
* The fault code (client|server)
* @var string
@@ -1022,8 +1038,8 @@
* @param string $faultstring human readable error message
* @param mixed $faultdetail detail, typically a string or array of
string
*/
- function
nusoap_fault_om($faultcode,$faultactor='',$faultstring='',$faultdetail=''){
- parent::nusoap_base_om();
+ function
nusoap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){
+ parent::nusoap_base();
$this->faultcode = $faultcode;
$this->faultactor = $faultactor;
$this->faultstring = $faultstring;
@@ -1060,7 +1076,7 @@
/**
* Backward compatibility
*/
-class soap_fault_om extends nusoap_fault_om {
+class soap_fault extends nusoap_fault {
}
?><?php
@@ -1073,10 +1089,10 @@
*
* @author Dietrich Ayala <[email protected]>
* @author Scott Nichol <[email protected]>
-* @version $Id: nusoap.php,v 1.114 2007/11/06 15:17:46 snichol Exp $
+* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $
* @access public
*/
-class nusoap_xmlschema_om extends nusoap_base_om {
+class nusoap_xmlschema extends nusoap_base {
// files
var $schema = '';
@@ -1115,8 +1131,8 @@
* @param string $namespaces namespaces defined in enclosing XML
* @access public
*/
- function nusoap_xmlschema_om($schema='',$xml='',$namespaces=array()){
- parent::nusoap_base_om();
+ function nusoap_xmlschema($schema='',$xml='',$namespaces=array()){
+ parent::nusoap_base();
$this->debug('nusoap_xmlschema class instantiated, inside
constructor');
// files
$this->schema = $schema;
@@ -1263,7 +1279,7 @@
if(count($attrs) > 0){
foreach($attrs as $k => $v){
// if ns declarations, add to class level array of valid
namespaces
- if(ereg("^xmlns",$k)){
+ if(preg_match('/^xmlns/',$k)){
//$this->xdebug("$k: $v");
//$this->xdebug('ns_prefix: '.$this->getPrefix($k));
if($ns_prefix = substr(strrchr($k,':'),1)){
@@ -1308,6 +1324,7 @@
$this->xdebug("parsing attribute:");
$this->appendDebug($this->varDump($attrs));
if (!isset($attrs['form'])) {
+ // TODO: handle globals
$attrs['form'] =
$this->schemaInfo['attributeFormDefault'];
}
if
(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
@@ -1357,6 +1374,7 @@
}
break;
case 'complexContent': // (optional) content for a
complexType
+ $this->xdebug("do nothing for element $name");
break;
case 'complexType':
array_push($this->complexTypeStack,
$this->currentComplexType);
@@ -1375,7 +1393,7 @@
// minOccurs="0"
maxOccurs="unbounded" />
// </sequence>
// </complexType>
- if(isset($attrs['base']) &&
ereg(':Array$',$attrs['base'])){
+ if(isset($attrs['base']) &&
preg_match('/:Array$/',$attrs['base'])){
$this->xdebug('complexType is
unusual array');
$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
} else {
@@ -1395,18 +1413,24 @@
// minOccurs="0"
maxOccurs="unbounded" />
// </sequence>
// </complexType>
- if(isset($attrs['base']) &&
ereg(':Array$',$attrs['base'])){
+ if(isset($attrs['base']) &&
preg_match('/:Array$/',$attrs['base'])){
$this->xdebug('complexType is
unusual array');
$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
} else {
$this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
}
}
+ $this->complexTypes[$this->currentComplexType]['simpleContent']
= 'false';
break;
case 'element':
array_push($this->elementStack,
$this->currentElement);
if (!isset($attrs['form'])) {
- $attrs['form'] =
$this->schemaInfo['elementFormDefault'];
+ if ($this->currentComplexType) {
+ $attrs['form'] =
$this->schemaInfo['elementFormDefault'];
+ } else {
+ // global
+ $attrs['form'] = 'qualified';
+ }
}
if(isset($attrs['type'])){
$this->xdebug("processing typed element ".$attrs['name']." of
type ".$attrs['type']);
@@ -1460,22 +1484,38 @@
case 'extension': // simpleContent or
complexContent type extension
$this->xdebug('extension ' . $attrs['base']);
if ($this->currentComplexType) {
- $this->complexTypes[$this->currentComplexType]['extensionBase'] =
$attrs['base'];
+ $ns = $this->getPrefix($attrs['base']);
+ if ($ns == '') {
+ $this->complexTypes[$this->currentComplexType]['extensionBase'] =
$this->schemaTargetNamespace . ':' . $attrs['base'];
+ } else {
+ $this->complexTypes[$this->currentComplexType]['extensionBase'] =
$attrs['base'];
+ }
+ } else {
+ $this->xdebug('no current complexType
to set extensionBase');
}
break;
case 'import':
if (isset($attrs['schemaLocation'])) {
- //$this->xdebug('import namespace ' . $attrs['namespace'] . '
from ' . $attrs['schemaLocation']);
+ $this->xdebug('import namespace ' . $attrs['namespace'] . ' from ' .
$attrs['schemaLocation']);
$this->imports[$attrs['namespace']][] =
array('location' => $attrs['schemaLocation'], 'loaded' => false);
} else {
- //$this->xdebug('import namespace ' .
$attrs['namespace']);
+ $this->xdebug('import namespace ' .
$attrs['namespace']);
$this->imports[$attrs['namespace']][] =
array('location' => '', 'loaded' => true);
if (!
$this->getPrefixFromNamespace($attrs['namespace'])) {
$this->namespaces['ns'.(count($this->namespaces)+1)] =
$attrs['namespace'];
}
}
+ break;
+ case 'include':
+ if (isset($attrs['schemaLocation'])) {
+ $this->xdebug('include into namespace ' .
$this->schemaTargetNamespace . ' from ' . $attrs['schemaLocation']);
+ $this->imports[$this->schemaTargetNamespace][] =
array('location' => $attrs['schemaLocation'], 'loaded' => false);
+ } else {
+ $this->xdebug('ignoring invalid XML Schema construct: include without
schemaLocation attribute');
+ }
break;
case 'list': // simpleType value list
+ $this->xdebug("do nothing for element $name");
break;
case 'restriction': // simpleType, simpleContent or complexContent
value restriction
$this->xdebug('restriction ' . $attrs['base']);
@@ -1502,6 +1542,11 @@
}
break;
case 'simpleContent': // (optional) content for a
complexType
+ if ($this->currentComplexType) { // This
should *always* be
+ $this->complexTypes[$this->currentComplexType]['simpleContent']
= 'true';
+ } else {
+ $this->xdebug("do nothing for element $name because there is no
current complexType");
+ }
break;
case 'simpleType':
array_push($this->simpleTypeStack,
$this->currentSimpleType);
@@ -1521,9 +1566,10 @@
}
break;
case 'union': // simpleType type list
+ $this->xdebug("do nothing for element $name");
break;
default:
- //$this->xdebug("do not have anything to do for
element $name");
+ $this->xdebug("do not have any logic to process
element $name");
}
}
@@ -1551,6 +1597,7 @@
// move on...
if($name == 'complexType'){
$this->xdebug('done processing complexType ' .
($this->currentComplexType ? $this->currentComplexType : '(unknown)'));
+
$this->xdebug($this->varDump($this->complexTypes[$this->currentComplexType]));
$this->currentComplexType =
array_pop($this->complexTypeStack);
//$this->currentElement = false;
}
@@ -1560,6 +1607,7 @@
}
if($name == 'simpleType'){
$this->xdebug('done processing simpleType ' .
($this->currentSimpleType ? $this->currentSimpleType : '(unknown)'));
+
$this->xdebug($this->varDump($this->simpleTypes[$this->currentSimpleType]));
$this->currentSimpleType =
array_pop($this->simpleTypeStack);
}
}
@@ -1796,6 +1844,9 @@
if (isset($etype['elements'])) {
$this->elements[$type]['elements'] = $etype['elements'];
}
+ if (isset($etype['extensionBase'])) {
+
$this->elements[$type]['extensionBase'] = $etype['extensionBase'];
+ }
} elseif ($ns ==
'http://www.w3.org/2001/XMLSchema') {
$this->xdebug("in getTypeDef, element $type
is an XSD type");
$this->elements[$type]['phpType'] =
'scalar';
@@ -1805,7 +1856,7 @@
} elseif(isset($this->attributes[$type])){
$this->xdebug("in getTypeDef, found attribute $type");
return $this->attributes[$type];
- } elseif (ereg('_ContainedType$', $type)) {
+ } elseif (preg_match('/_ContainedType$/', $type)) {
$this->xdebug("in getTypeDef, have an untyped element
$type");
$typeDef['typeClass'] = 'simpleType';
$typeDef['phpType'] = 'scalar';
@@ -1995,7 +2046,7 @@
/**
* Backward compatibility
*/
-class XMLSchema_om extends nusoap_xmlschema_om {
+class XMLSchema extends nusoap_xmlschema {
}
?><?php
@@ -2010,10 +2061,10 @@
* xsd:anyType and user-defined types.
*
* @author Dietrich Ayala <[email protected]>
-* @version $Id: nusoap.php,v 1.114 2007/11/06 15:17:46 snichol Exp $
+* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $
* @access public
*/
-class soapval_om extends nusoap_base_om {
+class soapval extends nusoap_base {
/**
* The XML element name
*
@@ -2068,8 +2119,8 @@
* @param mixed $attributes associative array of attributes to add to
element serialization
* @access public
*/
- function
soapval_om($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false)
{
- parent::nusoap_base_om();
+ function
soapval($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false)
{
+ parent::nusoap_base();
$this->name = $name;
$this->type = $type;
$this->value = $value;
@@ -2112,10 +2163,10 @@
*
* @author Dietrich Ayala <[email protected]>
* @author Scott Nichol <[email protected]>
-* @version $Id: nusoap.php,v 1.114 2007/11/06 15:17:46 snichol Exp $
+* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $
* @access public
*/
-class soap_transport_http_om extends nusoap_base_om {
+class soap_transport_http extends nusoap_base {
var $url = '';
var $uri = '';
@@ -2160,8 +2211,8 @@
* @param boolean $use_curl Whether to try to force cURL use
* @access public
*/
- function soap_transport_http_om($url, $curl_options = NULL, $use_curl =
false){
- parent::nusoap_base_om();
+ function soap_transport_http($url, $curl_options = NULL, $use_curl =
false){
+ parent::nusoap_base();
$this->debug("ctor url=$url use_curl=$use_curl curl_options:");
$this->appendDebug($this->varDump($curl_options));
$this->setURL($url);
@@ -2169,7 +2220,7 @@
$this->ch_options = $curl_options;
}
$this->use_curl = $use_curl;
- ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
+ preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
$this->setHeader('User-Agent', $this->title.'/'.$this->version.'
('.$rev[1].')');
}
@@ -2345,7 +2396,7 @@
} else if ($this->io_method() == 'curl') {
if (!extension_loaded('curl')) {
// $this->setError('cURL Extension, or OpenSSL extension w/ PHP version
= 4.3 is required for HTTPS');
- $this->setError('The PHP cURL Extension is required for HTTPS or NLTM.
You will need to re-build or update your PHP to included cURL.');
+ $this->setError('The PHP cURL Extension is required for HTTPS or NLTM.
You will need to re-build or update your PHP to include cURL or change
php.ini to load the PHP cURL extension.');
return false;
}
// Avoid warnings when PHP does not have these options
@@ -2660,8 +2711,8 @@
$this->setHeader('Connection', 'close');
$this->persistentConnection = false;
}
- set_magic_quotes_runtime(0);
- // deprecated
+ // deprecated as of PHP 5.3.0
+ //set_magic_quotes_runtime(0);
$this->encoding = $enc;
}
}
@@ -2794,7 +2845,9 @@
// debugging guides.
// add content-length header
- $this->setHeader('Content-Length', strlen($data));
+ if ($this->request_method != 'GET') {
+ $this->setHeader('Content-Length', strlen($data));
+ }
// start building outgoing payload:
if ($this->proxy) {
@@ -2932,7 +2985,7 @@
}
}
// remove 100 headers
- if (isset($lb) && ereg('^HTTP/1.1 100',$data)) {
+ if (isset($lb) && preg_match('/^HTTP\/1.1 100/',$data))
{
unset($lb);
$data = '';
}//
@@ -3076,9 +3129,9 @@
curl_close($this->ch);
return false;
} else {
- ////echo '<pre>';
+ //echo '<pre>';
//var_dump(curl_getinfo($this->ch));
- ////echo '</pre>';
+ //echo '</pre>';
}
// close curl
$this->debug('No cURL error, closing cURL');
@@ -3098,7 +3151,7 @@
if ($data == '') {
// have nothing left; just remove 100 header(s)
$data = $savedata;
- while (ereg('^HTTP/1.1 100',$data)) {
+ while (preg_match('/^HTTP\/1.1 100/',$data)) {
if ($pos = strpos($data,"\r\n\r\n")) {
$data = ltrim(substr($data,$pos));
} elseif($pos = strpos($data,"\n\n") ) {
@@ -3302,7 +3355,7 @@
*/
function parseCookie($cookie_str) {
$cookie_str = str_replace('; ', ';', $cookie_str) . ';';
- $data = split(';', $cookie_str);
+ $data = preg_split('/;/', $cookie_str);
$value_str = $data[0];
$cookie_param = 'domain=';
@@ -3415,10 +3468,10 @@
*
* @author Dietrich Ayala <[email protected]>
* @author Scott Nichol <[email protected]>
-* @version $Id: nusoap.php,v 1.114 2007/11/06 15:17:46 snichol Exp $
+* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $
* @access public
*/
-class nusoap_server_om extends nusoap_base_om {
+class nusoap_server extends nusoap_base {
/**
* HTTP headers of request
* @var array
@@ -3575,8 +3628,8 @@
* @param mixed $wsdl file path or URL (string), or wsdl instance
(object)
* @access public
*/
- function nusoap_server_om($wsdl=false){
- parent::nusoap_base_om();
+ function nusoap_server($wsdl=false){
+ parent::nusoap_base();
// turn on debugging?
global $debug;
global $HTTP_SERVER_VARS;
@@ -3641,6 +3694,14 @@
function service($data){
global $HTTP_SERVER_VARS;
+ if (isset($_SERVER['REQUEST_METHOD'])) {
+ $rm = $_SERVER['REQUEST_METHOD'];
+ } elseif (isset($HTTP_SERVER_VARS['REQUEST_METHOD'])) {
+ $rm = $HTTP_SERVER_VARS['REQUEST_METHOD'];
+ } else {
+ $rm = '';
+ }
+
if (isset($_SERVER['QUERY_STRING'])) {
$qs = $_SERVER['QUERY_STRING'];
} elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
@@ -3648,19 +3709,38 @@
} else {
$qs = '';
}
- $this->debug("In service, query string=$qs");
-
- if (ereg('wsdl', $qs) ){
+ $this->debug("In service, request method=$rm query string=$qs
strlen(\$data)=" . strlen($data));
+
+ if ($rm == 'POST') {
+ $this->debug("In service, invoke the request");
+ $this->parse_request($data);
+ if (! $this->fault) {
+ $this->invoke_method();
+ }
+ if (! $this->fault) {
+ $this->serialize_return();
+ }
+ $this->send_response();
+ } elseif (preg_match('/wsdl/', $qs) ){
$this->debug("In service, this is a request for WSDL");
- if($this->externalWSDLURL){
- if (strpos($this->externalWSDLURL,"://")!==false) { //
assume URL
+ if ($this->externalWSDLURL){
+ if (strpos($this->externalWSDLURL, "http://") !== false) {
// assume URL
+ $this->debug("In service, re-direct for WSDL");
header('Location: '.$this->externalWSDLURL);
} else { // assume file
+ $this->debug("In service, use file passthru for
WSDL");
header("Content-Type: text/xml\r\n");
+ $pos = strpos($this->externalWSDLURL,
"file://");
+ if ($pos === false) {
+ $filename = $this->externalWSDLURL;
+ } else {
+ $filename =
substr($this->externalWSDLURL, $pos + 7);
+ }
$fp = fopen($this->externalWSDLURL, 'r');
fpassthru($fp);
}
} elseif ($this->wsdl) {
+ $this->debug("In service, serialize WSDL");
header("Content-Type: text/xml;
charset=ISO-8859-1\r\n");
print $this->wsdl->serialize($this->debug_flag);
if ($this->debug_flag) {
@@ -3669,22 +3749,17 @@
print $this->getDebugAsXMLComment();
}
} else {
+ $this->debug("In service, there is no WSDL");
header("Content-Type: text/html;
charset=ISO-8859-1\r\n");
print "This service does not provide WSDL";
}
- } elseif ($data == '' && $this->wsdl) {
- $this->debug("In service, there is no data, so return Web
description");
+ } elseif ($this->wsdl) {
+ $this->debug("In service, return Web description");
print $this->wsdl->webDescription();
} else {
- $this->debug("In service, invoke the request");
- $this->parse_request($data);
- if (! $this->fault) {
- $this->invoke_method();
- }
- if (! $this->fault) {
- $this->serialize_return();
- }
- $this->send_response();
+ $this->debug("In service, no Web description");
+ header("Content-Type: text/html;
charset=ISO-8859-1\r\n");
+ print "This service does not provide a Web description";
}
}
@@ -3721,7 +3796,7 @@
// get the character encoding of the incoming request
if(isset($this->headers['content-type']) &&
strpos($this->headers['content-type'],'=')){
$enc =
str_replace('"','',substr(strstr($this->headers["content-type"],'='),1));
- if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
+
if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
$this->xml_encoding = strtoupper($enc);
} else {
$this->xml_encoding = 'US-ASCII';
@@ -3750,7 +3825,7 @@
$enc = substr(strstr($v, '='),
1);
$enc = str_replace('"', '',
$enc);
$enc = str_replace('\\', '',
$enc);
- if
(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
+ if
(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) {
$this->xml_encoding =
strtoupper($enc);
} else {
$this->xml_encoding =
'US-ASCII';
@@ -3784,7 +3859,7 @@
$enc = substr(strstr($v, '='),
1);
$enc = str_replace('"', '',
$enc);
$enc = str_replace('\\', '',
$enc);
- if
(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
+ if
(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) {
$this->xml_encoding =
strtoupper($enc);
} else {
$this->xml_encoding =
'US-ASCII';
@@ -3876,6 +3951,17 @@
function invoke_method() {
$this->debug('in invoke_method, methodname=' . $this->methodname . '
methodURI=' . $this->methodURI . ' SOAPAction=' . $this->SOAPAction);
+ //
+ // if you are debugging in this area of the code, your service uses a
class to implement methods,
+ // you use SOAP RPC, and the client is .NET, please be aware of the
following...
+ // when the .NET wsdl.exe utility generates a proxy, it will remove
the '.' or '..' from the
+ // method name. that is fine for naming the .NET methods. it is not
fine for properly constructing
+ // the XML request and reading the XML response. you need to add the
RequestElementName and
+ // ResponseElementName to the
System.Web.Services.Protocols.SoapRpcMethodAttribute that wsdl.exe
+ // generates for the method. these parameters are used to specify the
correct XML element names
+ // for .NET to use, i.e. the names with the '.' in them.
+ //
+ $orig_methodname = $this->methodname;
if ($this->wsdl) {
if ($this->opData =
$this->wsdl->getOperationData($this->methodname)) {
$this->debug('in invoke_method, found WSDL operation=' .
$this->methodname);
@@ -3897,8 +3983,6 @@
// if a . is present in $this->methodname, we see if there is a class in
scope,
// which could be referred to. We will also distinguish between two
deliminators,
// to allow methods to be called a the class or an instance
- $class = '';
- $method = '';
if (strpos($this->methodname, '..') > 0) {
$delim = '..';
} else if (strpos($this->methodname, '.') > 0) {
@@ -3906,13 +3990,23 @@
} else {
$delim = '';
}
-
- if (strlen($delim) > 0 && substr_count($this->methodname, $delim) == 1
&&
- class_exists(substr($this->methodname, 0, strpos($this->methodname,
$delim)))) {
- // get the class and method name
- $class = substr($this->methodname, 0, strpos($this->methodname,
$delim));
- $method = substr($this->methodname, strpos($this->methodname, $delim) +
strlen($delim));
- $this->debug("in invoke_method, class=$class method=$method
delim=$delim");
+ $this->debug("in invoke_method, delim=$delim");
+
+ $class = '';
+ $method = '';
+ if (strlen($delim) > 0 && substr_count($this->methodname,
$delim) == 1) {
+ $try_class = substr($this->methodname, 0, strpos($this->methodname,
$delim));
+ if (class_exists($try_class)) {
+ // get the class and method name
+ $class = $try_class;
+ $method = substr($this->methodname, strpos($this->methodname, $delim)
+ strlen($delim));
+ $this->debug("in invoke_method, class=$class method=$method
delim=$delim");
+ } else {
+ $this->debug("in invoke_method, class=$try_class not
found");
+ }
+ } else {
+ $try_class = '';
+ $this->debug("in invoke_method, no class to try");
}
// does method exist?
@@ -3920,7 +4014,7 @@
if (!function_exists($this->methodname)) {
$this->debug("in invoke_method, function '$this->methodname' not
found!");
$this->result = 'fault: method not found';
- $this->fault('SOAP-ENV:Client',"method '$this->methodname' not defined
in service");
+
$this->fault('SOAP-ENV:Client',"method '$this->methodname'('$orig_methodname')
not defined in service('$try_class' '$delim')");
return;
}
} else {
@@ -3928,7 +4022,7 @@
if (!in_array($method_to_compare,
get_class_methods($class))) {
$this->debug("in invoke_method, method '$this->methodname' not found
in class '$class'!");
$this->result = 'fault: method not found';
- $this->fault('SOAP-ENV:Client',"method '$this->methodname' not defined
in service");
+
$this->fault('SOAP-ENV:Client',"method '$this->methodname'/'$method_to_compare'('$orig_methodname')
not defined in service/'$class'('$try_class' '$delim')");
return;
}
}
@@ -4014,7 +4108,7 @@
function serialize_return() {
$this->debug('Entering serialize_return methodname: ' .
$this->methodname . ' methodURI: ' . $this->methodURI);
// if fault
- if (isset($this->methodreturn) && ((get_class($this->methodreturn)
== 'soap_fault_om') || (get_class($this->methodreturn)
== 'nusoap_fault_om'))) {
+ if (isset($this->methodreturn) && is_object($this->methodreturn) &&
((get_class($this->methodreturn) == 'soap_fault') ||
(get_class($this->methodreturn) == 'nusoap_fault'))) {
$this->debug('got a fault object from method');
$this->fault = $this->methodreturn;
return;
@@ -4063,9 +4157,17 @@
$this->debug('style is rpc for serialization: use is ' .
$this->opData['output']['use']);
if ($this->opData['output']['use'] ==
'literal') {
// http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html
R2735 says rpc/literal accessor elements should not be in a namespace
- $payload = '<ns1:'.$this->methodname.'Response
xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</ns1:'.$this->methodname."Response>";
+ if ($this->methodURI) {
+ $payload = '<ns1:'.$this->methodname.'Response
xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</ns1:'.$this->methodname."Response>";
+ } else {
+ $payload
= '<'.$this->methodname.'Response>'.$return_val.'</'.$this->methodname.'Response>';
+ }
} else {
- $payload = '<ns1:'.$this->methodname.'Response
xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</ns1:'.$this->methodname."Response>";
+ if ($this->methodURI) {
+ $payload = '<ns1:'.$this->methodname.'Response
xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</ns1:'.$this->methodname."Response>";
+ } else {
+ $payload
= '<'.$this->methodname.'Response>'.$return_val.'</'.$this->methodname.'Response>';
+ }
}
} else {
$this->debug('style is not rpc for
serialization: assume document');
@@ -4080,8 +4182,8 @@
//if($this->debug_flag){
$this->appendDebug($this->wsdl->getDebug());
// }
- if (isset($opData['output']['encodingStyle'])) {
- $encodingStyle =
$opData['output']['encodingStyle'];
+ if (isset($this->opData['output']['encodingStyle'])) {
+ $encodingStyle =
$this->opData['output']['encodingStyle'];
} else {
$encodingStyle = '';
}
@@ -4122,7 +4224,7 @@
$payload .= $this->getDebugAsXMLComment();
}
$this->outgoing_headers[] = "Server: $this->title Server
v$this->version";
- ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
+ preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
$this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version
(".$rev[1].")";
// Let the Web server decide about this
//$this->outgoing_headers[] = "Connection: Close\r\n";
@@ -4202,7 +4304,12 @@
* @access private
*/
function parseRequest($headers, $data) {
- $this->debug('Entering parseRequest() for data of length ' .
strlen($data) . ' and type ' . $headers['content-type']);
+ $this->debug('Entering parseRequest() for data of length ' .
strlen($data) . ' headers:');
+ $this->appendDebug($this->varDump($headers));
+ if (!isset($headers['content-type'])) {
+ $this->setError('Request not of type text/xml (no content-type
header)');
+ return false;
+ }
if (!strstr($headers['content-type'], 'text/xml')) {
$this->setError('Request not of type text/xml');
return false;
@@ -4210,7 +4317,7 @@
if (strpos($headers['content-type'], '=')) {
$enc = str_replace('"', '',
substr(strstr($headers["content-type"], '='), 1));
$this->debug('Got response encoding: ' . $enc);
- if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
+ if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
$this->xml_encoding = strtoupper($enc);
} else {
$this->xml_encoding = 'US-ASCII';
@@ -4350,7 +4457,7 @@
if(false == $use) {
$use = "encoded";
}
- if ($use == 'encoded' && $encodingStyle = '') {
+ if ($use == 'encoded' && $encodingStyle == '') {
$encodingStyle =
'http://schemas.xmlsoap.org/soap/encoding/';
}
@@ -4381,7 +4488,7 @@
if ($faultdetail == '' && $this->debug_flag) {
$faultdetail = $this->getDebug();
}
- $this->fault = new
nusoap_fault_om($faultcode,$faultactor,$faultstring,$faultdetail);
+ $this->fault = new
nusoap_fault($faultcode,$faultactor,$faultstring,$faultdetail);
$this->fault->soap_defencoding = $this->soap_defencoding;
}
@@ -4440,7 +4547,7 @@
$schemaTargetNamespace = $namespace;
}
- $this->wsdl = new wsdl_om;
+ $this->wsdl = new wsdl;
$this->wsdl->serviceName = $serviceName;
$this->wsdl->endpoint = $endpoint;
$this->wsdl->namespaces['tns'] = $namespace;
@@ -4449,7 +4556,7 @@
if ($schemaTargetNamespace != $namespace) {
$this->wsdl->namespaces['types'] =
$schemaTargetNamespace;
}
- $this->wsdl->schemas[$schemaTargetNamespace][0] = new
nusoap_xmlschema_om('', '', $this->wsdl->namespaces);
+ $this->wsdl->schemas[$schemaTargetNamespace][0] = new
nusoap_xmlschema('', '', $this->wsdl->namespaces);
if ($style == 'document') {
$this->wsdl->schemas[$schemaTargetNamespace][0]->schemaInfo['elementFormDefault']
= 'qualified';
}
@@ -4471,7 +4578,7 @@
/**
* Backward compatibility
*/
-class soap_server_om extends nusoap_server_om {
+class soap_server extends nusoap_server {
}
?><?php
@@ -4484,10 +4591,10 @@
*
* @author Dietrich Ayala <[email protected]>
* @author Scott Nichol <[email protected]>
-* @version $Id: nusoap.php,v 1.114 2007/11/06 15:17:46 snichol Exp $
+* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $
* @access public
*/
-class wsdl_om extends nusoap_base_om {
+class wsdl extends nusoap_base {
// URL or filename of the root of this WSDL
var $wsdl;
// define internal arrays of bindings, ports, operations, messages,
etc.
@@ -4544,8 +4651,8 @@
* @param boolean $use_curl try to use cURL
* @access public
*/
- function wsdl_om($wsdl
= '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){
- parent::nusoap_base_om();
+ function wsdl($wsdl
= '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){
+ parent::nusoap_base();
$this->debug("ctor wsdl=$wsdl timeout=$timeout
response_timeout=$response_timeout");
$this->proxyhost = $proxyhost;
$this->proxyport = $proxyport;
@@ -4682,7 +4789,7 @@
if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme']
== 'http' || $wsdl_props['scheme'] == 'https')) {
$this->debug('getting WSDL http(s) URL ' . $wsdl);
// get wsdl
- $tr = new soap_transport_http_om($wsdl, $this->curl_options,
$this->use_curl);
+ $tr = new soap_transport_http($wsdl, $this->curl_options,
$this->use_curl);
$tr->request_method = 'GET';
$tr->useSOAPAction = false;
if($this->proxyhost && $this->proxyport){
@@ -4698,7 +4805,7 @@
$this->appendDebug($tr->getDebug());
// catch errors
if($err = $tr->getError() ){
- $errstr = 'HTTP ERROR: '.$err;
+ $errstr = 'Getting ' . $wsdl . ' - HTTP ERROR:
'.$err;
$this->debug($errstr);
$this->setError($errstr);
unset($tr);
@@ -4777,11 +4884,11 @@
$this->currentSchema->schemaStartElement($parser, $name,
$attrs);
$this->appendDebug($this->currentSchema->getDebug());
$this->currentSchema->clearDebug();
- } elseif (ereg('schema$', $name)) {
+ } elseif (preg_match('/schema$/', $name)) {
$this->debug('Parsing WSDL schema');
// $this->debug("startElement for $name ($attrs[name]). status
= $this->status (".$this->getLocalPart($name).")");
***The diff for this file has been truncated for email.***
=======================================
--- /trunk/plugins/moodle_plugin/openmeetings_gateway.php Sun Feb 7
04:20:57 2010
+++ /trunk/plugins/moodle_plugin/openmeetings_gateway.php Sat Jan 8
07:43:22 2011
@@ -39,7 +39,7 @@
//echo "DIRROOT: ".$CFG->dirroot."<br/>";
- $client_userService = new
nusoap_client_om("http://".$CFG->openmeetings_red5host.":".$CFG->openmeetings_red5port."/openmeetings/services/UserService?wsdl", "wsdl");
+ $client_userService = new
nusoap_client("http://".$CFG->openmeetings_red5host.":".$CFG->openmeetings_red5port."/openmeetings/services/UserService?wsdl", "wsdl");
$client_userService->setUseCurl(true);
//echo "Client inited"."<br/>";
$err = $client_userService->getError();
@@ -110,7 +110,7 @@
//echo $client_userService."<br/>";
- $client_roomService = new
nusoap_client_om("http://".$CFG->openmeetings_red5host.":".$CFG->openmeetings_red5port."/openmeetings/services/RoomService?wsdl",
true);
+ $client_roomService = new
nusoap_client("http://".$CFG->openmeetings_red5host.":".$CFG->openmeetings_red5port."/openmeetings/services/RoomService?wsdl",
true);
$err = $client_roomService->getError();
if ($err) {
@@ -169,7 +169,7 @@
//echo $client_userService."<br/>";
- $client_roomService = new
nusoap_client_om("http://".$CFG->openmeetings_red5host.":".$CFG->openmeetings_red5port."/openmeetings/services/RoomService?wsdl",
true);
+ $client_roomService = new
nusoap_client("http://".$CFG->openmeetings_red5host.":".$CFG->openmeetings_red5port."/openmeetings/services/RoomService?wsdl",
true);
$err = $client_roomService->getError();
if ($err) {
@@ -223,7 +223,7 @@
//echo $client_userService."<br/>";
- $client_roomService = new
nusoap_client_om("http://".$CFG->openmeetings_red5host.":".$CFG->openmeetings_red5port."/openmeetings/services/RoomService?wsdl",
true);
+ $client_roomService = new
nusoap_client("http://".$CFG->openmeetings_red5host.":".$CFG->openmeetings_red5port."/openmeetings/services/RoomService?wsdl",
true);
$err = $client_roomService->getError();
if ($err) {
@@ -269,7 +269,7 @@
function openmeetings_getRecordingsByExternalRooms(){
global $USER, $CFG;
- $client_roomService = new
nusoap_client_om("http://".$CFG->openmeetings_red5host.":".$CFG->openmeetings_red5port."/openmeetings/services/RoomService?wsdl",
true);
+ $client_roomService = new
nusoap_client("http://".$CFG->openmeetings_red5host.":".$CFG->openmeetings_red5port."/openmeetings/services/RoomService?wsdl",
true);
$err = $client_roomService->getError();
if ($err) {
@@ -307,7 +307,7 @@
function openmeetings_setUserObject($username, $firstname, $lastname,
$profilePictureUrl, $email) {
global $USER, $CFG;
- $client_userService = new
nusoap_client_om("http://".$CFG->openmeetings_red5host.":".$CFG->openmeetings_red5port."/openmeetings/services/UserService?wsdl",
true);
+ $client_userService = new
nusoap_client("http://".$CFG->openmeetings_red5host.":".$CFG->openmeetings_red5port."/openmeetings/services/UserService?wsdl",
true);
$err = $client_userService->getError();
if ($err) {
@@ -352,7 +352,7 @@
function openmeetings_setUserObjectWithExternalUser($username,
$firstname, $lastname,
$profilePictureUrl, $email, $userId, $systemType) {
global $USER, $CFG;
- $client_userService = new
nusoap_client_om("http://".$CFG->openmeetings_red5host.":".$CFG->openmeetings_red5port."/openmeetings/services/UserService?wsdl",
true);
+ $client_userService = new
nusoap_client("http://".$CFG->openmeetings_red5host.":".$CFG->openmeetings_red5port."/openmeetings/services/UserService?wsdl",
true);
$err = $client_userService->getError();
if ($err) {
@@ -408,7 +408,7 @@
function openmeetings_setUserObjectAndGenerateRoomHashByURL($username,
$firstname, $lastname,
$profilePictureUrl, $email, $userId, $systemType, $room_id,
$becomeModerator) {
global $USER, $CFG;
- $client_userService = new
nusoap_client_om("http://".$CFG->openmeetings_red5host.":".$CFG->openmeetings_red5port."/openmeetings/services/UserService?wsdl",
true);
+ $client_userService = new
nusoap_client("http://".$CFG->openmeetings_red5host.":".$CFG->openmeetings_red5port."/openmeetings/services/UserService?wsdl",
true);
$err = $client_userService->getError();
if ($err) {
@@ -452,7 +452,7 @@
function
openmeetings_setUserObjectAndGenerateRecordingHashByURL($username,
$firstname, $lastname,
$userId, $systemType,
$recording_id) {
global $USER, $CFG;
- $client_userService = new
nusoap_client_om("http://".$CFG->openmeetings_red5host.":".$CFG->openmeetings_red5port."/openmeetings/services/UserService?wsdl",
true);
+ $client_userService = new
nusoap_client("http://".$CFG->openmeetings_red5host.":".$CFG->openmeetings_red5port."/openmeetings/services/UserService?wsdl",
true);
$err = $client_userService->getError();
if ($err) {
--
You received this message because you are subscribed to the Google Groups
"OpenMeetings developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/openmeetings-dev?hl=en.