ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilBMFWSDL_Parser Class Reference
+ Inheritance diagram for ilBMFWSDL_Parser:
+ Collaboration diagram for ilBMFWSDL_Parser:

Public Member Functions

 ilBMFWSDL_Parser ($uri, &$wsdl, $docs=false)
 constructor More...
 
 parse ($uri)
 
 startElement ($parser, $name, $attrs)
 start-element handler More...
 
 endElement ($parser, $name)
 end-element handler. More...
 
 characterData ($parser, $data)
 Element content handler. More...
 
 mergeUrl ($parsed, $path)
 $parsed is an array returned by parse_url(). More...
 
 _normalize ($path_str)
 
- 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

 $currentMessage
 Define internal arrays of bindings, ports, operations, messages, etc. More...
 
 $currentOperation
 
 $currentPortType
 
 $currentBinding
 
 $currentPort
 
 $cache
 Parser vars. More...
 
 $tns = null
 
 $soapns = array('soap')
 
 $uri = ''
 
 $wsdl = null
 
 $status = ''
 
 $element_stack = array()
 
 $parentElement = ''
 
 $schema = ''
 
 $schemaStatus = ''
 
 $schema_stack = array()
 
 $currentComplexType
 
 $schema_element_stack = array()
 
 $currentElement
 
- 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 1017 of file class.ilBMFWSDL.php.

Member Function Documentation

◆ _normalize()

ilBMFWSDL_Parser::_normalize (   $path_str)

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

1825 {
1826 $pwd = '';
1827 $strArr = preg_split('/(\/)/', $path_str, -1, PREG_SPLIT_NO_EMPTY);
1828 $pwdArr = '';
1829 $j = 0;
1830 for ($i = 0; $i < count($strArr); $i++) {
1831 if ($strArr[$i] != ' ..') {
1832 if ($strArr[$i] != ' .') {
1833 $pwdArr[$j] = $strArr[$i];
1834 $j++;
1835 }
1836 } else {
1837 array_pop($pwdArr);
1838 $j--;
1839 }
1840 }
1841 $pStr = implode('/', $pwdArr);
1842 $pwd = (strlen($pStr) > 0) ? ('/' . $pStr) : '/';
1843 return $pwd;
1844 }

Referenced by mergeUrl().

+ Here is the caller graph for this function:

◆ characterData()

ilBMFWSDL_Parser::characterData (   $parser,
  $data 
)

Element content handler.

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

1730 {
1731 // Store the documentation in the WSDL file.
1732 if ($this->currentTag == 'documentation') {
1733 $data = trim(preg_replace('/\s+/', ' ', $data));
1734 if (!strlen($data)) {
1735 return;
1736 }
1737
1738 switch ($this->status) {
1739 case 'service':
1740 $ptr =& $this->wsdl->services[$this->currentService];
1741 break;
1742
1743 case 'portType':
1744 $ptr =& $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation];
1745 break;
1746
1747 case 'binding':
1748 $ptr =& $this->wsdl->bindings[$this->currentBinding];
1749 break;
1750
1751 case 'message':
1752 $ptr =& $this->wsdl->messages[$this->currentMessage];
1753 break;
1754
1755 case 'operation':
1756 break;
1757
1758 case 'types':
1759 if (isset($this->currentComplexType) &&
1760 isset($this->wsdl->complexTypes[$this->schema][$this->currentComplexType])) {
1761 if ($this->currentElement) {
1762 $ptr =& $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['elements'][$this->currentElement];
1763 } else {
1764 $ptr =& $this->wsdl->complexTypes[$this->schema][$this->currentComplexType];
1765 }
1766 }
1767 break;
1768 }
1769
1770 if (isset($ptr)) {
1771 if (!isset($ptr['documentation'])) {
1772 $ptr['documentation'] = '';
1773 } else {
1774 $ptr['documentation'] .= ' ';
1775 }
1776 $ptr['documentation'] .= $data;
1777 }
1778 }
1779 }
$currentMessage
Define internal arrays of bindings, ports, operations, messages, etc.
parses a WSDL file, allows access to it's data, other utility methods
Definition: nusoap.php:3133
$data

References $currentBinding, $currentComplexType, $currentElement, $currentMessage, $currentOperation, $currentPortType, $data, and $schema.

◆ endElement()

ilBMFWSDL_Parser::endElement (   $parser,
  $name 
)

end-element handler.

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

1683 {
1684 $stacksize = count($this->element_stack);
1685 if ($stacksize) {
1686 if ($this->element_stack[$stacksize - 1] == 'definitions') {
1687 $this->status = '';
1688 }
1689 array_pop($this->element_stack);
1690 }
1691
1692 if (stristr($name, 'schema')) {
1693 array_pop($this->schema_stack);
1694 $this->schema = '';
1695 }
1696
1697 if ($this->schema) {
1698 array_pop($this->schema_stack);
1699 if (count($this->schema_stack) <= 1) {
1700 /* Correct the type for sequences with multiple
1701 * elements. */
1702 if (isset($this->currentComplexType) && isset($this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'])
1703 && $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] == 'Array'
1704 && array_key_exists('elements', $this->wsdl->complexTypes[$this->schema][$this->currentComplexType])
1705 && count($this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['elements']) > 1) {
1706 $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = 'Struct';
1707 }
1708 }
1709 if (stristr($name, 'complexType')) {
1710 $this->currentComplexType = '';
1711 if (count($this->schema_element_stack)) {
1712 $this->currentElement = array_pop($this->schema_element_stack);
1713 } else {
1714 $this->currentElement = '';
1715 }
1716 } elseif (stristr($name, 'element')) {
1717 if (count($this->schema_element_stack)) {
1718 $this->currentElement = array_pop($this->schema_element_stack);
1719 } else {
1720 $this->currentElement = '';
1721 }
1722 }
1723 }
1724 }

References $currentComplexType, and $schema.

◆ ilBMFWSDL_Parser()

ilBMFWSDL_Parser::ilBMFWSDL_Parser (   $uri,
$wsdl,
  $docs = false 
)

constructor

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

1055 {
1056 parent::ilBMFBase('WSDLPARSER');
1057 $this->cache =& new ilBMFWSDL_Cache($wsdl->cacheUse, $wsdl->cacheMaxAge);
1058 $this->uri = $uri;
1059 $this->wsdl = &$wsdl;
1060 $this->docs = $docs;
1061 $this->parse($uri);
1062 }

References $uri, $wsdl, and parse().

+ Here is the call graph for this function:

◆ mergeUrl()

ilBMFWSDL_Parser::mergeUrl (   $parsed,
  $path 
)

$parsed is an array returned by parse_url().

@access private

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

1787 {
1788 if (!is_array($parsed)) {
1789 return false;
1790 }
1791
1792 $uri = '';
1793 if (!empty($parsed['scheme'])) {
1794 $sep = (strtolower($parsed['scheme']) == 'mailto' ? ':' : '://');
1795 $uri = $parsed['scheme'] . $sep;
1796 }
1797
1798 if (isset($parsed['pass'])) {
1799 $uri .= "$parsed[user]:$parsed[pass]@";
1800 } elseif (isset($parsed['user'])) {
1801 $uri .= "$parsed[user]@";
1802 }
1803
1804 if (isset($parsed['host'])) {
1805 $uri .= $parsed['host'];
1806 }
1807 if (isset($parsed['port'])) {
1808 $uri .= ":$parsed[port]";
1809 }
1810 if ($path[0] != '/' && isset($parsed['path'])) {
1811 if ($parsed['path'][strlen($parsed['path']) - 1] != '/') {
1812 $path = dirname($parsed['path']) . '/' . $path;
1813 } else {
1814 $path = $parsed['path'] . $path;
1815 }
1816 $path = $this->_normalize($path);
1817 }
1818 $sep = $path[0] == '/' ? '' : '/';
1819 $uri .= $sep . $path;
1820
1821 return $uri;
1822 }
$path
Definition: index.php:22

References $path, $uri, and _normalize().

Referenced by startElement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse()

ilBMFWSDL_Parser::parse (   $uri)

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

1065 {
1066 // Check whether content has been read.
1067 $fd = $this->cache->get($uri, $this->wsdl->proxy);
1068 if (PEAR::isError($fd)) {
1069 return $this->_raiseSoapFault($fd);
1070 }
1071
1072 // Create an XML parser.
1073 $parser = xml_parser_create();
1074 xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
1075 xml_set_object($parser, $this);
1076 xml_set_element_handler($parser, 'startElement', 'endElement');
1077 if ($this->docs) {
1078 xml_set_character_data_handler($parser, 'characterData');
1079 }
1080
1081 if (!xml_parse($parser, $fd, true)) {
1082 $detail = sprintf('XML error on line %d: %s',
1083 xml_get_current_line_number($parser),
1084 xml_error_string(xml_get_error_code($parser)));
1085 return $this->_raiseSoapFault("Unable to parse WSDL file $uri\n$detail");
1086 }
1087 xml_parser_free($parser);
1088 return true;
1089 }
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:279
& _raiseSoapFault($str, $detail='', $actorURI='', $code=null, $mode=null, $options=null, $skipmsg=false)
Raises a SOAP error.

References $uri, ilBMFBase_Object\_raiseSoapFault(), and PEAR\isError().

Referenced by ilBMFWSDL_Parser().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ startElement()

ilBMFWSDL_Parser::startElement (   $parser,
  $name,
  $attrs 
)

start-element handler

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

1095 {
1096 // Get element prefix.
1097 $qname =& new QName($name);
1098 if ($qname->ns) {
1099 $ns = $qname->ns;
1100 if ($ns && ((!$this->tns && strcasecmp($qname->name, 'definitions') == 0) || $ns == $this->tns)) {
1101 $name = $qname->name;
1102 }
1103 }
1104 $this->currentTag = $qname->name;
1105 $this->parentElement = '';
1106 $stack_size = count($this->element_stack);
1107 if ($stack_size) {
1108 $this->parentElement = $this->element_stack[$stack_size - 1];
1109 }
1110 $this->element_stack[] = $this->currentTag;
1111
1112 // Find status, register data.
1113 switch ($this->status) {
1114 case 'types':
1115 // sect 2.2 wsdl:types
1116 // children: xsd:schema
1117 $parent_tag = '';
1118 $stack_size = count($this->schema_stack);
1119 if ($stack_size) {
1120 $parent_tag = $this->schema_stack[$stack_size - 1];
1121 }
1122
1123 switch ($qname->name) {
1124 case 'schema':
1125 // No parent should be in the stack.
1126 if (!$parent_tag || $parent_tag == 'types') {
1127 if (array_key_exists('targetNamespace', $attrs)) {
1128 $this->schema = $this->wsdl->getNamespaceAttributeName($attrs['targetNamespace']);
1129 } else {
1130 $this->schema = $this->wsdl->getNamespaceAttributeName($this->wsdl->tns);
1131 }
1132 $this->wsdl->complexTypes[$this->schema] = array();
1133 $this->wsdl->elements[$this->schema] = array();
1134 }
1135 break;
1136
1137 case 'complexType':
1138 if ($parent_tag == 'schema') {
1139 $this->currentComplexType = $attrs['name'];
1140 if (!isset($attrs['namespace'])) {
1141 $attrs['namespace'] = $this->schema;
1142 }
1143 $this->wsdl->complexTypes[$this->schema][$this->currentComplexType] = $attrs;
1144 if (array_key_exists('base', $attrs)) {
1145 $qn =& new QName($attrs['base']);
1146 $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = $qn->name;
1147 $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['namespace'] = $qn->ns;
1148 } else {
1149 $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = 'Struct';
1150 }
1151 $this->schemaStatus = 'complexType';
1152 } else {
1153 $this->wsdl->elements[$this->schema][$this->currentElement]['complex'] = true;
1154 }
1155 break;
1156
1157 case 'element':
1158 if (isset($attrs['type'])) {
1159 $qn =& new QName($attrs['type']);
1160 $attrs['type'] = $qn->name;
1161 if ($qn->ns && array_key_exists($qn->ns, $this->wsdl->namespaces)) {
1162 $attrs['namespace'] = $qn->ns;
1163 }
1164 }
1165
1166 $parentElement = '';
1167 $stack_size = count($this->schema_element_stack);
1168 if ($stack_size > 0) {
1169 $parentElement = $this->schema_element_stack[$stack_size - 1];
1170 }
1171
1172 if (isset($attrs['ref'])) {
1173 $qn =& new QName($attrs['ref']);
1174 $this->currentElement = $qn->name;
1175 } else {
1176 $this->currentElement = $attrs['name'];
1177 }
1178 $this->schema_element_stack[] = $this->currentElement;
1179 if (!isset($attrs['namespace'])) {
1180 $attrs['namespace'] = $this->schema;
1181 }
1182
1183 if ($parent_tag == 'schema') {
1184 $this->wsdl->elements[$this->schema][$this->currentElement] = $attrs;
1185 $this->wsdl->elements[$this->schema][$this->currentElement]['complex'] = false;
1186 $this->schemaStatus = 'element';
1187 } elseif ($this->currentComplexType) {
1188 // we're inside a complexType
1189 if ((isset($this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['order']) &&
1190 $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['order'] == 'sequence')
1191 && $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] == 'Array') {
1192 $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['arrayType'] = isset($attrs['type']) ? $attrs['type'] : null;
1193 }
1194 $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['elements'][$this->currentElement] = $attrs;
1195 } else {
1196 $this->wsdl->elements[$this->schema][$parentElement]['elements'][$this->currentElement] = $attrs;
1197 }
1198 break;
1199
1200 case 'complexContent':
1201 case 'simpleContent':
1202 break;
1203
1204 case 'extension':
1205 case 'restriction':
1206 if ($this->schemaStatus == 'complexType') {
1207 if (!empty($attrs['base'])) {
1208 $qn =& new QName($attrs['base']);
1209 $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = $qn->name;
1210
1211 // Types that extend from other types aren't
1212 // *of* those types. Reflect this by denoting
1213 // which type they extend. I'm leaving the
1214 // 'type' setting here since I'm not sure what
1215 // removing it might break at the moment.
1216 if ($qname->name == 'extension') {
1217 $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['extends'] = $qn->name;
1218 }
1219 } else {
1220 $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = 'Struct';
1221 }
1222 }
1223 break;
1224
1225 case 'sequence':
1226 if ($this->schemaStatus == 'complexType') {
1227 $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['order'] = $qname->name;
1228 if (!isset($this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'])) {
1229 $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = 'Array';
1230 }
1231 }
1232 break;
1233
1234 case 'all':
1235 $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['order'] = $qname->name;
1236 if (!isset($this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'])) {
1237 $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = 'Struct';
1238 }
1239 break;
1240
1241 case 'choice':
1242 $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['order'] = $qname->name;
1243 if (!isset($this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'])) {
1244 $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = 'Array';
1245 }
1246
1247 case 'attribute':
1248 if ($this->schemaStatus == 'complexType') {
1249 if (isset($attrs['name'])) {
1250 $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['attribute'][$attrs['name']] = $attrs;
1251 } else {
1252 if (isset($attrs['ref'])) {
1253 $q =& new QName($attrs['ref']);
1254 foreach ($attrs as $k => $v) {
1255 if ($k != 'ref' && strstr($k, $q->name)) {
1256 $vq =& new QName($v);
1257 if ($q->name == 'arrayType') {
1258 $this->wsdl->complexTypes[$this->schema][$this->currentComplexType][$q->name] = $vq->name. $vq->arrayInfo;
1259 $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = 'Array';
1260 $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['namespace'] = $vq->ns;
1261 } else {
1262 $this->wsdl->complexTypes[$this->schema][$this->currentComplexType][$q->name] = $vq->name;
1263 }
1264 }
1265 }
1266 }
1267 }
1268 }
1269 break;
1270 }
1271
1272 $this->schema_stack[] = $qname->name;
1273 break;
1274
1275 case 'message':
1276 // sect 2.3 wsdl:message child wsdl:part
1277 switch ($qname->name) {
1278 case 'part':
1279 $qn = null;
1280 if (isset($attrs['type'])) {
1281 $qn =& new QName($attrs['type']);
1282 } elseif (isset($attrs['element'])) {
1283 $qn =& new QName($attrs['element']);
1284 }
1285 if ($qn) {
1286 $attrs['type'] = $qn->name;
1287 $attrs['namespace'] = $qn->ns;
1288 }
1289 $this->wsdl->messages[$this->currentMessage][$attrs['name']] = $attrs;
1290 // error in wsdl
1291
1292 case 'documentation':
1293 break;
1294
1295 default:
1296 break;
1297 }
1298 break;
1299
1300 case 'portType':
1301 // sect 2.4
1302 switch ($qname->name) {
1303 case 'operation':
1304 // attributes: name
1305 // children: wsdl:input wsdl:output wsdl:fault
1306 $this->currentOperation = $attrs['name'];
1307 $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation] = $attrs;
1308 break;
1309
1310 case 'input':
1311 case 'output':
1312 case 'fault':
1313 // wsdl:input wsdl:output wsdl:fault
1314 // attributes: name message parameterOrder(optional)
1315 if ($this->currentOperation) {
1316 if (isset($this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name])) {
1317 $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name] = array_merge($this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name], $attrs);
1318 } else {
1319 $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name] = $attrs;
1320 }
1321 if (array_key_exists('message', $attrs)) {
1322 $qn =& new QName($attrs['message']);
1323 $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name]['message'] = $qn->name;
1324 $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name]['namespace'] = $qn->ns;
1325 }
1326 }
1327 break;
1328
1329 case 'documentation':
1330 break;
1331
1332 default:
1333 break;
1334 }
1335 break;
1336
1337 case 'binding':
1338 $ns = $qname->ns ? $this->wsdl->namespaces[$qname->ns] : SCHEMA_WSDL;
1339 switch ($ns) {
1340 case SCHEMA_SOAP:
1341 // this deals with wsdl section 3 soap binding
1342 switch ($qname->name) {
1343 case 'binding':
1344 // sect 3.3
1345 // soap:binding, attributes: transport(required), style(optional, default = document)
1346 // if style is missing, it is assumed to be 'document'
1347 if (!isset($attrs['style'])) {
1348 $attrs['style'] = 'document';
1349 }
1350 $this->wsdl->bindings[$this->currentBinding] = array_merge($this->wsdl->bindings[$this->currentBinding], $attrs);
1351 break;
1352
1353 case 'operation':
1354 // sect 3.4
1355 // soap:operation, attributes: soapAction(required), style(optional, default = soap:binding:style)
1356 if (!isset($attrs['style'])) {
1357 $attrs['style'] = $this->wsdl->bindings[$this->currentBinding]['style'];
1358 }
1359 if (isset($this->wsdl->bindings[$this->currentBinding]['operations'][$this->currentOperation])) {
1360 $this->wsdl->bindings[$this->currentBinding]['operations'][$this->currentOperation] = array_merge($this->wsdl->bindings[$this->currentBinding]['operations'][$this->currentOperation], $attrs);
1361 } else {
1362 $this->wsdl->bindings[$this->currentBinding]['operations'][$this->currentOperation] = $attrs;
1363 }
1364 break;
1365
1366 case 'body':
1367 // sect 3.5
1368 // soap:body attributes:
1369 // part - optional. listed parts must appear in body, missing means all parts appear in body
1370 // use - required. encoded|literal
1371 // encodingStyle - optional. space seperated list of encodings (uri's)
1372 $this->wsdl->bindings[$this->currentBinding]
1373 ['operations'][$this->currentOperation][$this->opStatus] = $attrs;
1374 break;
1375
1376 case 'fault':
1377 // sect 3.6
1378 // soap:fault attributes: name use encodingStyle namespace
1379 $this->wsdl->bindings[$this->currentBinding]
1380 ['operations'][$this->currentOperation][$this->opStatus] = $attrs;
1381 break;
1382
1383 case 'header':
1384 // sect 3.7
1385 // soap:header attributes: message part use encodingStyle namespace
1386 $this->wsdl->bindings[$this->currentBinding]
1387 ['operations'][$this->currentOperation][$this->opStatus]['headers'][] = $attrs;
1388 break;
1389
1390 case 'headerfault':
1391 // sect 3.7
1392 // soap:header attributes: message part use encodingStyle namespace
1393 $header = count($this->wsdl->bindings[$this->currentBinding]
1394 ['operations'][$this->currentOperation][$this->opStatus]['headers'])-1;
1395 $this->wsdl->bindings[$this->currentBinding]
1396 ['operations'][$this->currentOperation][$this->opStatus]['headers'][$header]['fault'] = $attrs;
1397 break;
1398
1399 case 'documentation':
1400 break;
1401
1402 default:
1403 // error! not a valid element inside binding
1404 break;
1405 }
1406 break;
1407
1408 case SCHEMA_WSDL:
1409 // XXX verify correct namespace
1410 // for now, default is the 'wsdl' namespace
1411 // other possible namespaces include smtp, http, etc. for alternate bindings
1412 switch ($qname->name) {
1413 case 'operation':
1414 // sect 2.5
1415 // wsdl:operation attributes: name
1416 $this->currentOperation = $attrs['name'];
1417 break;
1418
1419 case 'output':
1420 case 'input':
1421 case 'fault':
1422 // sect 2.5
1423 // wsdl:input attributes: name
1424 $this->opStatus = $qname->name;
1425 break;
1426
1427 case 'documentation':
1428 break;
1429
1430 default:
1431 break;
1432 }
1433 break;
1434
1435 case SCHEMA_WSDL_HTTP:
1436 switch ($qname->name) {
1437 case 'binding':
1438 // sect 4.4
1439 // http:binding attributes: verb
1440 // parent: wsdl:binding
1441 $this->wsdl->bindings[$this->currentBinding] = array_merge($this->wsdl->bindings[$this->currentBinding], $attrs);
1442 break;
1443
1444 case 'operation':
1445 // sect 4.5
1446 // http:operation attributes: location
1447 // parent: wsdl:operation
1448 $this->wsdl->bindings[$this->currentBinding]['operations']
1449 [$this->currentOperation] = $attrs;
1450 break;
1451
1452 case 'urlEncoded':
1453 // sect 4.6
1454 // http:urlEncoded attributes: location
1455 // parent: wsdl:input wsdl:output etc.
1456 $this->wsdl->bindings[$this->currentBinding]['operations'][$this->opStatus]
1457 [$this->currentOperation]['uri'] = 'urlEncoded';
1458 break;
1459
1460 case 'urlReplacement':
1461 // sect 4.7
1462 // http:urlReplacement attributes: location
1463 // parent: wsdl:input wsdl:output etc.
1464 $this->wsdl->bindings[$this->currentBinding]['operations'][$this->opStatus]
1465 [$this->currentOperation]['uri'] = 'urlReplacement';
1466 break;
1467
1468 case 'documentation':
1469 break;
1470
1471 default:
1472 // error
1473 break;
1474 }
1475
1476 case SCHEMA_MIME:
1477 // sect 5
1478 // all mime parts are children of wsdl:input, wsdl:output, etc.
1479 // unsuported as of yet
1480 switch ($qname->name) {
1481 case 'content':
1482 // sect 5.3 mime:content
1483 // <mime:content part="nmtoken"? type="string"?/>
1484 // part attribute only required if content is child of multipart related,
1485 // it contains the name of the part
1486 // type attribute contains the mime type
1487 case 'multipartRelated':
1488 // sect 5.4 mime:multipartRelated
1489 case 'part':
1490 case 'mimeXml':
1491 // sect 5.6 mime:mimeXml
1492 // <mime:mimeXml part="nmtoken"?/>
1493 //
1494 case 'documentation':
1495 break;
1496
1497 default:
1498 // error
1499 break;
1500 }
1501
1502 case SCHEMA_DIME:
1503 // DIME is defined in:
1504 // http://gotdotnet.com/team/xml_wsspecs/dime/WSDL-Extension-for-DIME.htm
1505 // all DIME parts are children of wsdl:input, wsdl:output, etc.
1506 // unsuported as of yet
1507 switch ($qname->name) {
1508 case 'message':
1509 // sect 4.1 dime:message
1510 // appears in binding section
1511 $this->wsdl->bindings[$this->currentBinding]['dime'] = $attrs;
1512 break;
1513
1514 default:
1515 break;
1516 }
1517
1518 default:
1519 break;
1520 }
1521 break;
1522
1523 case 'service':
1524 $ns = $qname->ns ? $this->wsdl->namespaces[$qname->ns] : SCHEMA_WSDL;
1525
1526 switch ($qname->name) {
1527 case 'port':
1528 // sect 2.6 wsdl:port attributes: name binding
1529 $this->currentPort = $attrs['name'];
1530 $this->wsdl->services[$this->currentService]['ports'][$this->currentPort] = $attrs;
1531 // XXX hack to deal with binding namespaces
1532 $qn =& new QName($attrs['binding']);
1533 $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['binding'] = $qn->name;
1534 $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['namespace'] = $qn->ns;
1535 break;
1536
1537 case 'address':
1538 $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['address'] = $attrs;
1539 // what TYPE of port is it? SOAP or HTTP?
1540 $ns = $qname->ns ? $this->wsdl->namespaces[$qname->ns] : SCHEMA_WSDL;
1541 switch ($ns) {
1542 case SCHEMA_WSDL_HTTP:
1543 $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['type']='http';
1544 break;
1545
1546 case SCHEMA_SOAP:
1547 $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['type']='soap';
1548 break;
1549
1550 default:
1551 // Shouldn't happen, we'll assume SOAP.
1552 $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['type']='soap';
1553 }
1554
1555 break;
1556
1557 case 'documentation':
1558 break;
1559
1560 default:
1561 break;
1562 }
1563 }
1564
1565 // Top level elements found under wsdl:definitions.
1566 switch ($qname->name) {
1567 case 'import':
1568 // sect 2.1.1 wsdl:import attributes: namespace location
1569 if ((isset($attrs['location']) || isset($attrs['schemaLocation'])) &&
1570 !isset($this->wsdl->imports[$attrs['namespace']])) {
1571 $uri = isset($attrs['location']) ? $attrs['location'] : $attrs['schemaLocation'];
1572 $location = @parse_url($uri);
1573 if (!isset($location['scheme'])) {
1574 $base = @parse_url($this->uri);
1575 $uri = $this->mergeUrl($base, $uri);
1576 }
1577
1578 $this->wsdl->imports[$attrs['namespace']] = $attrs;
1579 $import_parser_class = get_class($this);
1580 $import_parser =& new $import_parser_class($uri, $this->wsdl, $this->docs);
1581 if ($import_parser->fault) {
1582 unset($this->wsdl->imports[$attrs['namespace']]);
1583 return false;
1584 }
1585 $this->currentImport = $attrs['namespace'];
1586 }
1587 // Continue on to the 'types' case - lack of break; is
1588 // intentional.
1589
1590 case 'types':
1591 // sect 2.2 wsdl:types
1592 $this->status = 'types';
1593 break;
1594
1595 case 'schema':
1596 // We can hit this at the top level if we've been asked to
1597 // import an XSD file.
1598 if (!empty($attrs['targetNamespace'])) {
1599 $this->schema = $this->wsdl->getNamespaceAttributeName($attrs['targetNamespace']);
1600 } else {
1601 $this->schema = $this->wsdl->getNamespaceAttributeName($this->wsdl->tns);
1602 }
1603 $this->wsdl->complexTypes[$this->schema] = array();
1604 $this->wsdl->elements[$this->schema] = array();
1605 $this->schema_stack[] = $qname->name;
1606 $this->status = 'types';
1607 break;
1608
1609 case 'message':
1610 // sect 2.3 wsdl:message attributes: name children:wsdl:part
1611 $this->status = 'message';
1612 if (isset($attrs['name'])) {
1613 $this->currentMessage = $attrs['name'];
1614 $this->wsdl->messages[$this->currentMessage] = array();
1615 }
1616 break;
1617
1618 case 'portType':
1619 // sect 2.4 wsdl:portType
1620 // attributes: name
1621 // children: wsdl:operation
1622 $this->status = 'portType';
1623 $this->currentPortType = $attrs['name'];
1624 $this->wsdl->portTypes[$this->currentPortType] = array();
1625 break;
1626
1627 case 'binding':
1628 // sect 2.5 wsdl:binding attributes: name type
1629 // children: wsdl:operation soap:binding http:binding
1630 if ($qname->ns && $qname->ns != $this->tns) {
1631 break;
1632 }
1633 $this->status = 'binding';
1634 $this->currentBinding = $attrs['name'];
1635 $qn =& new QName($attrs['type']);
1636 $this->wsdl->bindings[$this->currentBinding]['type'] = $qn->name;
1637 $this->wsdl->bindings[$this->currentBinding]['namespace'] = $qn->ns;
1638 break;
1639
1640 case 'service':
1641 // sect 2.7 wsdl:service attributes: name children: ports
1642 $this->currentService = $attrs['name'];
1643 $this->wsdl->services[$this->currentService]['ports'] = array();
1644 $this->status = 'service';
1645 break;
1646
1647 case 'definitions':
1648 // sec 2.1 wsdl:definitions
1649 // attributes: name targetNamespace xmlns:*
1650 // children: wsdl:import wsdl:types wsdl:message wsdl:portType wsdl:binding wsdl:service
1651 $this->wsdl->definition = $attrs;
1652 foreach ($attrs as $key => $value) {
1653 if (strstr($key, 'xmlns:') !== false) {
1654 $qn =& new QName($key);
1655 // XXX need to refactor ns handling.
1656 $this->wsdl->namespaces[$qn->name] = $value;
1657 $this->wsdl->ns[$value] = $qn->name;
1658 if ($key == 'targetNamespace' ||
1659 strcasecmp($value,SOAP_SCHEMA) == 0) {
1660 $this->soapns[] = $qn->name;
1661 } else {
1662 if (in_array($value, $this->_XMLSchema)) {
1663 $this->wsdl->xsd = $value;
1664 }
1665 }
1666 }
1667 }
1668 if (isset($ns) && $ns) {
1669 $namespace = 'xmlns:' . $ns;
1670 if (!$this->wsdl->definition[$namespace]) {
1671 return $this->_raiseSoapFault("parse error, no namespace for $namespace", $this->uri);
1672 }
1673 $this->tns = $ns;
1674 }
1675 break;
1676 }
1677 }
$location
Definition: buildRTE.php:44
const SCHEMA_MIME
const SOAP_SCHEMA
const SCHEMA_DIME
const SCHEMA_WSDL
const SCHEMA_SOAP
const SCHEMA_WSDL_HTTP
mergeUrl($parsed, $path)
$parsed is an array returned by parse_url().
if($err=$client->getError()) $namespace
$header

References $currentBinding, $currentComplexType, $currentElement, $currentMessage, $currentOperation, $currentPort, $currentPortType, $header, $location, $namespace, $parentElement, $schema, $uri, ilBMFBase_Object\_raiseSoapFault(), mergeUrl(), SCHEMA_DIME, SCHEMA_MIME, SCHEMA_SOAP, SCHEMA_WSDL, SCHEMA_WSDL_HTTP, and SOAP_SCHEMA.

+ Here is the call graph for this function:

Field Documentation

◆ $cache

ilBMFWSDL_Parser::$cache

Parser vars.

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

◆ $currentBinding

ilBMFWSDL_Parser::$currentBinding

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

Referenced by characterData(), and startElement().

◆ $currentComplexType

ilBMFWSDL_Parser::$currentComplexType

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

Referenced by characterData(), endElement(), and startElement().

◆ $currentElement

ilBMFWSDL_Parser::$currentElement

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

Referenced by characterData(), and startElement().

◆ $currentMessage

ilBMFWSDL_Parser::$currentMessage

Define internal arrays of bindings, ports, operations, messages, etc.

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

Referenced by characterData(), and startElement().

◆ $currentOperation

ilBMFWSDL_Parser::$currentOperation

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

Referenced by characterData(), and startElement().

◆ $currentPort

ilBMFWSDL_Parser::$currentPort

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

Referenced by startElement().

◆ $currentPortType

ilBMFWSDL_Parser::$currentPortType

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

Referenced by characterData(), and startElement().

◆ $element_stack

ilBMFWSDL_Parser::$element_stack = array()

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

◆ $parentElement

ilBMFWSDL_Parser::$parentElement = ''

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

Referenced by startElement().

◆ $schema

ilBMFWSDL_Parser::$schema = ''

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

Referenced by characterData(), endElement(), and startElement().

◆ $schema_element_stack

ilBMFWSDL_Parser::$schema_element_stack = array()

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

◆ $schema_stack

ilBMFWSDL_Parser::$schema_stack = array()

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

◆ $schemaStatus

ilBMFWSDL_Parser::$schemaStatus = ''

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

◆ $soapns

ilBMFWSDL_Parser::$soapns = array('soap')

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

◆ $status

ilBMFWSDL_Parser::$status = ''

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

◆ $tns

ilBMFWSDL_Parser::$tns = null

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

◆ $uri

ilBMFWSDL_Parser::$uri = ''

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

Referenced by ilBMFWSDL_Parser(), mergeUrl(), parse(), and startElement().

◆ $wsdl

ilBMFWSDL_Parser::$wsdl = null

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

Referenced by ilBMFWSDL_Parser().


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