ILIAS  release_4-4 Revision
ilBMFWSDL Class Reference
+ Inheritance diagram for ilBMFWSDL:
+ Collaboration diagram for ilBMFWSDL:

Public Member Functions

 ilBMFWSDL ($wsdl_uri=false, $proxy=array(), $cacheUse=WSDL_CACHE_USE, $cacheMaxAge=WSDL_CACHE_MAX_AGE, $docs=false)
 ilBMFWSDL constructor. More...
 
 set_service ($service)
 
 parse ($wsdl_uri, $proxy=array())
 
 parseURL ($wsdl_uri, $proxy=array())
 Fills the WSDL array tree with data from a WSDL file. More...
 
 parseObject (&$wsdl_obj, $targetNamespace, $service_name, $service_desc='')
 Fills the WSDL array tree with data from one or more PHP class objects. More...
 
 getEndpoint ($portName)
 
 _getPortName ($operation, $service)
 
 getPortName ($operation, $service=null)
 Finds the name of the first port that contains an operation of name $operation. More...
 
 getOperationData ($portName, $operation)
 
 matchMethod (&$operation)
 
 getDataHandler ($datatype, $namespace)
 Given a datatype, what function handles the processing? More...
 
 getSoapAction ($portName, $operation)
 
 getNamespace ($portName, $operation)
 
 getNamespaceAttributeName ($namespace)
 
 addNamespace ($namespace)
 
 _validateString ($string)
 
 _addArg (&$args, &$argarray, $argname)
 
 _elementArg (&$args, &$argarray, &$_argtype, $_argname)
 
 _complexTypeArg (&$args, &$argarray, &$_argtype, $_argname)
 
 generateProxyCode ($port='', $classname='')
 Generates stub code from the WSDL that can be saved to a file or eval'd into existence. More...
 
 generateAllProxies ()
 
getProxy ($port='', $name='')
 
_getComplexTypeForElement ($name, $namespace)
 
 getComplexTypeNameForElement ($name, $namespace)
 
 getComplexTypeChildType ($ns, $name, $child_ns, $child_name)
 
 getSchemaType ($type, $name, $type_namespace)
 
 _getDeepestArrayType ($nsPrefix, $arrayType)
 Recurse through the WSDL structure looking for the innermost array type of multi-dimensional arrays. More...
 
- Public Member Functions inherited from ilBMFBase
 ilBMFBase ($faultcode='Client')
 Constructor. More...
 
 _resetNamespaces ()
 
 _setSchemaVersion ($schemaVersion)
 Sets the schema version used in the SOAP message. More...
 
 _getNamespacePrefix ($ns)
 
 _getNamespaceForPrefix ($prefix)
 
 _isSoapValue (&$value)
 
 _serializeValue (&$value, $name='', $type=false, $elNamespace=NULL, $typeNamespace=NULL, $options=array(), $attributes=array(), $artype='', $OBJTypeNS=array())
 
 _getType (&$value)
 Converts a PHP type to a SOAP type. More...
 
 _multiArrayType (&$value, &$type, &$size, &$xml)
 
 _isBase64 (&$value)
 Returns whether a string is base64 encoded data. More...
 
 _isBase64Type ($type)
 Returns whether a type is a base64 type. More...
 
 _isHash (&$a)
 Returns whether an array is a hash. More...
 
 _un_htmlentities ($string)
 
_decode (&$soapval)
 
 _makeEnvelope (&$method, &$headers, $encoding=SOAP_DEFAULT_ENCODING, $options=array())
 Creates the SOAP envelope with the SOAP envelop data. More...
 
 _makeMimeMessage (&$xml, $encoding=SOAP_DEFAULT_ENCODING)
 
 _makeDIMEMessage ($xml)
 
 _decodeMimeMessage (&$data, &$headers, &$attachments)
 
 _decodeDIMEMessage (&$data, &$headers, &$attachments)
 
 __set_type_translation ($type, $class=null)
 
- Public Member Functions inherited from ilBMFBase_Object
 ilBMFBase_Object ($faultcode='Client')
 Constructor. More...
 
_raiseSoapFault ($str, $detail='', $actorURI='', $code=null, $mode=null, $options=null, $skipmsg=false)
 Raises a SOAP error. More...
 
 __isfault ()
 
__getfault ()
 
 _debug ($string)
 Adds a string to the debug data. More...
 
- Public Member Functions inherited from PEAR
 PEAR ($error_class=null)
 Constructor. More...
 
 _PEAR ()
 Destructor (the emulated type of...). More...
 
getStaticProperty ($class, $var)
 If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them. More...
 
 registerShutdownFunc ($func, $args=array())
 Use this function to register a shutdown method for static classes. More...
 
 isError ($data, $code=null)
 Tell whether a value is a PEAR error. More...
 
 setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled. More...
 
 expectError ($code=' *')
 This method is used to tell which errors you expect to get. More...
 
 popExpect ()
 This method pops one element off the expected error codes stack. More...
 
 _checkDelExpect ($error_code)
 This method checks unsets an error code if available. More...
 
 delExpect ($error_code)
 This method deletes all occurences of the specified element from the expected error codes stack. More...
 
raiseError ($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
 This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied. More...
 
throwError ($message=null, $code=null, $userinfo=null)
 Simpler form of raiseError with fewer options. More...
 
 staticPushErrorHandling ($mode, $options=null)
 
 staticPopErrorHandling ()
 
 pushErrorHandling ($mode, $options=null)
 Push a new error handler on top of the error handler options stack. More...
 
 popErrorHandling ()
 Pop the last error handler used. More...
 
 loadExtension ($ext)
 OS independant PHP extension load. More...
 

Data Fields

 $tns = null
 
 $definition = array()
 
 $namespaces = array()
 
 $ns = array()
 
 $xsd = SOAP_XML_SCHEMA_VERSION
 
 $complexTypes = array()
 
 $elements = array()
 
 $messages = array()
 
 $portTypes = array()
 
 $bindings = array()
 
 $imports = array()
 
 $services = array()
 
 $service = ''
 
 $uri = ''
 
 $docs = false
 
 $proxy = null
 
 $trace = 0
 
 $cacheUse = null
 
 $cacheMaxAge = null
 
 $wsdlParserClass = 'ilBMFWSDL_Parser'
 
- Data Fields inherited from ilBMFBase
 $_XMLSchema
 
 $_XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'
 
 $_typemap
 
 $_defaultObjectClassname = 'stdClass'
 Default class name to use for decoded response objects. More...
 
 $_namespaces
 
 $_namespace
 
 $_xmlEntities
 
 $_doconversion = false
 
 $__attachments = array()
 
 $_wsdl = null
 
 $_section5 = true
 True if we use section 5 encoding, or false if this is literal. More...
 
 $_auto_translation = false
 
 $_type_translation = array()
 
- Data Fields inherited from ilBMFBase_Object
 $_debug_flag = false
 Store debugging information in $_debug_data? More...
 
 $_debug_data = ''
 String containing debugging information if $_debug_flag is true. More...
 
 $_encodings = array('ISO-8859-1', 'US-ASCII', 'UTF-8')
 Supported encodings, limited by XML extension. More...
 
 $_myfaultcode = ''
 Fault code. More...
 
 $fault = null
 Recent PEAR_Error object. More...
 
- Data Fields inherited from PEAR
 $_debug = false
 
 $_default_error_mode = null
 
 $_default_error_options = null
 
 $_default_error_handler = ''
 
 $_error_class = 'PEAR_Error'
 
 $_expected_errors = array()
 

Detailed Description

Definition at line 49 of file class.ilBMFWSDL.php.

Member Function Documentation

◆ _addArg()

ilBMFWSDL::_addArg ( $args,
$argarray,
  $argname 
)

Definition at line 441 of file class.ilBMFWSDL.php.

References _validateString().

Referenced by _complexTypeArg(), _elementArg(), and generateProxyCode().

442  {
443  if ($args) {
444  $args .= ', ';
445  }
446  $args .= '$' . $argname;
447  if (!$this->_validateString($argname)) {
448  return;
449  }
450  if ($argarray) {
451  $argarray .= ', ';
452  }
453  $argarray .= "'$argname' => $" . $argname;
454  }
_validateString($string)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _complexTypeArg()

ilBMFWSDL::_complexTypeArg ( $args,
$argarray,
$_argtype,
  $_argname 
)

Definition at line 499 of file class.ilBMFWSDL.php.

References _addArg().

Referenced by generateProxyCode().

500  {
501  $comments = '';
502  if (isset($this->complexTypes[$_argtype['namespace']][$_argtype['type']])) {
503  $comments = " // $_argname is a ComplexType {$_argtype['type']},\n" .
504  " // refer to wsdl for more info\n";
505  if (isset($this->complexTypes[$_argtype['namespace']][$_argtype['type']]['attribute'])) {
506  $comments .= " // $_argname may require attributes, refer to wsdl for more info\n";
507  }
508  $wrapname = '{' . $this->namespaces[$_argtype['namespace']].'}' . $_argtype['type'];
509  $comments .= " \$$_argname =& new ilBMFValue('$_argname', '$wrapname', \$$_argname);\n";
510  }
511 
512  $this->_addArg($args, $argarray, $_argname);
513 
514  return $comments;
515  }
_addArg(&$args, &$argarray, $argname)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _elementArg()

ilBMFWSDL::_elementArg ( $args,
$argarray,
$_argtype,
  $_argname 
)

Definition at line 456 of file class.ilBMFWSDL.php.

References _addArg().

Referenced by generateProxyCode().

457  {
458  $comments = '';
459  $el = $this->elements[$_argtype['namespace']][$_argtype['type']];
460  $tns = isset($this->ns[$el['namespace']])
461  ? $this->ns[$el['namespace']]
462  : $_argtype['namespace'];
463 
464  if (!empty($el['complex']) ||
465  (isset($el['type']) &&
466  isset($this->complexTypes[$tns][$el['type']]))) {
467  // The element is a complex type.
468  $comments .= " // {$_argtype['type']} is a ComplexType, refer to the WSDL for more info.\n";
469  $attrname = "{$_argtype['type']}_attr";
470  if (isset($el['type']) &&
471  isset($this->complexTypes[$tns][$el['type']]['attribute'])) {
472  $comments .= " // {$_argtype['type']} may require attributes, refer to the WSDL for more info.\n";
473  }
474  $comments .= " \${$attrname}['xmlns'] = '{$this->namespaces[$_argtype['namespace']]}';\n";
475  $comments .= " \${$_argtype['type']} =& new ilBMFValue('{$_argtype['type']}', false, \${$_argtype['type']}, \$$attrname);\n";
476  $this->_addArg($args, $argarray, $_argtype['type']);
477  if (isset($el['type']) &&
478  isset($this->complexTypes[$tns][$el['type']]['attribute'])) {
479  if ($args) {
480  $args .= ', ';
481  }
482  $args .= '$' . $attrname;
483  }
484  } elseif (isset($el['elements'])) {
485  foreach ($el['elements'] as $ename => $element) {
486  $comments .= " \$$ename =& new ilBMFValue('{{$this->namespaces[$element['namespace']]}}$ename', '" .
487  (isset($element['type']) ? $element['type'] : false) .
488  "', \$$ename);\n";
489  $this->_addArg($args, $argarray, $ename);
490  }
491  } else {
492  $comments .= " \$$_argname =& new ilBMFValue('{{$this->namespaces[$tns]}}$_argname', '{$el['type']}', \$$_argname);\n";
493  $this->_addArg($args, $argarray, $_argname);
494  }
495 
496  return $comments;
497  }
_addArg(&$args, &$argarray, $argname)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getComplexTypeForElement()

& ilBMFWSDL::_getComplexTypeForElement (   $name,
  $namespace 
)

Definition at line 734 of file class.ilBMFWSDL.php.

References $namespace, $ns, and $t.

Referenced by getComplexTypeChildType(), and getComplexTypeNameForElement().

735  {
736  $t = null;
737  if (isset($this->ns[$namespace]) &&
738  isset($this->elements[$this->ns[$namespace]][$name]['type'])) {
739 
740  $type = $this->elements[$this->ns[$namespace]][$name]['type'];
741  $ns = $this->elements[$this->ns[$namespace]][$name]['namespace'];
742 
743  if (isset($this->complexTypes[$ns][$type])) {
744  $t = $this->complexTypes[$ns][$type];
745  }
746  }
747  return $t;
748  }
if($err=$client->getError()) $namespace
+ Here is the caller graph for this function:

◆ _getDeepestArrayType()

ilBMFWSDL::_getDeepestArrayType (   $nsPrefix,
  $arrayType 
)

Recurse through the WSDL structure looking for the innermost array type of multi-dimensional arrays.

Takes a namespace prefix and a type, which can be in the form 'type' or 'type[]', and returns the full namespace URI, the type of the most deeply nested array type found, and the number of levels of nesting.

private

Returns
mixed array or nothing

Definition at line 846 of file class.ilBMFWSDL.php.

References $result.

Referenced by getSchemaType().

847  {
848  static $trail = array();
849 
850  $arrayType = ereg_replace('\[\]$', '', $arrayType);
851 
852  // Protect against circular references XXX We really need to remove
853  // trail from this altogether (it's very inefficient and in the wrong
854  // place!) and put circular reference checking in when the WSDL info
855  // is generated in the first place
856  if (array_search($nsPrefix . ':' . $arrayType, $trail)) {
857  return array(null, null, -count($trail));
858  }
859 
860  if (array_key_exists($nsPrefix, $this->complexTypes) &&
861  array_key_exists($arrayType, $this->complexTypes[$nsPrefix]) &&
862  array_key_exists('arrayType', $this->complexTypes[$nsPrefix][$arrayType])) {
863  $trail[] = $nsPrefix . ':' . $arrayType;
864  $result = $this->_getDeepestArrayType($this->complexTypes[$nsPrefix][$arrayType]['namespace'],
865  $this->complexTypes[$nsPrefix][$arrayType]['arrayType']);
866  return array($result[0], $result[1], $result[2] + 1);
867  }
868  return array($this->namespaces[$nsPrefix], $arrayType, 0);
869  }
$result
_getDeepestArrayType($nsPrefix, $arrayType)
Recurse through the WSDL structure looking for the innermost array type of multi-dimensional arrays...
+ Here is the caller graph for this function:

◆ _getPortName()

ilBMFWSDL::_getPortName (   $operation,
  $service 
)

Definition at line 197 of file class.ilBMFWSDL.php.

References $service.

Referenced by getPortName().

198  {
199  if (isset($this->services[$service]['ports'])) {
200  $ports = $this->services[$service]['ports'];
201  foreach ($ports as $port => $portAttrs) {
202  $type = $ports[$port]['type'];
203  if ($type == 'soap' &&
204  isset($this->bindings[$portAttrs['binding']]['operations'][$operation])) {
205  return $port;
206  }
207  }
208  }
209  return null;
210  }
+ Here is the caller graph for this function:

◆ _validateString()

ilBMFWSDL::_validateString (   $string)

Definition at line 436 of file class.ilBMFWSDL.php.

Referenced by _addArg(), and generateProxyCode().

437  {
438  return preg_match('/^[\w_:#\/]+$/', $string);
439  }
+ Here is the caller graph for this function:

◆ addNamespace()

ilBMFWSDL::addNamespace (   $namespace)

Definition at line 422 of file class.ilBMFWSDL.php.

References $n, and $namespace.

Referenced by getNamespaceAttributeName().

423  {
424  if (!empty($this->ns[$namespace])) {
425  return $this->ns[$namespace];
426  }
427 
428  $n = count($this->ns);
429  $attr = 'ns' . $n;
430  $this->namespaces['ns' . $n] = $namespace;
431  $this->ns[$namespace] = $attr;
432 
433  return $attr;
434  }
if($err=$client->getError()) $namespace
$n
Definition: RandomTest.php:80
+ Here is the caller graph for this function:

◆ generateAllProxies()

ilBMFWSDL::generateAllProxies ( )

Definition at line 689 of file class.ilBMFWSDL.php.

References $service, and generateProxyCode().

690  {
691  $proxycode = '';
692  foreach (array_keys($this->services[$this->service]['ports']) as $key) {
693  $port =& $this->services[$this->service]['ports'][$key];
694  $proxycode .= $this->generateProxyCode($port);
695  }
696  return $proxycode;
697  }
generateProxyCode($port='', $classname='')
Generates stub code from the WSDL that can be saved to a file or eval'd into existence.
+ Here is the call graph for this function:

◆ generateProxyCode()

ilBMFWSDL::generateProxyCode (   $port = '',
  $classname = '' 
)

Generates stub code from the WSDL that can be saved to a file or eval'd into existence.

Definition at line 521 of file class.ilBMFWSDL.php.

References $namespace, $ns, $service, ilBMFBase_Object\__getfault(), ilBMFBase_Object\__isfault(), _addArg(), _complexTypeArg(), _elementArg(), and _validateString().

Referenced by generateAllProxies(), and getProxy().

522  {
523  if ($this->__isfault()) {
524  return $this->__getfault();
525  }
526 
527  $multiport = count($this->services[$this->service]['ports']) > 1;
528  if (!$port) {
529  reset($this->services[$this->service]['ports']);
530  $port = current($this->services[$this->service]['ports']);
531  }
532  // XXX currently do not support HTTP ports
533  if ($port['type'] != 'soap') {
534  return null;
535  }
536 
537  // XXX currentPort is BAD
538  $clienturl = $port['address']['location'];
539  if (!$classname) {
540  if ($multiport || $port) {
541  $classname = 'WebService_' . $this->service . '_' . $port['name'];
542  } else {
543  $classname = 'WebService_' . $this->service;
544  }
545  $classname = preg_replace('/[ .\-\(\)]+/', '_', $classname);
546  }
547 
548  if (!$this->_validateString($classname)) {
549  return null;
550  }
551 
552  if (is_array($this->proxy) && count($this->proxy)) {
553  $class = "class $classname extends ilBMFClient\n{\n" .
554  " function $classname(\$path = '$clienturl')\n {\n" .
555  " \$this->ilBMFClient(\$path, 0, 0,\n" .
556  ' array(';
557 
558  foreach ($this->proxy as $key => $val) {
559  if (is_array($val)) {
560  $class .= "'$key' => array(";
561  foreach ($val as $key2 => $val2) {
562  $class .= "'$key2' => '$val2', ";
563  }
564  $class .= ')';
565  } else {
566  $class .= "'$key' => '$val', ";
567  }
568  }
569  $class .= "));\n }\n";
570  $class = str_replace(', ))', '))', $class);
571  } else {
572  $class = "class $classname extends ilBMFClient\n{\n" .
573  " function $classname(\$path = '$clienturl')\n {\n" .
574  " \$this->ilBMFClient(\$path, 0);\n" .
575  " }\n";
576  }
577 
578  // Get the binding, from that get the port type.
579  $primaryBinding = $port['binding'];
580  $primaryBinding = preg_replace("/^(.*:)/", '', $primaryBinding);
581  $portType = $this->bindings[$primaryBinding]['type'];
582  $portType = preg_replace("/^(.*:)/", '', $portType);
583  $style = $this->bindings[$primaryBinding]['style'];
584 
585  // XXX currentPortType is BAD
586  foreach ($this->portTypes[$portType] as $opname => $operation) {
587  $binding = $this->bindings[$primaryBinding]['operations'][$opname];
588  if (isset($binding['soapAction'])) {
589  $soapaction = $binding['soapAction'];
590  } else {
591  $soapaction = null;
592  }
593  if (isset($binding['style'])) {
594  $opstyle = $binding['style'];
595  } else {
596  $opstyle = $style;
597  }
598  $use = $binding['input']['use'];
599  if ($use == 'encoded') {
600  $namespace = $binding['input']['namespace'];
601  } else {
602  $bindingType = $this->bindings[$primaryBinding]['type'];
603  $ns = $this->portTypes[$bindingType][$opname]['input']['namespace'];
604  $namespace = $this->namespaces[$ns];
605  }
606 
607  $args = '';
608  $argarray = '';
609  $comments = '';
610  $wrappers = '';
611  foreach ($operation['input'] as $argname => $argtype) {
612  if ($argname == 'message') {
613  foreach ($this->messages[$argtype] as $_argname => $_argtype) {
614  if ($opstyle == 'document' && $use == 'literal' &&
615  $_argtype['name'] == 'parameters') {
616  // The type or element refered to is used for
617  // parameters.
618  $elattrs = null;
619  $element = $_argtype['element'];
620  $el = $this->elements[$_argtype['namespace']][$_argtype['type']];
621 
622  if ($el['complex']) {
623  $namespace = $this->namespaces[$_argtype['namespace']];
624  // XXX need to wrap the parameters in a
625  // ilBMFValue.
626  }
627  if (isset($el['elements'])) {
628  foreach ($el['elements'] as $elname => $elattrs) {
629  // Is the element a complex type?
630  if (isset($this->complexTypes[$elattrs['namespace']][$elname])) {
631  $comments .= $this->_complexTypeArg($args, $argarray, $_argtype, $_argname);
632  } else {
633  $this->_addArg($args, $argarray, $elname);
634  }
635  }
636  }
637  if ($el['complex'] && $argarray) {
638  $wrapname = '{' . $this->namespaces[$_argtype['namespace']].'}' . $el['name'];
639  $comments .= " \${$el['name']} =& new ilBMFValue('$wrapname', false, \$v = array($argarray));\n";
640  $argarray = "'{$el['name']}' => \${$el['name']}";
641  }
642  } else {
643  if (isset($_argtype['element'])) {
644  // Element argument.
645  $comments .= $this->_elementArg($args, $argarray, $_argtype, $_argtype['type']);
646  } else {
647  // Complex type argument.
648  $comments .= $this->_complexTypeArg($args, $argarray, $_argtype, $_argname);
649  }
650  }
651  }
652  }
653  }
654 
655  // Validate entries.
656 
657  // Operation names are function names, so try to make sure it's
658  // legal. This could potentially cause collisions, but let's try
659  // to make everything callable and see how many problems that
660  // causes.
661  $opname_php = preg_replace('/[ .\-\(\)]+/', '_', $opname);
662  if (!$this->_validateString($opname_php)) {
663  return null;
664  }
665 
666  if ($argarray) {
667  $argarray = "array($argarray)";
668  } else {
669  $argarray = 'null';
670  }
671 
672  $class .= " function &$opname_php($args)\n {\n$comments$wrappers" .
673  " \$result = \$this->call('$opname',\n" .
674  " \$v = $argarray,\n" .
675  " array('namespace' => '$namespace',\n" .
676  " 'soapaction' => '$soapaction',\n" .
677  " 'style' => '$opstyle',\n" .
678  " 'use' => '$use'" .
679  ($this->trace?",\n 'trace' => 1" : '') . "));\n" .
680  " return \$result;\n" .
681  " }\n";
682  }
683 
684  $class .= "}\n";
685 
686  return $class;
687  }
_complexTypeArg(&$args, &$argarray, &$_argtype, $_argname)
if($err=$client->getError()) $namespace
_elementArg(&$args, &$argarray, &$_argtype, $_argname)
_validateString($string)
_addArg(&$args, &$argarray, $argname)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getComplexTypeChildType()

ilBMFWSDL::getComplexTypeChildType (   $ns,
  $name,
  $child_ns,
  $child_name 
)

Definition at line 759 of file class.ilBMFWSDL.php.

References $t, and _getComplexTypeForElement().

760  {
761  // is the type an element?
762  $t = $this->_getComplexTypeForElement($name, $ns);
763  if ($t) {
764  // no, get it from complex types directly
765  if (isset($t['elements'][$child_name]['type']))
766  return $t['elements'][$child_name]['type'];
767  }
768  return null;
769  }
& _getComplexTypeForElement($name, $namespace)
+ Here is the call graph for this function:

◆ getComplexTypeNameForElement()

ilBMFWSDL::getComplexTypeNameForElement (   $name,
  $namespace 
)

Definition at line 750 of file class.ilBMFWSDL.php.

References $namespace, $t, and _getComplexTypeForElement().

751  {
752  $t = $this->_getComplexTypeForElement($name, $namespace);
753  if ($t) {
754  return $t['name'];
755  }
756  return null;
757  }
if($err=$client->getError()) $namespace
& _getComplexTypeForElement($name, $namespace)
+ Here is the call graph for this function:

◆ getDataHandler()

ilBMFWSDL::getDataHandler (   $datatype,
  $namespace 
)

Given a datatype, what function handles the processing?

This is used for doc/literal requests where we receive a datatype, and we need to pass it to a method in out server class.

Parameters
string$datatype
string$namespace
Returns
string public

Definition at line 342 of file class.ilBMFWSDL.php.

References $namespace.

343  {
344  // See if we have an element by this name.
345  if (isset($this->namespaces[$namespace])) {
346  $namespace = $this->namespaces[$namespace];
347  }
348 
349  if (isset($this->ns[$namespace])) {
350  $nsp = $this->ns[$namespace];
351  //if (!isset($this->elements[$nsp]))
352  // $nsp = $this->namespaces[$nsp];
353  if (isset($this->elements[$nsp][$datatype])) {
354  $checkmessages = array();
355  // Find what messages use this datatype.
356  foreach ($this->messages as $messagename => $message) {
357  foreach ($message as $partname => $part) {
358  if ($part['type'] == $datatype) {
359  $checkmessages[] = $messagename;
360  break;
361  }
362  }
363  }
364  // Find the operation that uses this message.
365  $dataHandler = null;
366  foreach($this->portTypes as $portname => $porttype) {
367  foreach ($porttype as $opname => $opinfo) {
368  foreach ($checkmessages as $messagename) {
369  if ($opinfo['input']['message'] == $messagename) {
370  return $opname;
371  }
372  }
373  }
374  }
375  }
376  }
377 
378  return null;
379  }
if($err=$client->getError()) $namespace

◆ getEndpoint()

ilBMFWSDL::getEndpoint (   $portName)

Definition at line 186 of file class.ilBMFWSDL.php.

References $service, ilBMFBase_Object\__getfault(), ilBMFBase_Object\__isfault(), and ilBMFBase_Object\_raiseSoapFault().

187  {
188  if ($this->__isfault()) {
189  return $this->__getfault();
190  }
191 
192  return (isset($this->services[$this->service]['ports'][$portName]['address']['location']))
193  ? $this->services[$this->service]['ports'][$portName]['address']['location']
194  : $this->_raiseSoapFault("No endpoint for port for $portName", $this->uri);
195  }
& _raiseSoapFault($str, $detail='', $actorURI='', $code=null, $mode=null, $options=null, $skipmsg=false)
Raises a SOAP error.
+ Here is the call graph for this function:

◆ getNamespace()

ilBMFWSDL::getNamespace (   $portName,
  $operation 
)

Definition at line 394 of file class.ilBMFWSDL.php.

References $service, ilBMFBase_Object\__getfault(), and ilBMFBase_Object\__isfault().

395  {
396  if ($this->__isfault()) {
397  return $this->__getfault();
398  }
399 
400  if (!empty($this->bindings[$this->services[$this->service]['ports'][$portName]['binding']]['operations'][$operation]['input']['namespace'])) {
401  return $this->bindings[$this->services[$this->service]['ports'][$portName]['binding']]['operations'][$operation]['input']['namespace'];
402  }
403 
404  return false;
405  }
+ Here is the call graph for this function:

◆ getNamespaceAttributeName()

ilBMFWSDL::getNamespaceAttributeName (   $namespace)

Definition at line 407 of file class.ilBMFWSDL.php.

References $namespace, and addNamespace().

408  {
409  /* If it doesn't exist at first, flip the array and check again. */
410  if (empty($this->ns[$namespace])) {
411  $this->ns = array_flip($this->namespaces);
412  }
413 
414  /* If it doesn't exist now, add it. */
415  if (empty($this->ns[$namespace])) {
416  return $this->addNamespace($namespace);
417  }
418 
419  return $this->ns[$namespace];
420  }
if($err=$client->getError()) $namespace
addNamespace($namespace)
+ Here is the call graph for this function:

◆ getOperationData()

ilBMFWSDL::getOperationData (   $portName,
  $operation 
)

Definition at line 242 of file class.ilBMFWSDL.php.

References ilBMFBase_Object\__getfault(), ilBMFBase_Object\__isfault(), and ilBMFBase_Object\_raiseSoapFault().

243  {
244  if ($this->__isfault()) {
245  return $this->__getfault();
246  }
247 
248  if (!isset($this->services[$this->service]['ports'][$portName]['binding']) ||
249  !($binding = $this->services[$this->service]['ports'][$portName]['binding'])) {
250  return $this->_raiseSoapFault("No binding for port $portName in WSDL.", $this->uri);
251  }
252 
253  // Get operation data from binding.
254  if (is_array($this->bindings[$binding]['operations'][$operation])) {
255  $opData = $this->bindings[$binding]['operations'][$operation];
256  }
257  // get operation data from porttype
258  $portType = $this->bindings[$binding]['type'];
259  if (!$portType) {
260  return $this->_raiseSoapFault("No port type for binding $binding in WSDL.", $this->uri);
261  }
262  if (is_array($type = $this->portTypes[$portType][$operation])) {
263  if (isset($type['parameterOrder'])) {
264  $opData['parameterOrder'] = $type['parameterOrder'];
265  }
266  $opData['input'] = array_merge($opData['input'], $type['input']);
267  $opData['output'] = array_merge($opData['output'], $type['output']);
268  }
269  if (!$opData)
270  return $this->_raiseSoapFault("No operation $operation for port $portName in WSDL.", $this->uri);
271  $opData['parameters'] = false;
272  if (isset($this->bindings[$binding]['operations'][$operation]['input']['namespace']))
273  $opData['namespace'] = $this->bindings[$binding]['operations'][$operation]['input']['namespace'];
274  // Message data from messages.
275  $inputMsg = $opData['input']['message'];
276  if (is_array($this->messages[$inputMsg])) {
277  foreach ($this->messages[$inputMsg] as $pname => $pattrs) {
278  if ($opData['style'] == 'document' &&
279  $opData['input']['use'] == 'literal' &&
280  $pname == 'parameters') {
281  $opData['parameters'] = true;
282  $opData['namespace'] = $this->namespaces[$pattrs['namespace']];
283  $el = $this->elements[$pattrs['namespace']][$pattrs['type']];
284  if (isset($el['elements'])) {
285  foreach ($el['elements'] as $elname => $elattrs) {
286  $opData['input']['parts'][$elname] = $elattrs;
287  }
288  }
289  } else {
290  $opData['input']['parts'][$pname] = $pattrs;
291  }
292  }
293  }
294  $outputMsg = $opData['output']['message'];
295  if (is_array($this->messages[$outputMsg])) {
296  foreach ($this->messages[$outputMsg] as $pname => $pattrs) {
297  if ($opData['style'] == 'document' &&
298  $opData['output']['use'] == 'literal' &&
299  $pname == 'parameters') {
300 
301  $el = $this->elements[$pattrs['namespace']][$pattrs['type']];
302  if (isset($el['elements'])) {
303  foreach ($el['elements'] as $elname => $elattrs) {
304  $opData['output']['parts'][$elname] = $elattrs;
305  }
306  }
307  } else {
308  $opData['output']['parts'][$pname] = $pattrs;
309  }
310  }
311  }
312  return $opData;
313  }
& _raiseSoapFault($str, $detail='', $actorURI='', $code=null, $mode=null, $options=null, $skipmsg=false)
Raises a SOAP error.
+ Here is the call graph for this function:

◆ getPortName()

ilBMFWSDL::getPortName (   $operation,
  $service = null 
)

Finds the name of the first port that contains an operation of name $operation.

Always returns a SOAP portName.

Definition at line 216 of file class.ilBMFWSDL.php.

References $service, ilBMFBase_Object\__getfault(), ilBMFBase_Object\__isfault(), _getPortName(), and ilBMFBase_Object\_raiseSoapFault().

217  {
218  if ($this->__isfault()) {
219  return $this->__getfault();
220  }
221 
222  if (!$service) {
224  }
225  if (isset($this->services[$service]['ports'])) {
226  if ($portName = $this->_getPortName($operation, $service)) {
227  return $portName;
228  }
229  }
230  // Try any service in the WSDL.
231  foreach ($this->services as $serviceName => $service) {
232  if (isset($this->services[$serviceName]['ports'])) {
233  if ($portName = $this->_getPortName($operation, $serviceName)) {
234  $this->service = $serviceName;
235  return $portName;
236  }
237  }
238  }
239  return $this->_raiseSoapFault("No operation $operation in WSDL.", $this->uri);
240  }
& _raiseSoapFault($str, $detail='', $actorURI='', $code=null, $mode=null, $options=null, $skipmsg=false)
Raises a SOAP error.
_getPortName($operation, $service)
+ Here is the call graph for this function:

◆ getProxy()

& ilBMFWSDL::getProxy (   $port = '',
  $name = '' 
)

Definition at line 699 of file class.ilBMFWSDL.php.

References ilBMFBase_Object\$fault, $proxy, $service, ilBMFBase_Object\__getfault(), ilBMFBase_Object\__isfault(), and generateProxyCode().

700  {
701  if ($this->__isfault()) {
702  $fault =& $this->__getfault();
703  return $fault;
704  }
705 
706  $multiport = count($this->services[$this->service]['ports']) > 1;
707 
708  if (!$port) {
709  reset($this->services[$this->service]['ports']);
710  $port = current($this->services[$this->service]['ports']);
711  }
712 
713  if ($multiport || $port) {
714  $classname = 'WebService_' . $this->service . '_' . $port['name'];
715  } else {
716  $classname = 'WebService_' . $this->service;
717  }
718 
719  if ($name) {
720  $classname = $name . '_' . $classname;
721  }
722 
723  $classname = preg_replace('/[ .\-\(\)]+/', '_', $classname);
724  if (!class_exists($classname)) {
725  $proxy = $this->generateProxyCode($port, $classname);
726  require_once 'SOAP/Client.php';
727  eval($proxy);
728  }
729  $proxy =& new $classname;
730 
731  return $proxy;
732  }
generateProxyCode($port='', $classname='')
Generates stub code from the WSDL that can be saved to a file or eval'd into existence.
$fault
Recent PEAR_Error object.
+ Here is the call graph for this function:

◆ getSchemaType()

ilBMFWSDL::getSchemaType (   $type,
  $name,
  $type_namespace 
)

Definition at line 771 of file class.ilBMFWSDL.php.

References _getDeepestArrayType().

772  {
773  // see if it's a complex type so we can deal properly with
774  // SOAPENC:arrayType.
775  if ($name && $type) {
776  // XXX TODO:
777  // look up the name in the wsdl and validate the type.
778  foreach ($this->complexTypes as $ns => $types) {
779  if (array_key_exists($type, $types)) {
780  if (array_key_exists('type', $types[$type])) {
781  list($arraytype_ns, $arraytype, $array_depth) = isset($types[$type]['arrayType'])?
782  $this->_getDeepestArrayType($types[$type]['namespace'], $types[$type]['arrayType'])
783  : array($this->namespaces[$types[$type]['namespace']], null, 0);
784  return array($types[$type]['type'], $arraytype, $arraytype_ns, $array_depth);
785  }
786  if (array_key_exists('arrayType', $types[$type])) {
787  list($arraytype_ns, $arraytype, $array_depth) =
788  $this->_getDeepestArrayType($types[$type]['namespace'], $types[$type]['arrayType']);
789  return array('Array', $arraytype, $arraytype_ns, $array_depth);
790  }
791  if (array_key_exists('elements', $types[$type]) &&
792  array_key_exists($name, $types[$type]['elements'])) {
793  $type = $types[$type]['elements']['type'];
794  return array($type, null, $this->namespaces[$types[$type]['namespace']], null);
795  }
796  }
797  }
798  }
799  if ($type && $type_namespace) {
800  $arrayType = null;
801  // XXX TODO:
802  // this code currently handles only one way of encoding array types in wsdl
803  // need to do a generalized function to figure out complex types
804  $p = $this->ns[$type_namespace];
805  if ($p &&
806  array_key_exists($p, $this->complexTypes) &&
807  array_key_exists($type, $this->complexTypes[$p])) {
808  if ($arrayType = $this->complexTypes[$p][$type]['arrayType']) {
809  $type = 'Array';
810  } elseif ($this->complexTypes[$p][$type]['order']=='sequence' &&
811  array_key_exists('elements', $this->complexTypes[$p][$type])) {
812  reset($this->complexTypes[$p][$type]['elements']);
813  // assume an array
814  if (count($this->complexTypes[$p][$type]['elements']) == 1) {
815  $arg = current($this->complexTypes[$p][$type]['elements']);
816  $arrayType = $arg['type'];
817  $type = 'Array';
818  } else {
819  foreach ($this->complexTypes[$p][$type]['elements'] as $element) {
820  if ($element['name'] == $type) {
821  $arrayType = $element['type'];
822  $type = $element['type'];
823  }
824  }
825  }
826  } else {
827  $type = 'Struct';
828  }
829  return array($type, $arrayType, $type_namespace, null);
830  }
831  }
832  return array(null, null, null, null);
833  }
_getDeepestArrayType($nsPrefix, $arrayType)
Recurse through the WSDL structure looking for the innermost array type of multi-dimensional arrays...
+ Here is the call graph for this function:

◆ getSoapAction()

ilBMFWSDL::getSoapAction (   $portName,
  $operation 
)

Definition at line 381 of file class.ilBMFWSDL.php.

References $service, ilBMFBase_Object\__getfault(), and ilBMFBase_Object\__isfault().

382  {
383  if ($this->__isfault()) {
384  return $this->__getfault();
385  }
386 
387  if (!empty($this->bindings[$this->services[$this->service]['ports'][$portName]['binding']]['operations'][$operation]['soapAction'])) {
388  return $this->bindings[$this->services[$this->service]['ports'][$portName]['binding']]['operations'][$operation]['soapAction'];
389  }
390 
391  return false;
392  }
+ Here is the call graph for this function:

◆ ilBMFWSDL()

ilBMFWSDL::ilBMFWSDL (   $wsdl_uri = false,
  $proxy = array(),
  $cacheUse = WSDL_CACHE_USE,
  $cacheMaxAge = WSDL_CACHE_MAX_AGE,
  $docs = false 
)

ilBMFWSDL constructor.

Parameters
string$wsdl_uriURL to WSDL file.
array$proxyContains options for HTTP_Request class
See also
HTTP_Request.
Parameters
boolean$cacheUseUse WSDL caching. Defaults to false.
integer$cacheMaxAgeCache max lifetime (in seconds).
boolean$docsParse documentation in the WSDL? Defaults to false.

public

Definition at line 111 of file class.ilBMFWSDL.php.

References $cacheMaxAge, $cacheUse, $docs, $proxy, PEAR\isError(), and parseURL().

116  {
117  parent::ilBMFBase('WSDL');
118  $this->uri = $wsdl_uri;
119  $this->proxy = $proxy;
120  $this->cacheUse = $cacheUse;
121  $this->cacheMaxAge = $cacheMaxAge;
122  $this->docs = $docs;
123 
124  if ($wsdl_uri) {
125  if (!PEAR::isError($this->parseURL($wsdl_uri))) {
126  reset($this->services);
127  $this->service = key($this->services);
128  }
129  }
130  }
parseURL($wsdl_uri, $proxy=array())
Fills the WSDL array tree with data from a WSDL file.
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:279
+ Here is the call graph for this function:

◆ matchMethod()

ilBMFWSDL::matchMethod ( $operation)

Definition at line 315 of file class.ilBMFWSDL.php.

References ilBMFBase_Object\__getfault(), and ilBMFBase_Object\__isfault().

316  {
317  if ($this->__isfault()) {
318  return $this->__getfault();
319  }
320 
321  // Overloading lowercases function names :(
322  foreach ($this->services[$this->service]['ports'] as $port => $portAttrs) {
323  foreach (array_keys($this->bindings[$portAttrs['binding']]['operations']) as $op) {
324  if (strcasecmp($op, $operation) == 0) {
325  $operation = $op;
326  }
327  }
328  }
329  }
+ Here is the call graph for this function:

◆ parse()

ilBMFWSDL::parse (   $wsdl_uri,
  $proxy = array() 
)
Deprecated:
use parseURL instead

Definition at line 142 of file class.ilBMFWSDL.php.

References parseURL().

Referenced by ilBMFWSDL_Parser\ilBMFWSDL_Parser().

143  {
144  $this->parseURL($wsdl_uri, $proxy);
145  }
parseURL($wsdl_uri, $proxy=array())
Fills the WSDL array tree with data from a WSDL file.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseObject()

ilBMFWSDL::parseObject ( $wsdl_obj,
  $targetNamespace,
  $service_name,
  $service_desc = '' 
)

Fills the WSDL array tree with data from one or more PHP class objects.

Parameters
mixed$wsdl_objAn object or array of objects to add to the internal WSDL tree.
string$targetNamespaceThe target namespace of schema types etc.
string$service_nameName of the WSDL service.
string$service_descOptional description of the WSDL service.

Definition at line 174 of file class.ilBMFWSDL.php.

References ilBMFBase_Object\_raiseSoapFault().

176  {
177  $parser =& new ilBMFWSDL_ObjectParser($wsdl_obj, $this,
178  $targetNamespace, $service_name,
179  $service_desc);
180 
181  if ($parser->fault) {
182  $this->_raiseSoapFault($parser->fault);
183  }
184  }
& _raiseSoapFault($str, $detail='', $actorURI='', $code=null, $mode=null, $options=null, $skipmsg=false)
Raises a SOAP error.
Parses the types and methods used in web service objects into the internal data structures used by il...
+ Here is the call graph for this function:

◆ parseURL()

ilBMFWSDL::parseURL (   $wsdl_uri,
  $proxy = array() 
)

Fills the WSDL array tree with data from a WSDL file.

Parameters
string$wsdl_uriURL to WSDL file.
array$proxyContains options for HTTP_Request class
See also
HTTP_Request.

Definition at line 154 of file class.ilBMFWSDL.php.

References ilBMFBase_Object\_raiseSoapFault().

Referenced by ilBMFWSDL(), and parse().

155  {
156  $parser =& new $this->wsdlParserClass($wsdl_uri, $this, $this->docs);
157 
158  if ($parser->fault) {
159  $this->_raiseSoapFault($parser->fault);
160  }
161  }
& _raiseSoapFault($str, $detail='', $actorURI='', $code=null, $mode=null, $options=null, $skipmsg=false)
Raises a SOAP error.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_service()

ilBMFWSDL::set_service (   $service)

Definition at line 132 of file class.ilBMFWSDL.php.

References $service.

133  {
134  if (array_key_exists($service, $this->services)) {
135  $this->service = $service;
136  }
137  }

Field Documentation

◆ $bindings

ilBMFWSDL::$bindings = array()

Definition at line 60 of file class.ilBMFWSDL.php.

◆ $cacheMaxAge

ilBMFWSDL::$cacheMaxAge = null

Definition at line 88 of file class.ilBMFWSDL.php.

Referenced by ilBMFWSDL(), and ilBMFWSDL_Cache\ilBMFWSDL_Cache().

◆ $cacheUse

ilBMFWSDL::$cacheUse = null

Definition at line 81 of file class.ilBMFWSDL.php.

Referenced by ilBMFWSDL(), and ilBMFWSDL_Cache\ilBMFWSDL_Cache().

◆ $complexTypes

ilBMFWSDL::$complexTypes = array()

Definition at line 56 of file class.ilBMFWSDL.php.

◆ $definition

ilBMFWSDL::$definition = array()

Definition at line 52 of file class.ilBMFWSDL.php.

◆ $docs

ilBMFWSDL::$docs = false

Definition at line 65 of file class.ilBMFWSDL.php.

Referenced by ilBMFWSDL(), and ilBMFWSDL_Parser\ilBMFWSDL_Parser().

◆ $elements

ilBMFWSDL::$elements = array()

Definition at line 57 of file class.ilBMFWSDL.php.

◆ $imports

ilBMFWSDL::$imports = array()

Definition at line 61 of file class.ilBMFWSDL.php.

◆ $messages

ilBMFWSDL::$messages = array()

Definition at line 58 of file class.ilBMFWSDL.php.

◆ $namespaces

ilBMFWSDL::$namespaces = array()

Definition at line 53 of file class.ilBMFWSDL.php.

◆ $ns

ilBMFWSDL::$ns = array()

◆ $portTypes

ilBMFWSDL::$portTypes = array()

Definition at line 59 of file class.ilBMFWSDL.php.

◆ $proxy

ilBMFWSDL::$proxy = null

Definition at line 72 of file class.ilBMFWSDL.php.

Referenced by getProxy(), and ilBMFWSDL().

◆ $service

◆ $services

ilBMFWSDL::$services = array()

Definition at line 62 of file class.ilBMFWSDL.php.

◆ $tns

ilBMFWSDL::$tns = null

Definition at line 51 of file class.ilBMFWSDL.php.

◆ $trace

ilBMFWSDL::$trace = 0

Definition at line 74 of file class.ilBMFWSDL.php.

◆ $uri

ilBMFWSDL::$uri = ''

◆ $wsdlParserClass

ilBMFWSDL::$wsdlParserClass = 'ilBMFWSDL_Parser'

Definition at line 96 of file class.ilBMFWSDL.php.

◆ $xsd

ilBMFWSDL::$xsd = SOAP_XML_SCHEMA_VERSION

Definition at line 55 of file class.ilBMFWSDL.php.


The documentation for this class was generated from the following file: