Lines Matching +full:- +full:- +full:debug

6 NuSOAP - Web Services Toolkit for PHP
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
46 // optional add-on classes
54 // cf. http://www.webkreator.com/php/techniques/php-static-class-variables.html
55 $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel = 9;
95 … * Current debug string (manipulated by debug/appendDebug/clearDebug/getDebug/getDebugAsXMLComment)
110 * the debug level for this instance
131 var $soap_defencoding = 'ISO-8859-1';
132 //var $soap_defencoding = 'UTF-8';
143 'SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/',
145 'xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
146 'SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/'
179 'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'),
183 'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'),
186 'http://xml.apache.org/xml-soap' => array('Map')
206 $this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel;
210 * gets the global debug level, which applies to future instances
212 * @return integer Debug level 0-9, where 0 turns off
216 return $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel;
220 * sets the global debug level, which applies to future instances
222 * @param int $level Debug level 0-9, where 0 turns off
226 $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel = $level;
230 * gets the debug level for this instance
232 * @return int Debug level 0-9, where 0 turns off
236 return $this->debugLevel;
240 * sets the debug level for this instance
242 * @param int $level Debug level 0-9, where 0 turns off
246 $this->debugLevel = $level;
250 * adds debug data to the instance debug string with formatting
252 * @param string $string debug data
255 function debug($string){ function in nusoap_base
256 if ($this->debugLevel > 0) {
257 $this->appendDebug($this->getmicrotime().' '.get_class($this).": $string\n");
262 * adds debug data to the instance debug string without formatting
264 * @param string $string debug data
268 if ($this->debugLevel > 0) {
271 $this->debug_str .= $string;
276 * clears the current debug data for this instance
283 $this->debug_str = '';
287 * gets the current debug data for this instance
289 * @return debug data
295 return $this->debug_str;
299 * gets the current debug data for this instance as an XML comment
300 * this may change the contents of the debug data
302 * @return debug data as an XML comment
308 while (strpos($this->debug_str, '--')) {
309 $this->debug_str = str_replace('--', '- -', $this->debug_str);
311 return "<!--\n" . $this->debug_str . "\n-->";
321 if ($this->charencoding) {
338 if($this->error_str != ''){
339 return $this->error_str;
351 $this->error_str = $str;
386 …$this->debug("in serialize_val: name=$name, type=$type, name_ns=$name_ns, type_ns=$type_ns, use=$u…
387 $this->appendDebug('value=' . $this->varDump($val));
388 $this->appendDebug('attributes=' . $this->varDump($attributes));
391 return $val->serialize($use);
407 if($type_ns != '' && $type_ns == $this->namespaces['xsd']){
419 $atts .= " $k=\"".$this->expandEntities($v).'"';
436 // serialize if an xsd built-in primitive type
437 if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){
445 $val = $this->expandEntities($val);
483 $val = $this->expandEntities($val);
493 $this->debug("In serialize_val, used class name $name as element name");
495 …$this->debug("In serialize_val, do not override name $name for element name for class " . get_clas…
498 …$pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,false,false,false,false,$use) : $this->ser…
505 $valueType = $this->isArraySimpleOrStruct($val);
511 $tt_ns = $v->type_ns;
512 $tt = $v->type;
514 $tt = $this->isArraySimpleOrStruct($v);
520 $xml .= $this->serialize_val($v,'item',false,false,false,false,$use);
525 } elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) {
531 $array_typename = 'SOAP-ENC:Array';
536 if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']){
552 …$type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"".$array_typename."[$array_type]\"";
561 $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"xsd:anyType[0]\"";
580 if ($type == 'Map' && $type_ns == 'http://xml.apache.org/xml-soap') {
582 $xml .= $this->serialize_val($k,'key',false,false,false,false,$use);
583 $xml .= $this->serialize_val($v,'value',false,false,false,false,$use);
586 $xml .= $this->serialize_val($v,$k,false,false,false,false,$use);
613 // if $this->soap_defencoding is UTF-8. Not doing this automatically allows
614 // one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1
616 …$this->debug("In serializeEnvelope length=" . strlen($body) . " body (max 1000 characters)=" . sub…
617 $this->debug("headers:");
618 $this->appendDebug($this->varDump($headers));
619 $this->debug("namespaces:");
620 $this->appendDebug($this->varDump($namespaces));
624 foreach(array_merge($this->namespaces,$namespaces) as $k => $v){
628 $ns_string = " SOAP-ENV:encodingStyle=\"$encodingStyle\"$ns_string";
636 $xml .= $this->serialize_val($header, false, false, false, false, false, $use);
639 $this->debug("In serializeEnvelope, serialzied array of headers to $headers");
641 $headers = "<SOAP-ENV:Header>".$headers."</SOAP-ENV:Header>";
645 '<?xml version="1.0" encoding="'.$this->soap_defencoding .'"?'.">".
646 '<SOAP-ENV:Envelope'.$ns_string.">".
648 "<SOAP-ENV:Body>".
650 "</SOAP-ENV:Body>".
651 "</SOAP-ENV:Envelope>";
676 //$this->xdebug("Contract $qname");
682 $p = $this->getPrefixFromNamespace($ns);
706 if(isset($this->namespaces[$prefix])){
707 return $this->namespaces[$prefix].':'.$name;
757 if (isset($this->namespaces[$prefix])) {
758 return $this->namespaces[$prefix];
760 //$this->setError("No namespace registered for prefix '$prefix'");
773 foreach ($this->namespaces as $p => $n) {
775 $this->usedNamespaces[$p] = $n;
797 return strftime('%Y-%m-%d %H:%M:%S', $sec) . '.' . sprintf('%06d', $usec);
827 $datestr = date('Y-m-d\TH:i:sO',$timestamp);
830 '([0-9]{4})-'. // centuries & years CCYY-
831 '([0-9]{2})-'. // months MM-
832 '([0-9]{2})'. // days DD
834 '([0-9]{2}):'. // hours hh:
835 '([0-9]{2}):'. // minutes mm:
836 '([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss...
837 '(Z|[+\-][0-9]{2}:?[0-9]{2})?'; // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
840 …return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs…
856 '([0-9]{4})-'. // centuries & years CCYY-
857 '([0-9]{2})-'. // months MM-
858 '([0-9]{2})'. // days DD
860 '([0-9]{2}):'. // hours hh:
861 '([0-9]{2}):'. // minutes mm:
862 '([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss...
863 '(Z|[+\-][0-9]{2}:?[0-9]{2})?'; // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
869 $m = substr($regs[8],strlen($regs[8])-2,2);
870 if($op == '-'){
874 $regs[4] = $regs[4] - $h;
875 $regs[5] = $regs[5] - $m;
878 return strtotime("$regs[1]-$regs[2]-$regs[3] $regs[4]:$regs[5]:$regs[6]Z");
898 $timePassed = 1000000 * ($stop['sec'] - $start['sec'])
899 + $stop['usec'] - $start['usec'];
952 $this->faultcode = $faultcode;
953 $this->faultactor = $faultactor;
954 $this->faultstring = $faultstring;
955 $this->faultdetail = $faultdetail;
966 foreach($this->namespaces as $k => $v){
970 '<?xml version="1.0" encoding="'.$this->soap_defencoding.'"?>'.
971 …'<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"'.$ns_string…
972 '<SOAP-ENV:Body>'.
973 '<SOAP-ENV:Fault>'.
974 $this->serialize_val($this->faultcode, 'faultcode').
975 $this->serialize_val($this->faultactor, 'faultactor').
976 $this->serialize_val($this->faultstring, 'faultstring').
977 $this->serialize_val($this->faultdetail, 'detail').
978 '</SOAP-ENV:Fault>'.
979 '</SOAP-ENV:Body>'.
980 '</SOAP-ENV:Envelope>';
994 * very experimental and limited. As is discussed on XML-DEV, I'm one of the people
1043 $this->debug('xmlschema class instantiated, inside constructor');
1045 $this->schema = $schema;
1046 $this->xml = $xml;
1049 $this->enclosingNamespaces = $namespaces;
1050 $this->namespaces = array_merge($this->namespaces, $namespaces);
1054 $this->debug('initial schema file: '.$schema);
1055 $this->parseFile($schema, 'schema');
1060 $this->debug('initial xml file: '.$xml);
1061 $this->parseFile($xml, 'xml');
1080 $this->setError($msg);
1081 $this->debug($msg);
1084 $this->debug("parsing $xml");
1085 $this->parseString($xmlStr,$type);
1086 $this->debug("done parsing $xml");
1105 $this->parser = xml_parser_create();
1107 xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
1110 xml_set_object($this->parser, $this);
1114 xml_set_element_handler($this->parser, 'schemaStartElement','schemaEndElement');
1115 xml_set_character_data_handler($this->parser,'schemaCharacterData');
1117 xml_set_element_handler($this->parser, 'xmlStartElement','xmlEndElement');
1118 xml_set_character_data_handler($this->parser,'xmlCharacterData');
1122 if(!xml_parse($this->parser,$xml,true)){
1125 xml_get_current_line_number($this->parser),
1126 xml_error_string(xml_get_error_code($this->parser))
1128 $this->debug($errstr);
1129 $this->debug("XML payload:\n" . $xml);
1130 $this->setError($errstr);
1133 xml_parser_free($this->parser);
1135 $this->debug('no xml passed to parseString()!!');
1136 $this->setError('no xml passed to parseString()!!');
1141 * start-element handler
1151 $pos = $this->position++;
1152 $depth = $this->depth++;
1154 $this->depth_array[$depth] = $pos;
1155 $this->message[$pos] = array('cdata' => '');
1157 $this->defaultNamespace[$pos] = $this->defaultNamespace[$this->depth_array[$depth - 1]];
1159 $this->defaultNamespace[$pos] = false;
1163 if($prefix = $this->getPrefix($name)){
1165 $name = $this->getLocalPart($name);
1175 //$this->xdebug("$k: $v");
1176 //$this->xdebug('ns_prefix: '.$this->getPrefix($k));
1178 //$this->xdebug("Add namespace[$ns_prefix] = $v");
1179 $this->namespaces[$ns_prefix] = $v;
1181 $this->defaultNamespace[$pos] = $v;
1182 if (! $this->getPrefixFromNamespace($v)) {
1183 $this->namespaces['ns'.(count($this->namespaces)+1)] = $v;
1187 $this->XMLSchemaVersion = $v;
1188 $this->namespaces['xsi'] = $v.'-instance';
1194 $k = strpos($k,':') ? $this->expandQname($k) : $k;
1195 $v = strpos($v,':') ? $this->expandQname($v) : $v;
1208 …//$this->xdebug("compositor $name for currentComplexType: $this->currentComplexType and currentEle…
1209 $this->complexTypes[$this->currentComplexType]['compositor'] = $name;
1211 // $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
1215 …//$this->xdebug("parsing attribute $attrs[name] $attrs[ref] of value: ".$attrs['http://schemas.xml…
1216 $this->xdebug("parsing attribute:");
1217 $this->appendDebug($this->varDump($attrs));
1219 $attrs['form'] = $this->schemaInfo['attributeFormDefault'];
1225 if ($this->defaultNamespace[$pos]) {
1227 …$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'] = $this->defaultNamespace[$pos] . ':' . $attr…
1232 $this->attributes[$attrs['name']] = $attrs;
1242 $this->attributes[$attrs['ref']] = $attrs;
1245 if($this->currentComplexType){ // This should *always* be
1246 $this->complexTypes[$this->currentComplexType]['attrs'][$aname] = $attrs;
1249 …if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']) || $this->getLocalPart($aname) == '…
1250 $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
1251 $prefix = $this->getPrefix($aname);
1258 $this->complexTypes[$this->currentComplexType]['multidimensional'] = true;
1261 if(!strpos($v,':') && isset($this->typemap[$this->XMLSchemaVersion][$v])){
1262 $v = $this->XMLSchemaVersion.':'.$v;
1264 $this->complexTypes[$this->currentComplexType]['arrayType'] = $v;
1270 array_push($this->complexTypeStack, $this->currentComplexType);
1272 $this->xdebug('processing named complexType '.$attrs['name']);
1273 //$this->currentElement = false;
1274 $this->currentComplexType = $attrs['name'];
1275 $this->complexTypes[$this->currentComplexType] = $attrs;
1276 $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType';
1285 $this->xdebug('complexType is unusual array');
1286 $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
1288 $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
1291 $this->xdebug('processing unnamed complexType for element '.$this->currentElement);
1292 $this->currentComplexType = $this->currentElement . '_ContainedType';
1293 //$this->currentElement = false;
1294 $this->complexTypes[$this->currentComplexType] = $attrs;
1295 $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType';
1304 $this->xdebug('complexType is unusual array');
1305 $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
1307 $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
1312 array_push($this->elementStack, $this->currentElement);
1314 // not really be added to $this->elements, but for some
1317 $attrs['form'] = $this->schemaInfo['elementFormDefault'];
1320 $this->xdebug("processing typed element ".$attrs['name']." of type ".$attrs['type']);
1321 if (! $this->getPrefix($attrs['type'])) {
1322 if ($this->defaultNamespace[$pos]) {
1323 $attrs['type'] = $this->defaultNamespace[$pos] . ':' . $attrs['type'];
1324 $this->xdebug('used default namespace to make type ' . $attrs['type']);
1334 …if ($this->currentComplexType && $this->complexTypes[$this->currentComplexType]['phpType'] == 'arr…
1335 $this->xdebug('arrayType for unusual array is ' . $attrs['type']);
1336 $this->complexTypes[$this->currentComplexType]['arrayType'] = $attrs['type'];
1338 $this->currentElement = $attrs['name'];
1339 $this->elements[ $attrs['name'] ] = $attrs;
1340 $this->elements[ $attrs['name'] ]['typeClass'] = 'element';
1343 $this->xdebug("processing element as ref to ".$attrs['ref']);
1344 $this->currentElement = "ref to ".$attrs['ref'];
1345 $ename = $this->getLocalPart($attrs['ref']);
1347 $this->xdebug("processing untyped element ".$attrs['name']);
1348 $this->currentElement = $attrs['name'];
1349 $this->elements[ $attrs['name'] ] = $attrs;
1350 $this->elements[ $attrs['name'] ]['typeClass'] = 'element';
1351 $attrs['type'] = $this->schemaTargetNamespace . ':' . $attrs['name'] . '_ContainedType';
1352 $this->elements[ $attrs['name'] ]['type'] = $attrs['type'];
1355 if(isset($ename) && $this->currentComplexType){
1356 $this->complexTypes[$this->currentComplexType]['elements'][$ename] = $attrs;
1360 $this->xdebug('enumeration ' . $attrs['value']);
1361 if ($this->currentSimpleType) {
1362 $this->simpleTypes[$this->currentSimpleType]['enumeration'][] = $attrs['value'];
1363 } elseif ($this->currentComplexType) {
1364 $this->complexTypes[$this->currentComplexType]['enumeration'][] = $attrs['value'];
1368 $this->xdebug('extension ' . $attrs['base']);
1369 if ($this->currentComplexType) {
1370 $this->complexTypes[$this->currentComplexType]['extensionBase'] = $attrs['base'];
1375 … //$this->xdebug('import namespace ' . $attrs['namespace'] . ' from ' . $attrs['schemaLocation']);
1376 …$this->imports[$attrs['namespace']][] = array('location' => $attrs['schemaLocation'], 'loaded' => …
1378 //$this->xdebug('import namespace ' . $attrs['namespace']);
1379 … $this->imports[$attrs['namespace']][] = array('location' => '', 'loaded' => true);
1380 if (! $this->getPrefixFromNamespace($attrs['namespace'])) {
1381 $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace'];
1388 $this->xdebug('restriction ' . $attrs['base']);
1389 if($this->currentSimpleType){
1390 $this->simpleTypes[$this->currentSimpleType]['type'] = $attrs['base'];
1391 } elseif($this->currentComplexType){
1392 $this->complexTypes[$this->currentComplexType]['restrictionBase'] = $attrs['base'];
1394 $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
1399 $this->schemaInfo = $attrs;
1400 $this->schemaInfo['schemaVersion'] = $this->getNamespaceFromPrefix($prefix);
1402 $this->schemaTargetNamespace = $attrs['targetNamespace'];
1405 $this->schemaInfo['elementFormDefault'] = 'unqualified';
1408 $this->schemaInfo['attributeFormDefault'] = 'unqualified';
1414 array_push($this->simpleTypeStack, $this->currentSimpleType);
1416 $this->xdebug("processing simpleType for name " . $attrs['name']);
1417 $this->currentSimpleType = $attrs['name'];
1418 $this->simpleTypes[ $attrs['name'] ] = $attrs;
1419 $this->simpleTypes[ $attrs['name'] ]['typeClass'] = 'simpleType';
1420 $this->simpleTypes[ $attrs['name'] ]['phpType'] = 'scalar';
1422 $this->xdebug('processing unnamed simpleType for element '.$this->currentElement);
1423 $this->currentSimpleType = $this->currentElement . '_ContainedType';
1424 //$this->currentElement = false;
1425 $this->simpleTypes[$this->currentSimpleType] = $attrs;
1426 $this->simpleTypes[$this->currentSimpleType]['phpType'] = 'scalar';
1432 //$this->xdebug("do not have anything to do for element $name");
1437 * end-element handler
1445 $this->depth--;
1447 if(isset($this->depth_array[$this->depth])){
1448 $pos = $this->depth_array[$this->depth];
1451 if ($prefix = $this->getPrefix($name)){
1453 $name = $this->getLocalPart($name);
1459 …$this->xdebug('done processing complexType ' . ($this->currentComplexType ? $this->currentComplexT…
1460 $this->currentComplexType = array_pop($this->complexTypeStack);
1461 //$this->currentElement = false;
1464 …$this->xdebug('done processing element ' . ($this->currentElement ? $this->currentElement : '(unkn…
1465 $this->currentElement = array_pop($this->elementStack);
1468 …$this->xdebug('done processing simpleType ' . ($this->currentSimpleType ? $this->currentSimpleType…
1469 $this->currentSimpleType = array_pop($this->simpleTypeStack);
1481 $pos = $this->depth_array[$this->depth - 1];
1482 $this->message[$pos]['cdata'] .= $data;
1492 $schemaPrefix = $this->getPrefixFromNamespace($this->XMLSchemaVersion);
1495 if (sizeof($this->imports) > 0) {
1496 foreach($this->imports as $ns => $list) {
1507 foreach($this->complexTypes as $typeName => $attrs){
1515 …$contentStr .= " <$schemaPrefix:element name=\"$element\" type=\"" . $this->contractQName($ePart…
1536 $contentStr .= " $a=\"".$this->contractQName($v).'"';
1538 $this->usedNamespaces['wsdl'] = $this->namespaces['wsdl'];
1539 $contentStr .= ' wsdl:arrayType="'.$this->contractQName($v).'"';
1549 …$contentStr = " <$schemaPrefix:restriction base=\"".$this->contractQName($attrs['restrictionBase…
1564 if(isset($this->simpleTypes) && count($this->simpleTypes) > 0){
1565 foreach($this->simpleTypes as $typeName => $eParts){
1566 …:simpleType name=\"$typeName\">\n <$schemaPrefix:restriction base=\"".$this->contractQName($ePart…
1576 if(isset($this->elements) && count($this->elements) > 0){
1577 foreach($this->elements as $element => $eParts){
1578 …$xml .= " <$schemaPrefix:element name=\"$element\" type=\"".$this->contractQName($eParts['type']).…
1582 if(isset($this->attributes) && count($this->attributes) > 0){
1583 foreach($this->attributes as $attr => $aParts){
1584 …$xml .= " <$schemaPrefix:attribute name=\"$attr\" type=\"".$this->contractQName($aParts['type'])."…
1588 $el = "<$schemaPrefix:schema targetNamespace=\"$this->schemaTargetNamespace\"\n";
1589 foreach (array_diff($this->usedNamespaces, $this->enclosingNamespaces) as $nsp => $ns) {
1597 * adds debug data to the clas level debug string
1599 * @param string $string debug data
1603 $this->debug('<' . $this->schemaTargetNamespace . '> '.$string);
1619 if(isset($this->typemap[$ns][$type])){
1621 return $this->typemap[$ns][$type];
1622 } elseif(isset($this->complexTypes[$type])){
1624 return $this->complexTypes[$type]['phpType'];
1652 //$this->debug("in getTypeDef for type $type");
1653 if(isset($this->complexTypes[$type])){
1654 $this->xdebug("in getTypeDef, found complexType $type");
1655 return $this->complexTypes[$type];
1656 } elseif(isset($this->simpleTypes[$type])){
1657 $this->xdebug("in getTypeDef, found simpleType $type");
1658 if (!isset($this->simpleTypes[$type]['phpType'])) {
1661 …$uqType = substr($this->simpleTypes[$type]['type'], strrpos($this->simpleTypes[$type]['type'], ':'…
1662 …$ns = substr($this->simpleTypes[$type]['type'], 0, strrpos($this->simpleTypes[$type]['type'], ':')…
1663 $etype = $this->getTypeDef($uqType);
1665 $this->xdebug("in getTypeDef, found type for simpleType $type:");
1666 $this->xdebug($this->varDump($etype));
1668 $this->simpleTypes[$type]['phpType'] = $etype['phpType'];
1671 $this->simpleTypes[$type]['elements'] = $etype['elements'];
1675 return $this->simpleTypes[$type];
1676 } elseif(isset($this->elements[$type])){
1677 $this->xdebug("in getTypeDef, found element $type");
1678 if (!isset($this->elements[$type]['phpType'])) {
1680 …$uqType = substr($this->elements[$type]['type'], strrpos($this->elements[$type]['type'], ':') + 1);
1681 $ns = substr($this->elements[$type]['type'], 0, strrpos($this->elements[$type]['type'], ':'));
1682 $etype = $this->getTypeDef($uqType);
1684 $this->xdebug("in getTypeDef, found type for element $type:");
1685 $this->xdebug($this->varDump($etype));
1687 $this->elements[$type]['phpType'] = $etype['phpType'];
1690 $this->elements[$type]['elements'] = $etype['elements'];
1693 $this->xdebug("in getTypeDef, element $type is an XSD type");
1694 $this->elements[$type]['phpType'] = 'scalar';
1697 return $this->elements[$type];
1698 } elseif(isset($this->attributes[$type])){
1699 $this->xdebug("in getTypeDef, found attribute $type");
1700 return $this->attributes[$type];
1702 $this->xdebug("in getTypeDef, have an untyped element $type");
1708 $this->xdebug("in getTypeDef, did not find $type");
1722 if($typeDef = $this->getTypeDef($type)){
1729 $str .= " xmlns=\"".$this->schema['targetNamespace']."\"";
1733 $str .= $this->serializeTypeDef($element);
1758 if($typeDef = $this->getTypeDef($type)){
1764 <tr><td align='right'>$childDef[name] (type: ".$this->getLocalPart($childDef['type'])."):</td>
1797 * 'SOAP-ENC:Array',
1798 * array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'string[]'),
1829 $this->complexTypes[$name] = array(
1840 $this->xdebug("addComplexType $name:");
1841 $this->appendDebug($this->varDump($this->complexTypes[$name]));
1857 $this->simpleTypes[$name] = array(
1865 $this->xdebug("addSimpleType $name:");
1866 $this->appendDebug($this->varDump($this->simpleTypes[$name]));
1877 if (! $this->getPrefix($attrs['type'])) {
1878 $attrs['type'] = $this->schemaTargetNamespace . ':' . $attrs['type'];
1880 $this->elements[ $attrs['name'] ] = $attrs;
1881 $this->elements[ $attrs['name'] ]['typeClass'] = 'element';
1883 $this->xdebug("addElement " . $attrs['name']);
1884 $this->appendDebug($this->varDump($this->elements[ $attrs['name'] ]));
1899 * xsd:anyType and user-defined types.
1960 …function soapval($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attribute…
1962 $this->name = $name;
1963 $this->type = $type;
1964 $this->value = $value;
1965 $this->element_ns = $element_ns;
1966 $this->type_ns = $type_ns;
1967 $this->attributes = $attributes;
1978 …return $this->serialize_val($this->value,$this->name,$this->type,$this->element_ns,$this->type_ns,…
1988 return $this->value;
2043 $this->setURL($url);
2044 ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
2045 $this->outgoing_headers['User-Agent'] = $this->title.'/'.$this->version.' ('.$rev[1].')';
2046 $this->debug('set User-Agent: ' . $this->outgoing_headers['User-Agent']);
2050 $this->url = $url;
2054 $this->debug("$k = $v");
2055 $this->$k = $v;
2060 $this->path .= '?' . $u['query'];
2066 $this->port = 443;
2068 $this->port = 80;
2072 $this->uri = $this->path;
2073 $this->digest_uri = $this->uri;
2077 $this->outgoing_headers['Host'] = $this->host;
2079 $this->outgoing_headers['Host'] = $this->host.':'.$this->port;
2081 $this->debug('set Host: ' . $this->outgoing_headers['Host']);
2084 $this->setCredentials(urldecode($u['user']), isset($u['pass']) ? urldecode($u['pass']) : '');
2093 // if ($this->scheme == 'https') {
2096 // $this->scheme = 'ssl';
2097 // $this->debug('Using SSL over OpenSSL');
2101 …this->debug("connect connection_timeout $connection_timeout, response_timeout $response_timeout, s…
2102 if ($this->scheme == 'http' || $this->scheme == 'ssl') {
2104 if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){
2105 if (!feof($this->fp)) {
2106 $this->debug('Re-use persistent connection');
2109 fclose($this->fp);
2110 $this->debug('Closed persistent connection at EOF');
2114 if ($this->scheme == 'ssl') {
2115 $host = 'ssl://' . $this->host;
2117 $host = $this->host;
2119 …$this->debug('calling fsockopen with host ' . $host . ' connection_timeout ' . $connection_timeout…
2123 $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout);
2125 $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str);
2129 if(!$this->fp) {
2130 $msg = 'Couldn\'t open socket connection to server ' . $this->url;
2131 if ($this->errno) {
2132 $msg .= ', Error ('.$this->errno.'): '.$this->error_str;
2136 $this->debug($msg);
2137 $this->setError($msg);
2142 $this->debug('set response timeout to ' . $response_timeout);
2143 socket_set_timeout( $this->fp, $response_timeout);
2145 $this->debug('socket connected');
2147 } else if ($this->scheme == 'https') {
2149 …$this->setError('CURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS'…
2152 $this->debug('connect using https');
2154 $this->ch = curl_init();
2156 $hostURL = ($this->port != '') ? "https://$this->host:$this->port" : "https://$this->host";
2158 $hostURL .= $this->path;
2159 curl_setopt($this->ch, CURLOPT_URL, $hostURL);
2160 // follow location headers (re-directs)
2161 curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1);
2163 curl_setopt($this->ch, CURLOPT_HEADER, 1);
2165 curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
2169 // curl_setopt($this->ch, CURLOPT_ENCODING, 'deflate');
2172 if ($this->persistentConnection) {
2175 //curl_setopt($this->ch, CURL_HTTP_VERSION_1_1, true);
2176 $this->persistentConnection = false;
2177 $this->outgoing_headers['Connection'] = 'close';
2178 $this->debug('set Connection: ' . $this->outgoing_headers['Connection']);
2182 curl_setopt($this->ch, CURLOPT_TIMEOUT, $connection_timeout);
2186 // curl_setopt($this->ch, CURLOPT_CONNECTIONTIMEOUT, $connection_timeout);
2189 // curl_setopt($this->ch, CURLOPT_TIMEOUT, $response_timeout);
2195 //curl_setopt($this->ch, CURLOPT_CAINFO, 'f:\php-4.3.2-win32\extensions\curl-ca-bundle.crt');
2196 curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 0);
2197 curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 0);
2200 if ($this->authtype == 'certificate') {
2201 if (isset($this->certRequest['cainfofile'])) {
2202 curl_setopt($this->ch, CURLOPT_CAINFO, $this->certRequest['cainfofile']);
2204 if (isset($this->certRequest['verifypeer'])) {
2205 curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, $this->certRequest['verifypeer']);
2207 curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 1);
2209 if (isset($this->certRequest['verifyhost'])) {
2210 curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, $this->certRequest['verifyhost']);
2212 curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 1);
2214 if (isset($this->certRequest['sslcertfile'])) {
2215 curl_setopt($this->ch, CURLOPT_SSLCERT, $this->certRequest['sslcertfile']);
2217 if (isset($this->certRequest['sslkeyfile'])) {
2218 curl_setopt($this->ch, CURLOPT_SSLKEY, $this->certRequest['sslkeyfile']);
2220 if (isset($this->certRequest['passphrase'])) {
2221 curl_setopt($this->ch, CURLOPT_SSLKEYPASSWD , $this->certRequest['passphrase']);
2224 $this->debug('cURL connection set up');
2227 $this->setError('Unknown scheme ' . $this->scheme);
2228 $this->debug('Unknown scheme ' . $this->scheme);
2245 $this->debug('entered send() with data of length: '.strlen($data));
2247 $this->tryagain = true;
2249 while ($this->tryagain) {
2250 $this->tryagain = false;
2253 if (!$this->connect($timeout, $response_timeout)){
2258 if (!$this->sendRequest($data, $cookies)){
2263 $respdata = $this->getResponse();
2265 $this->setError('Too many tries to get an OK response');
2268 $this->debug('end of send()');
2284 return $this->send($data, $timeout, $response_timeout, $cookies);
2298 $this->debug("Set credentials for authtype $authtype");
2301 …$this->outgoing_headers['Authorization'] = 'Basic '.base64_encode(str_replace(':','',$username).':…
2308 // A1 = unq(username-value) ":" unq(realm-value) ":" passwd
2314 // A2 = Method ":" digest-uri-value
2315 $A2 = 'POST:' . $this->digest_uri;
2322 // request-digest = <"> < KD ( H(A1), unq(nonce-value)
2323 // ":" nc-value
2324 // ":" unq(cnonce-value)
2325 // ":" unq(qop-value)
2329 // request-digest = <"> < KD ( H(A1), unq(nonce-value) ":" H(A2) ) > <">
2342->outgoing_headers['Authorization'] = 'Digest username="' . $username . '", realm="' . $digestRequ…
2345 $this->certRequest = $certRequest;
2347 $this->username = $username;
2348 $this->password = $password;
2349 $this->authtype = $authtype;
2350 $this->digestRequest = $digestRequest;
2352 if (isset($this->outgoing_headers['Authorization'])) {
2353 …$this->debug('set Authorization: ' . substr($this->outgoing_headers['Authorization'], 0, 12) . '..…
2355 $this->debug('Authorization header not set');
2366 $this->outgoing_headers['SOAPAction'] = '"' . $soapaction . '"';
2367 $this->debug('set SOAPAction: ' . $this->outgoing_headers['SOAPAction']);
2378 $this->protocol_version = '1.1';
2379 $this->outgoing_headers['Accept-Encoding'] = $enc;
2380 $this->debug('set Accept-Encoding: ' . $this->outgoing_headers['Accept-Encoding']);
2381 if (!isset($this->outgoing_headers['Connection'])) {
2382 $this->outgoing_headers['Connection'] = 'close';
2383 $this->persistentConnection = false;
2384 $this->debug('set Connection: ' . $this->outgoing_headers['Connection']);
2388 $this->encoding = $enc;
2402 $this->uri = $this->url;
2403 $this->host = $proxyhost;
2404 $this->port = $proxyport;
2406 …$this->outgoing_headers['Proxy-Authorization'] = ' Basic '.base64_encode($proxyusername.':'.$proxy…
2407 $this->debug('set Proxy-Authorization: ' . $this->outgoing_headers['Proxy-Authorization']);
2426 // read chunk-size, chunk-extension (if any) and CRLF
2430 $this->debug('no linebreak found in decodeChunked');
2436 // while (chunk-size > 0) {
2438 $this->debug("chunkstart: $chunkstart chunk_size: $chunk_size");
2444 // append chunk-data to entity-body
2450 // read chunk-data and CRLF
2451 $chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart);
2452 // append chunk-data to entity-body
2454 // length := length + chunk-size
2456 // read chunk-size and CRLF
2463 $temp = substr($buffer,$chunkstart,$chunkend-$chunkstart);
2471 * Writes payload, including HTTP headers, to $this->outgoing_payload.
2474 // add content-length header
2475 $this->outgoing_headers['Content-Length'] = strlen($data);
2476 $this->debug('set Content-Length: ' . $this->outgoing_headers['Content-Length']);
2479 $req = "$this->request_method $this->uri HTTP/$this->protocol_version";
2480 $this->debug("HTTP request: $req");
2481 $this->outgoing_payload = "$req\r\n";
2484 foreach($this->outgoing_headers as $k => $v){
2486 $this->debug("HTTP header: $hdr");
2487 $this->outgoing_payload .= "$hdr\r\n";
2493 $this->debug("HTTP header: $hdr");
2494 $this->outgoing_payload .= "$hdr\r\n";
2498 $this->outgoing_payload .= "\r\n";
2501 $this->outgoing_payload .= $data;
2506 …$cookie_str = $this->getCookiesForRequest($cookies, (($this->scheme == 'ssl') || ($this->scheme ==…
2509 $this->buildPayload($data, $cookie_str);
2511 if ($this->scheme == 'http' || $this->scheme == 'ssl') {
2513 if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) {
2514 $this->setError('couldn\'t write message data to socket');
2515 $this->debug('couldn\'t write message data to socket');
2518 $this->debug('wrote data to socket, length = ' . strlen($this->outgoing_payload));
2520 } else if ($this->scheme == 'https') {
2525 //curl_setopt($this->ch, CURLOPT_CUSTOMREQUEST, $this->outgoing_payload);
2526 foreach($this->outgoing_headers as $k => $v){
2532 curl_setopt($this->ch, CURLOPT_HTTPHEADER, $curl_headers);
2533 if ($this->request_method == "POST") {
2534 curl_setopt($this->ch, CURLOPT_POST, 1);
2535 curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data);
2538 $this->debug('set cURL payload');
2544 $this->incoming_payload = '';
2546 if ($this->scheme == 'http' || $this->scheme == 'ssl') {
2552 if(feof($this->fp)) {
2553 $this->incoming_payload = $data;
2554 $this->debug('found no headers before EOF after length ' . strlen($data));
2555 $this->debug("received before EOF:\n" . $data);
2556 $this->setError('server failed to send headers');
2560 $tmp = fgets($this->fp, 256);
2562 $this->debug("read line of $tmplen bytes: " . trim($tmp));
2565 $this->incoming_payload = $data;
2566 $this->debug('socket read of headers timed out after length ' . strlen($data));
2567 $this->debug("read before timeout: " . $data);
2568 $this->setError('socket read of headers timed out');
2589 $this->incoming_payload .= $data;
2590 $this->debug('found end of headers after length ' . strlen($data));
2594 $this->incoming_headers = array();
2595 $this->incoming_cookies = array();
2600 $this->incoming_headers[$header_name] = trim($arr[1]);
2601 if ($header_name == 'set-cookie') {
2603 $cookie = $this->parseCookie(trim($arr[1]));
2605 $this->incoming_cookies[] = $cookie;
2606 $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
2608 $this->debug('did not find cookie in ' . trim($arr[1]));
2613 $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
2618 …if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['tra…
2619 $content_length = 2147483647; // ignore any content-length header
2621 $this->debug("want to read chunked content");
2622 } elseif (isset($this->incoming_headers['content-length'])) {
2623 $content_length = $this->incoming_headers['content-length'];
2625 $this->debug("want to read content of length $content_length");
2629 $this->debug("want to read content to EOF");
2634 $tmp = fgets($this->fp, 256);
2636 $this->debug("read chunk line of $tmplen bytes");
2638 $this->incoming_payload = $data;
2639 $this->debug('socket read of chunk length timed out after length ' . strlen($data));
2640 $this->debug("read before timeout:\n" . $data);
2641 $this->setError('socket read of chunk length timed out');
2645 $this->debug("chunk length $content_length");
2648 while (($strlen < $content_length) && (!feof($this->fp))) {
2649 $readlen = min(8192, $content_length - $strlen);
2650 $tmp = fread($this->fp, $readlen);
2652 $this->debug("read buffer of $tmplen bytes");
2653 if (($tmplen == 0) && (!feof($this->fp))) {
2654 $this->incoming_payload = $data;
2655 $this->debug('socket read of body timed out after length ' . strlen($data));
2656 $this->debug("read before timeout:\n" . $data);
2657 $this->setError('socket read of body timed out');
2664 $tmp = fgets($this->fp, 256);
2666 $this->debug("read chunk terminator of $tmplen bytes");
2668 $this->incoming_payload = $data;
2669 $this->debug('socket read of chunk terminator timed out after length ' . strlen($data));
2670 $this->debug("read before timeout:\n" . $data);
2671 $this->setError('socket read of chunk terminator timed out');
2675 } while ($chunked && ($content_length > 0) && (!feof($this->fp)));
2676 if (feof($this->fp)) {
2677 $this->debug('read to EOF');
2679 $this->debug('read body of length ' . strlen($data));
2680 $this->incoming_payload .= $data;
2681 $this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server');
2685 …(isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection'])…
2686 (! $this->persistentConnection) || feof($this->fp)){
2687 fclose($this->fp);
2688 $this->fp = false;
2689 $this->debug('closed socket');
2693 if($this->incoming_payload == ''){
2694 $this->setError('no response from server');
2698 // decode transfer-encoding
2699 // if(isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['t…
2700 // if(!$data = $this->decodeChunked($data, $lb)){
2701 // $this->setError('Decoding of chunked data failed');
2704 //print "<pre>\nde-chunked:\n---------------\n$data\n\n---------------\n</pre>";
2706 // $this->incoming_payload = $header_data.$lb.$lb.$data;
2709 } else if ($this->scheme == 'https') {
2711 $this->debug('send and receive with cURL');
2712 $this->incoming_payload = curl_exec($this->ch);
2713 $data = $this->incoming_payload;
2715 $cErr = curl_error($this->ch);
2717 $err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'<br>';
2719 foreach(curl_getinfo($this->ch) as $k => $v){
2722 $this->debug($err);
2723 $this->setError($err);
2724 curl_close($this->ch);
2728 //var_dump(curl_getinfo($this->ch));
2732 $this->debug('No cURL error, closing cURL');
2733 curl_close($this->ch);
2750 $this->debug('no proper separation of headers and document');
2751 $this->setError('no proper separation of headers and document');
2757 $this->debug('found proper separation of headers and document');
2758 $this->debug('cleaned data, stringlen: '.strlen($data));
2764 $this->incoming_headers[$header_name] = trim($arr[1]);
2765 if ($header_name == 'set-cookie') {
2767 $cookie = $this->parseCookie(trim($arr[1]));
2769 $this->incoming_cookies[] = $cookie;
2770 $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
2772 $this->debug('did not find cookie in ' . trim($arr[1]));
2777 $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
2788 if (isset($this->incoming_headers['location']) && $http_status == 301) {
2789 $this->debug("Got 301 $http_reason with Location: " . $this->incoming_headers['location']);
2790 $this->setURL($this->incoming_headers['location']);
2791 $this->tryagain = true;
2796 if (isset($this->incoming_headers['www-authenticate']) && $http_status == 401) {
2797 …$this->debug("Got 401 $http_reason with WWW-Authenticate: " . $this->incoming_headers['www-authent…
2798 if (strstr($this->incoming_headers['www-authenticate'], "Digest ")) {
2799 $this->debug('Server wants digest authentication');
2801 $digestString = str_replace('Digest ', '', $this->incoming_headers['www-authenticate']);
2812 $this->setCredentials($this->username, $this->password, 'digest', $digestRequest);
2813 $this->tryagain = true;
2817 $this->debug('HTTP authentication failed');
2818 $this->setError('HTTP authentication failed');
2827 …$this->setError("Unsupported HTTP response status $http_status $http_reason (soapclient->response …
2831 // decode content-encoding
2832 …if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding…
2833 …if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incom…
2836 //$timer->setMarker('starting decoding of gzip/deflated content');
2839 $this->debug('The gzinflate function exists');
2841 if ($this->incoming_headers['content-encoding'] == 'deflate') {
2844 $this->debug('The payload has been inflated to ' . strlen($data) . ' bytes');
2847 $this->debug('The inflated payload is smaller than the gzipped one; try again');
2850 $this->debug('The payload has been inflated again to ' . strlen($data) . ' bytes');
2854 $this->debug('Error using gzinflate to inflate the payload');
2855 $this->setError('Error using gzinflate to inflate the payload');
2857 } elseif ($this->incoming_headers['content-encoding'] == 'gzip') {
2860 $this->debug('The payload has been un-gzipped to ' . strlen($data) . ' bytes');
2863 $this->debug('The un-gzipped payload is smaller than the gzipped one; try again');
2866 $this->debug('The payload has been un-gzipped again to ' . strlen($data) . ' bytes');
2870 $this->debug('Error using gzinflate to un-gzip the payload');
2871 $this->setError('Error using gzinflate to un-gzip the payload');
2874 //$timer->setMarker('finished decoding of gzip/deflated content');
2875 //print "<xmp>\nde-inflated:\n---------------\n$data\n-------------\n</xmp>";
2877 $this->incoming_payload = $header_data.$lb.$lb.$data;
2879 …$this->debug('The server sent compressed data. Your php install must have the Zlib extension compi…
2880 …$this->setError('The server sent compressed data. Your php install must have the Zlib extension co…
2883 $this->debug('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']);
2884 $this->setError('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']);
2887 $this->debug('No Content-Encoding header');
2891 $this->debug('no data after headers!');
2892 $this->setError('no data present after HTTP headers');
2900 $this->outgoing_headers['Content-Type'] = $type . ($charset ? '; charset=' . $charset : '');
2901 $this->debug('set Content-Type: ' . $this->outgoing_headers['Content-Type']);
2905 if (isset($this->outgoing_headers['Accept-Encoding'])) {
2908 $this->protocol_version = '1.1';
2909 $this->persistentConnection = true;
2910 $this->outgoing_headers['Connection'] = 'Keep-Alive';
2911 $this->debug('set Connection: ' . $this->outgoing_headers['Connection']);
2923 * TODO: allow a Set-Cookie string to be parsed into multiple cookies
2985 * @param boolean $secure is the send-content secure or not?
2986 * @return string for Cookie-HTTP-Header
2996 $this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']);
2999 $this->debug('cookie has expired');
3005 if (! preg_match("'.*$domain$'i", $this->host)) {
3006 $this->debug('cookie has different domain');
3012 if (! preg_match("'^$path.*'i", $this->path)) {
3013 $this->debug('cookie is for a different path');
3018 $this->debug('cookie is secure, transport is not');
3022 $this->debug('add cookie to Cookie-String: ' . $cookie['name'] . '=' . $cookie['value']);
3181 * whether to append debug to response as XML comment
3198 global $debug;
3202 $this->debug("_SERVER is defined:");
3203 $this->appendDebug($this->varDump($_SERVER));
3205 $this->debug("HTTP_SERVER_VARS is defined:");
3206 $this->appendDebug($this->varDump($HTTP_SERVER_VARS));
3208 $this->debug("Neither _SERVER nor HTTP_SERVER_VARS is defined.");
3211 if (isset($debug)) {
3212 $this->debug("In soap_server, set debug_flag=$debug based on global flag");
3213 $this->debug_flag = $debug;
3217 if (substr($v, 0, 6) == 'debug=') {
3218 $this->debug("In soap_server, set debug_flag=" . substr($v, 6) . " based on query string #1");
3219 $this->debug_flag = substr($v, 6);
3225 if (substr($v, 0, 6) == 'debug=') {
3226 $this->debug("In soap_server, set debug_flag=" . substr($v, 6) . " based on query string #2");
3227 $this->debug_flag = substr($v, 6);
3234 $this->debug("In soap_server, WSDL is specified");
3236 $this->wsdl = $wsdl;
3237 $this->externalWSDLURL = $this->wsdl->wsdl;
3238 $this->debug('Use existing wsdl instance from ' . $this->externalWSDLURL);
3240 $this->debug('Create wsdl from ' . $wsdl);
3241 $this->wsdl = new wsdl($wsdl);
3242 $this->externalWSDLURL = $wsdl;
3244 $this->appendDebug($this->wsdl->getDebug());
3245 $this->wsdl->clearDebug();
3246 if($err = $this->wsdl->getError()){
3268 $this->debug("In service, query string=$qs");
3271 $this->debug("In service, this is a request for WSDL");
3272 if($this->externalWSDLURL){
3273 if (strpos($this->externalWSDLURL,"://")!==false) { // assume URL
3274 header('Location: '.$this->externalWSDLURL);
3276 header("Content-Type: text/xml\r\n");
3277 $fp = fopen($this->externalWSDLURL, 'r');
3280 } elseif ($this->wsdl) {
3281 header("Content-Type: text/xml; charset=ISO-8859-1\r\n");
3282 print $this->wsdl->serialize($this->debug_flag);
3283 if ($this->debug_flag) {
3284 $this->debug('wsdl:');
3285 $this->appendDebug($this->varDump($this->wsdl));
3286 print $this->getDebugAsXMLComment();
3289 header("Content-Type: text/html; charset=ISO-8859-1\r\n");
3292 } elseif ($data == '' && $this->wsdl) {
3293 $this->debug("In service, there is no data, so return Web description");
3294 print $this->wsdl->webDescription();
3296 $this->debug("In service, invoke the request");
3297 $this->parse_request($data);
3298 if (! $this->fault) {
3299 $this->invoke_method();
3301 if (! $this->fault) {
3302 $this->serialize_return();
3304 $this->send_response();
3323 $this->request = '';
3324 $this->SOAPAction = '';
3326 $this->debug("In parse_http_headers, use getallheaders");
3330 $this->headers[$k] = $v;
3331 $this->request .= "$k: $v\r\n";
3332 $this->debug("$k: $v");
3335 if(isset($this->headers['soapaction'])){
3336 $this->SOAPAction = str_replace('"','',$this->headers['soapaction']);
3339 if(isset($this->headers['content-type']) && strpos($this->headers['content-type'],'=')){
3340 $enc = str_replace('"','',substr(strstr($this->headers["content-type"],'='),1));
3341 if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
3342 $this->xml_encoding = strtoupper($enc);
3344 $this->xml_encoding = 'US-ASCII';
3347 // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
3348 $this->xml_encoding = 'ISO-8859-1';
3351 $this->debug("In parse_http_headers, use _SERVER");
3354 …$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); …
3356 …$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); …
3363 $this->SOAPAction = $v;
3364 } else if ($k == 'content-type') {
3370 if (eregi('^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
3371 $this->xml_encoding = strtoupper($enc);
3373 $this->xml_encoding = 'US-ASCII';
3376 // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
3377 $this->xml_encoding = 'ISO-8859-1';
3380 $this->headers[$k] = $v;
3381 $this->request .= "$k: $v\r\n";
3382 $this->debug("$k: $v");
3385 $this->debug("In parse_http_headers, use HTTP_SERVER_VARS");
3388 …$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); …
3390 …$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); …
3397 $this->SOAPAction = $v;
3398 } else if ($k == 'content-type') {
3404 if (eregi('^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
3405 $this->xml_encoding = strtoupper($enc);
3407 $this->xml_encoding = 'US-ASCII';
3410 // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
3411 $this->xml_encoding = 'ISO-8859-1';
3414 $this->headers[$k] = $v;
3415 $this->request .= "$k: $v\r\n";
3416 $this->debug("$k: $v");
3419 $this->debug("In parse_http_headers, HTTP headers not accessible");
3420 $this->setError("HTTP headers not accessible");
3447 $this->debug('entering parse_request()');
3448 $this->parse_http_headers();
3449 $this->debug('got character encoding: '.$this->xml_encoding);
3451 if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] != '') {
3452 $this->debug('got content encoding: ' . $this->headers['content-encoding']);
3453 …if ($this->headers['content-encoding'] == 'deflate' || $this->headers['content-encoding'] == 'gzip…
3456 if ($this->headers['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) {
3458 …} elseif ($this->headers['content-encoding'] == 'gzip' && $degzdata = gzinflate(substr($data, 10))…
3461 $this->fault('Client', 'Errors occurred when trying to decode the data');
3465 $this->fault('Client', 'This Server does not support compressed data');
3470 $this->request .= "\r\n".$data;
3471 $data = $this->parseRequest($this->headers, $data);
3472 $this->requestSOAP = $data;
3473 $this->debug('leaving parse_request');
3494 …$this->debug('in invoke_method, methodname=' . $this->methodname . ' methodURI=' . $this->methodUR…
3496 if ($this->wsdl) {
3497 if ($this->opData = $this->wsdl->getOperationData($this->methodname)) {
3498 $this->debug('in invoke_method, found WSDL operation=' . $this->methodname);
3499 $this->appendDebug('opData=' . $this->varDump($this->opData));
3500 } elseif ($this->opData = $this->wsdl->getOperationDataForSoapAction($this->SOAPAction)) {
3502 …$this->debug('in invoke_method, found WSDL soapAction=' . $this->SOAPAction . ' for operation=' . …
3503 $this->appendDebug('opData=' . $this->varDump($this->opData));
3504 $this->methodname = $this->opData['name'];
3506 $this->debug('in invoke_method, no WSDL for operation=' . $this->methodname);
3507 …$this->fault('Client', "Operation '" . $this->methodname . "' is not defined in the WSDL for this …
3511 $this->debug('in invoke_method, no WSDL to validate method');
3514 // if a . is present in $this->methodname, we see if there is a class in scope,
3519 if (strpos($this->methodname, '..') > 0) {
3521 } else if (strpos($this->methodname, '.') > 0) {
3527 if (strlen($delim) > 0 && substr_count($this->methodname, $delim) == 1 &&
3528 class_exists(substr($this->methodname, 0, strpos($this->methodname, $delim)))) {
3530 $class = substr($this->methodname, 0, strpos($this->methodname, $delim));
3531 $method = substr($this->methodname, strpos($this->methodname, $delim) + strlen($delim));
3532 $this->debug("in invoke_method, class=$class method=$method delim=$delim");
3537 if (!function_exists($this->methodname)) {
3538 $this->debug("in invoke_method, function '$this->methodname' not found!");
3539 $this->result = 'fault: method not found';
3540 $this->fault('Client',"method '$this->methodname' not defined in service");
3546 $this->debug("in invoke_method, method '$this->methodname' not found in class '$class'!");
3547 $this->result = 'fault: method not found';
3548 $this->fault('Client',"method '$this->methodname' not defined in service");
3555 if(! $this->verify_method($this->methodname,$this->methodparams)){
3556 // debug
3557 $this->debug('ERROR: request not verified against method signature');
3558 $this->result = 'fault: request failed validation against method signature';
3560 $this->fault('Client',"Operation '$this->methodname' not defined in service.");
3565 $this->debug('in invoke_method, params:');
3566 $this->appendDebug($this->varDump($this->methodparams));
3567 $this->debug("in invoke_method, calling '$this->methodname'");
3570 $this->debug('in invoke_method, calling function using eval()');
3571 $funcCall = "\$this->methodreturn = $this->methodname(";
3574 $this->debug('in invoke_method, calling class method using eval()');
3575 $funcCall = "\$this->methodreturn = ".$class."::".$method."(";
3577 $this->debug('in invoke_method, calling instance method using eval()');
3581 $funcCall .= "\$this->methodreturn = ".$instname."->".$method."(";
3584 if ($this->methodparams) {
3585 foreach ($this->methodparams as $param) {
3587 …$this->fault('Client', 'NuSOAP does not handle complexType parameters correctly when using eval; c…
3592 $funcCall = substr($funcCall, 0, -1);
3595 $this->debug('in invoke_method, function call: '.$funcCall);
3599 $this->debug('in invoke_method, calling function using call_user_func_array()');
3600 …$call_arg = "$this->methodname"; // straight assignment changes $this->methodname to lower case af…
3602 $this->debug('in invoke_method, calling class method using call_user_func_array()');
3605 $this->debug('in invoke_method, calling instance method using call_user_func_array()');
3609 $this->methodreturn = call_user_func_array($call_arg, $this->methodparams);
3611 $this->debug('in invoke_method, methodreturn:');
3612 $this->appendDebug($this->varDump($this->methodreturn));
3613 …$this->debug("in invoke_method, called method $this->methodname, received $this->methodreturn of t…
3628 …$this->debug('Entering serialize_return methodname: ' . $this->methodname . ' methodURI: ' . $this
3630 if (isset($this->methodreturn) && (get_class($this->methodreturn) == 'soap_fault')) {
3631 $this->debug('got a fault object from method');
3632 $this->fault = $this->methodreturn;
3634 } elseif ($this->methodreturnisliteralxml) {
3635 $return_val = $this->methodreturn;
3638 $this->debug('got a(n) '.gettype($this->methodreturn).' from method');
3639 $this->debug('serializing return value');
3640 if($this->wsdl){
3642 if(sizeof($this->opData['output']['parts']) > 1){
3643 $opParams = $this->methodreturn;
3646 $opParams = array($this->methodreturn);
3648 $return_val = $this->wsdl->serializeRPCParameters($this->methodname,'output',$opParams);
3649 $this->appendDebug($this->wsdl->getDebug());
3650 $this->wsdl->clearDebug();
3651 if($errstr = $this->wsdl->getError()){
3652 $this->debug('got wsdl error: '.$errstr);
3653 $this->fault('Server', 'unable to serialize result');
3657 if (isset($this->methodreturn)) {
3658 $return_val = $this->serialize_val($this->methodreturn, 'return');
3661 $this->debug('in absence of WSDL, assume void return for backward compatibility');
3665 $this->debug('return value:');
3666 $this->appendDebug($this->varDump($return_val));
3668 $this->debug('serializing response');
3669 if ($this->wsdl) {
3670 $this->debug('have WSDL for serialization: style is ' . $this->opData['style']);
3671 if ($this->opData['style'] == 'rpc') {
3672 $this->debug('style is rpc for serialization: use is ' . $this->opData['output']['use']);
3673 if ($this->opData['output']['use'] == 'literal') {
3674 …$payload = '<'.$this->methodname.'Response xmlns="'.$this->methodURI.'">'.$return_val.'</'.$this->…
3676 …$payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</n…
3679 $this->debug('style is not rpc for serialization: assume document');
3683 $this->debug('do not have WSDL for serialization: assume rpc/encoded');
3684 …$payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</n…
3686 $this->result = 'successful';
3687 if($this->wsdl){
3688 //if($this->debug_flag){
3689 $this->appendDebug($this->wsdl->getDebug());
3697 …$this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders,$this->wsdl->usedNa…
3699 $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders);
3701 $this->debug("Leaving serialize_return");
3715 $this->debug('Enter send_response');
3716 if ($this->fault) {
3717 $payload = $this->fault->serialize();
3718 $this->outgoing_headers[] = "HTTP/1.0 500 Internal Server Error";
3719 $this->outgoing_headers[] = "Status: 500 Internal Server Error";
3721 $payload = $this->responseSOAP;
3725 // $this->outgoing_headers[] = "HTTP/1.0 200 OK";
3726 // $this->outgoing_headers[] = "Status: 200 OK";
3728 // add debug data if in debug mode
3729 if(isset($this->debug_flag) && $this->debug_flag){
3730 $payload .= $this->getDebugAsXMLComment();
3732 $this->outgoing_headers[] = "Server: $this->title Server v$this->version";
3733 ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
3734 $this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")";
3736 //$this->outgoing_headers[] = "Connection: Close\r\n";
3737 $payload = $this->getHTTPBody($payload);
3738 $type = $this->getHTTPContentType();
3739 $charset = $this->getHTTPContentTypeCharset();
3740 $this->outgoing_headers[] = "Content-Type: $type" . ($charset ? '; charset=' . $charset : '');
3741 //begin code to compress payload - by John
3744 …if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) …
3745 if (strstr($this->headers['accept-encoding'], 'gzip')) {
3747 if (isset($this->debug_flag) && $this->debug_flag) {
3748 $payload .= "<!-- Content being gzipped -->";
3750 $this->outgoing_headers[] = "Content-Encoding: gzip";
3753 if (isset($this->debug_flag) && $this->debug_flag) {
3754 $payload .= "<!-- Content will not be gzipped: no gzencode -->";
3757 } elseif (strstr($this->headers['accept-encoding'], 'deflate')) {
3760 …// which conflicts with HTTP 1.1 spec (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.…
3762 if (isset($this->debug_flag) && $this->debug_flag) {
3763 $payload .= "<!-- Content being deflated -->";
3765 $this->outgoing_headers[] = "Content-Encoding: deflate";
3768 if (isset($this->debug_flag) && $this->debug_flag) {
3769 $payload .= "<!-- Content will not be deflated: no gzcompress -->";
3775 $this->outgoing_headers[] = "Content-Length: ".strlen($payload);
3776 reset($this->outgoing_headers);
3777 foreach($this->outgoing_headers as $hdr){
3781 $this->response = join("\r\n",$this->outgoing_headers)."\r\n\r\n".$payload;
3794 if(isset($this->wsdl) && is_object($this->wsdl)){
3795 if($this->wsdl->getOperationData($operation)){
3798 } elseif(isset($this->operations[$operation])){
3813 …$this->debug('Entering parseRequest() for data of length ' . strlen($data) . ' and type ' . $heade…
3814 if (!strstr($headers['content-type'], 'text/xml')) {
3815 $this->setError('Request not of type text/xml');
3818 if (strpos($headers['content-type'], '=')) {
3819 $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
3820 $this->debug('Got response encoding: ' . $enc);
3821 if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
3822 $this->xml_encoding = strtoupper($enc);
3824 $this->xml_encoding = 'US-ASCII';
3827 // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
3828 $this->xml_encoding = 'ISO-8859-1';
3830 $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating soap_parser');
3832 $parser = new soap_parser($data,$this->xml_encoding,'',$this->decode_utf8);
3833 // parser debug
3834 $this->debug("parser debug: \n".$parser->getDebug());
3836 if($err = $parser->getError()){
3837 $this->result = 'fault: error in msg parsing: '.$err;
3838 $this->fault('Client',"error in msg parsing:\n".$err);
3842 $this->methodURI = $parser->root_struct_namespace;
3843 $this->methodname = $parser->root_struct_name;
3844 $this->debug('methodname: '.$this->methodname.' methodURI: '.$this->methodURI);
3845 $this->debug('calling parser->get_response()');
3846 $this->methodparams = $parser->get_response();
3848 $this->requestHeaders = $parser->getHeaders();
3850 $this->document = $parser->document;
3879 * returns false for non-text content types.
3887 return $this->soap_defencoding;
3900 $this->operations[$methodname] = array('name' => $methodname,'in' => $in,'out' => $out);
3920 if($this->externalWSDLURL){
3942 $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
3956 $this->operations[$name] = array(
3963 if($this->wsdl){
3964 …$this->wsdl->addOperation($name,$in,$out,$namespace,$soapaction,$style,$use,$documentation,$encodi…
3980 if ($faultdetail == '' && $this->debug_flag) {
3981 $faultdetail = $this->getDebug();
3983 $this->fault = new soap_fault($faultcode,$faultactor,$faultstring,$faultdetail);
3984 $this->fault->soap_defencoding = $this->soap_defencoding;
4013 $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
4037 $this->wsdl = new wsdl;
4038 $this->wsdl->serviceName = $serviceName;
4039 $this->wsdl->endpoint = $endpoint;
4040 $this->wsdl->namespaces['tns'] = $namespace;
4041 $this->wsdl->namespaces['soap'] = 'http://schemas.xmlsoap.org/wsdl/soap/';
4042 $this->wsdl->namespaces['wsdl'] = 'http://schemas.xmlsoap.org/wsdl/';
4044 $this->wsdl->namespaces['types'] = $schemaTargetNamespace;
4046 … $this->wsdl->schemas[$schemaTargetNamespace][0] = new xmlschema('', '', $this->wsdl->namespaces);
4047 … $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaTargetNamespace = $schemaTargetNamespace;
4048 …$this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/soap/encoding…
4049 …$this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/wsdl/'][0] = …
4050 $this->wsdl->bindings[$serviceName.'Binding'] = array(
4055 $this->wsdl->ports[$serviceName.'Port'] = array(
4125 $this->wsdl = $wsdl;
4126 $this->proxyhost = $proxyhost;
4127 $this->proxyport = $proxyport;
4128 $this->proxyusername = $proxyusername;
4129 $this->proxypassword = $proxypassword;
4130 $this->timeout = $timeout;
4131 $this->response_timeout = $response_timeout;
4135 $this->debug('initial wsdl URL: ' . $wsdl);
4136 $this->parseWSDL($wsdl);
4139 // TODO: handle imports more properly, grabbing them in-line and nesting them
4145 foreach ($this->schemas as $ns => $list) {
4147 $wsdlparts = parse_url($this->wsdl); // this is bogusly simple!
4148 foreach ($xs->imports as $ns2 => $list2) {
4151 $this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true;
4160 $this->parseWSDL($url);
4165 $this->debug("Unexpected scenario: empty URL for unloaded import");
4173 $wsdlparts = parse_url($this->wsdl); // this is bogusly simple!
4174 foreach ($this->import as $ns => $list) {
4177 $this->import[$ns][$ii]['loaded'] = true;
4186 $this->parseWSDL($url);
4191 $this->debug("Unexpected scenario: empty URL for unloaded import");
4198 foreach($this->bindings as $binding => $bindingData) {
4201 $this->debug('post-parse data gathering for ' . $operation);
4202 $this->bindings[$binding]['operations'][$operation]['input'] =
4203 isset($this->bindings[$binding]['operations'][$operation]['input']) ?
4204 …array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindi…
4205 $this->portTypes[ $bindingData['portType'] ][$operation]['input'];
4206 $this->bindings[$binding]['operations'][$operation]['output'] =
4207 isset($this->bindings[$binding]['operations'][$operation]['output']) ?
4208 …array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bind…
4209 $this->portTypes[ $bindingData['portType'] ][$operation]['output'];
4210 …if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] …
4211 …$this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bi…
4213 …if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message']…
4214 …$this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->b…
4217 … $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style'];
4219 …$this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']…
4220->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $binding…
4221 …$this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) …
4236 $this->debug('no wsdl passed to parseWSDL()!!');
4237 $this->setError('no wsdl passed to parseWSDL()!!');
4245 $this->debug('getting WSDL http(s) URL ' . $wsdl);
4248 $tr->request_method = 'GET';
4249 $tr->useSOAPAction = false;
4250 if($this->proxyhost && $this->proxyport){
4251 $tr->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword);
4253 $tr->setEncoding('gzip, deflate');
4254 $wsdl_string = $tr->send('', $this->timeout, $this->response_timeout);
4255 //$this->debug("WSDL request\n" . $tr->outgoing_payload);
4256 //$this->debug("WSDL response\n" . $tr->incoming_payload);
4257 $this->appendDebug($tr->getDebug());
4259 if($err = $tr->getError() ){
4261 $this->debug($errstr);
4262 $this->setError($errstr);
4267 $this->debug("got WSDL URL");
4275 $this->debug('getting WSDL file ' . $path);
4284 $this->debug($errstr);
4285 $this->setError($errstr);
4289 $this->debug('Parse WSDL');
4292 $this->parser = xml_parser_create();
4295 xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
4297 xml_set_object($this->parser, $this);
4299 xml_set_element_handler($this->parser, 'start_element', 'end_element');
4300 xml_set_character_data_handler($this->parser, 'character_data');
4302 if (!xml_parse($this->parser, $wsdl_string, true)) {
4307 xml_get_current_line_number($this->parser),
4308 xml_error_string(xml_get_error_code($this->parser))
4310 $this->debug($errstr);
4311 $this->debug("XML payload:\n" . $wsdl_string);
4312 $this->setError($errstr);
4316 xml_parser_free($this->parser);
4317 $this->debug('Parsing WSDL done');
4319 if($this->getError()){
4326 * start-element handler
4335 if ($this->status == 'schema') {
4336 $this->currentSchema->schemaStartElement($parser, $name, $attrs);
4337 $this->appendDebug($this->currentSchema->getDebug());
4338 $this->currentSchema->clearDebug();
4340 $this->debug('Parsing WSDL schema');
4341 …// $this->debug("startElement for $name ($attrs[name]). status = $this->status (".$this->getLocalP…
4342 $this->status = 'schema';
4343 $this->currentSchema = new xmlschema('', '', $this->namespaces);
4344 $this->currentSchema->schemaStartElement($parser, $name, $attrs);
4345 $this->appendDebug($this->currentSchema->getDebug());
4346 $this->currentSchema->clearDebug();
4349 $pos = $this->position++;
4350 $depth = $this->depth++;
4352 $this->depth_array[$depth] = $pos;
4353 $this->message[$pos] = array('cdata' => '');
4360 $this->namespaces[$ns_prefix] = $v;
4362 $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v;
4365 $this->XMLSchemaVersion = $v;
4366 $this->namespaces['xsi'] = $v . '-instance';
4372 $k = strpos($k, ':') ? $this->expandQname($k) : $k;
4374 $v = strpos($v, ':') ? $this->expandQname($v) : $v;
4387 $namespace = isset($this->namespaces[$prefix]) ? $this->namespaces[$prefix] : '';
4393 switch ($this->status) {
4397 …$this->debug("msg " . $this->currentMessage . ": found part $attrs[name]: " . implode(',', $attrs)…
4398 $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type'];
4401 …$this->debug("msg " . $this->currentMessage . ": found part $attrs[name]: " . implode(',', $attrs)…
4402 $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'];
4409 $this->currentPortOperation = $attrs['name'];
4410 … $this->debug("portType $this->currentPortType operation: $this->currentPortOperation");
4412 …$this->portTypes[$this->currentPortType][$attrs['name']]['parameterOrder'] = $attrs['parameterOrde…
4416 $this->documentation = true;
4420 $m = isset($attrs['message']) ? $this->getLocalPart($attrs['message']) : '';
4421 … $this->portTypes[$this->currentPortType][$this->currentPortOperation][$name]['message'] = $m;
4430 $this->bindings[$this->currentBinding]['prefix'] = $prefix;
4432 …$this->bindings[$this->currentBinding] = array_merge($this->bindings[$this->currentBinding], $attr…
4435 …$this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus]['he…
4439 …$this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['soapAction'] = $att…
4442 …$this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['style'] = $attrs['s…
4445 $this->currentOperation = $attrs['name'];
4446 $this->debug("current binding operation: $this->currentOperation");
4447 …$this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['name'] = $attrs['na…
4448 …$this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['binding'] = $this->…
4449->bindings[$this->currentBinding]['operations'][$this->currentOperation]['endpoint'] = isset($this
4453 $this->opStatus = 'input';
4456 $this->opStatus = 'output';
4459 …if (isset($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opS…
4460->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = array_…
4462 …$this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = $…
4470 $this->currentPort = $attrs['name'];
4471 $this->debug('current port: ' . $this->currentPort);
4472 $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']);
4476 $this->ports[$this->currentPort]['location'] = $attrs['location'];
4477 $this->ports[$this->currentPort]['bindingType'] = $namespace;
4478 … $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace;
4479 … $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location'];
4488 … $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false);
4489 …$this->debug('parsing import ' . $attrs['namespace']. ' - ' . $attrs['location'] . ' (' . count($t…
4491 … $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true);
4492 if (! $this->getPrefixFromNamespace($attrs['namespace'])) {
4493 $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace'];
4495 …$this->debug('parsing import ' . $attrs['namespace']. ' - [no location] (' . count($this->import[$…
4500 // $this->status = 'schema';
4503 $this->status = 'message';
4504 $this->messages[$attrs['name']] = array();
4505 $this->currentMessage = $attrs['name'];
4508 $this->status = 'portType';
4509 $this->portTypes[$attrs['name']] = array();
4510 $this->currentPortType = $attrs['name'];
4516 $this->currentBinding = $this->getLocalPart($attrs['name']);
4518 $this->currentBinding = $attrs['name'];
4520 $this->status = 'binding';
4521 $this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']);
4522 $this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']);
4526 $this->serviceName = $attrs['name'];
4527 $this->status = 'service';
4528 $this->debug('current service: ' . $this->serviceName);
4532 $this->wsdl_info[$name] = $value;
4540 * end-element handler
4549 $this->status = "";
4550 $this->appendDebug($this->currentSchema->getDebug());
4551 $this->currentSchema->clearDebug();
4552 $this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema;
4553 $this->debug('Parsing WSDL schema done');
4555 if ($this->status == 'schema') {
4556 $this->currentSchema->schemaEndElement($parser, $name);
4559 $this->depth--;
4562 if ($this->documentation) {
4564 …//$this->portTypes[$this->currentPortType][$this->currentPortOperation]['documentation'] = $this->…
4565 $this->documentation = false;
4578 $pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0;
4579 if (isset($this->message[$pos]['cdata'])) {
4580 $this->message[$pos]['cdata'] .= $data;
4582 if ($this->documentation) {
4583 $this->documentation .= $data;
4589 if (is_array($this->bindings[$binding])) {
4590 return $this->bindings[$binding];
4608 foreach($this->ports as $port => $portData) {
4611 //$this->debug("getOperations for port $port");
4612 //$this->debug("port data: " . $this->varDump($portData));
4613 //$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ]));
4615 if (isset($this->bindings[ $portData['binding'] ]['operations'])) {
4616 $ops = array_merge ($ops, $this->bindings[ $portData['binding'] ]['operations']);
4637 foreach($this->ports as $port => $portData) {
4641 //foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
4642 foreach(array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) {
4645 $opData = $this->bindings[ $portData['binding'] ]['operations'][$operation];
4666 foreach($this->ports as $port => $portData) {
4670 foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
4698 $this->debug("in getTypeDef: type=$type, ns=$ns");
4699 if ((! $ns) && isset($this->namespaces['tns'])) {
4700 $ns = $this->namespaces['tns'];
4701 $this->debug("in getTypeDef: type namespace forced to $ns");
4703 if (isset($this->schemas[$ns])) {
4704 $this->debug("in getTypeDef: have schema for namespace $ns");
4705 for ($i = 0; $i < count($this->schemas[$ns]); $i++) {
4706 $xs = &$this->schemas[$ns][$i];
4707 $t = $xs->getTypeDef($type);
4708 $this->appendDebug($xs->getDebug());
4709 $xs->clearDebug();
4715 $etype = $this->getTypeDef($uqType, $ns);
4717 $this->debug("found type for [element] $type:");
4718 $this->debug($this->varDump($etype));
4734 $this->debug("in getTypeDef: do not have schema for namespace $ns");
4752 $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
4756 <html><head><title>NuSOAP: '.$this->serviceName.'</title>
4758 …body { font-family: arial; color: #000000; background-color: #ffffff; margin: 0px 0px 0px 0px; }
4759 p { font-family: arial; color: #000000; margin-top: 0px; margin-bottom: 12px; }
4760 …pre { background-color: silver; padding: 5px; font-family: Courier New; font-size: x-small; color:…
4761 ul { margin-top: 10px; margin-left: 20px; }
4762 li { list-style-type: none; margin-top: 10px; color: #000000; }
4764 margin-left: 0px; padding-bottom: 2em; }
4766 padding-top: 10px; padding-bottom: 10px; padding-left: 15px; font-size: .70em;
4767 margin-top: 10px; margin-left: 0px; color: #000000;
4768 background-color: #ccccff; width: 20%; margin-left: 20px; margin-top: 20px; }
4770 font-family: arial; font-size: 26px; color: #ffffff;
4771 background-color: #999999; width: 105%; margin-left: 0px;
4772 padding-top: 10px; padding-bottom: 10px; padding-left: 15px;}
4774 position: absolute; visibility: hidden; z-index: 200; left: 250px; top: 100px;
4775 font-family: arial; overflow: hidden; width: 600;
4776 padding: 20px; font-size: 10px; background-color: #999999;
4777 layer-background-color:#FFFFFF; }
4778 a,a:active { color: charcoal; font-weight: bold; }
4779 a:visited { color: #666666; font-weight: bold; }
4780 a:hover { color: cc3300; font-weight: bold; }
4783 <!--
4784 // POP-UP CAPTIONS...
4789 this.opera5=this.agent.indexOf("Opera 5")>-1
4790 this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
4791 this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
4794 this.mac=this.agent.indexOf("Mac")>-1
4826 //-->
4832 <div class=title>'.$this->serviceName.'</div>
4837 foreach($this->getOperations() as $op => $data){
4873 * @param mixed $debug whether to put debug=1 in endpoint URL
4877 function serialize($debug = 0) argument
4879 $xml = '<?xml version="1.0" encoding="ISO-8859-1"?>';
4881 foreach($this->namespaces as $k => $v) {
4884 // 10.9.02 - add poulter fix for wsdl and tns declarations
4885 if (isset($this->namespaces['wsdl'])) {
4886 $xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\"";
4888 if (isset($this->namespaces['tns'])) {
4889 $xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\"";
4893 if (sizeof($this->import) > 0) {
4894 foreach($this->import as $ns => $list) {
4905 if (count($this->schemas)>=1) {
4907 foreach ($this->schemas as $ns => $list) {
4909 $xml .= $xs->serializeSchema();
4915 if (count($this->messages) >= 1) {
4916 foreach($this->messages as $msgName => $msgParts) {
4920 // print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'<br>';
4922 $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType));
4923 } elseif (isset($this->typemap[$this->namespaces['xsd']][$partType])) {
4924 // print 'checking typemap: '.$this->XMLSchemaVersion.'<br>';
4927 foreach($this->typemap as $ns => $types) {
4929 $typePrefix = $this->getPrefixFromNamespace($ns);
4936 $ns = $this->getNamespaceFromPrefix($typePrefix);
4937 $typeDef = $this->getTypeDef($this->getLocalPart($partType), $ns);
4943 …me="' . $partName . '" ' . $elementortype . '="' . $typePrefix . ':' . $this->getLocalPart($partTy…
4950 if (count($this->bindings) >= 1) {
4953 foreach($this->bindings as $bindingName => $attrs) {
4991 $xml .= "\n<service name=\"" . $this->serviceName . '">';
4992 if (count($this->ports) >= 1) {
4993 foreach($this->ports as $pName => $attrs) {
4995 $xml .= '<soap:address location="' . $attrs['location'] . ($debug ? '?debug=1' : '') . '"/>';
5007 * - multi-ref serialization
5008 * - validate PHP values against type definitions, return errors if invalid
5018 …$this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVers…
5019 $this->appendDebug('parameters=' . $this->varDump($parameters));
5022 $this->debug('The value of the \$direction argument needs to be either "input" or "output"');
5023 $this->setError('The value of the \$direction argument needs to be either "input" or "output"');
5026 if (!$opData = $this->getOperationData($operation)) {
5027 $this->debug('Unable to retrieve WSDL data for operation: ' . $operation);
5028 $this->setError('Unable to retrieve WSDL data for operation: ' . $operation);
5031 $this->debug('opData:');
5032 $this->appendDebug($this->varDump($opData));
5046 $this->debug('have ' . count($opData[$direction]['parts']) . ' part(s) to serialize');
5048 $parametersArrayType = $this->isArraySimpleOrStruct($parameters);
5049 …$this->debug('have ' . count($parameters) . ' parameter(s) provided as ' . $parametersArrayType . …
5051 $this->debug('serializing part "'.$name.'" of type "'.$type.'"');
5063 $this->debug('calling serializeType w/indexed param');
5064 $xml .= $this->serializeType($name, $type, $p, $use, $enc_style);
5066 $this->debug('calling serializeType w/named param');
5067 $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style);
5070 $this->debug('calling serializeType w/null param');
5071 $xml .= $this->serializeType($name, $type, null, $use, $enc_style);
5075 $this->debug('no parameters passed.');
5078 $this->debug("serializeRPCParameters returning: $xml");
5086 * - multi-ref serialization
5087 * - validate PHP values against type definitions, return errors if invalid
5097 …$this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion…
5098 $this->appendDebug('parameters=' . $this->varDump($parameters));
5101 $this->debug('The value of the \$direction argument needs to be either "input" or "output"');
5102 $this->setError('The value of the \$direction argument needs to be either "input" or "output"');
5105 if (!$opData = $this->getOperationData($operation)) {
5106 $this->debug('Unable to retrieve WSDL data for operation: ' . $operation);
5107 $this->setError('Unable to retrieve WSDL data for operation: ' . $operation);
5110 $this->debug('opData:');
5111 $this->appendDebug($this->varDump($opData));
5125 $this->debug("use=$use");
5126 $this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)');
5128 $parametersArrayType = $this->isArraySimpleOrStruct($parameters);
5129 $this->debug('have ' . $parametersArrayType . ' parameters');
5131 $this->debug('serializing part "'.$name.'" of type "'.$type.'"');
5143 $this->debug('calling serializeType w/indexed param');
5144 $xml .= $this->serializeType($name, $type, $p, $use, $enc_style);
5146 $this->debug('calling serializeType w/named param');
5147 $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style);
5150 $this->debug('calling serializeType w/null param');
5151 $xml .= $this->serializeType($name, $type, null, $use, $enc_style);
5155 $this->debug('no parameters passed.');
5158 $this->debug("serializeParameters returning: $xml");
5176 …$this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, un…
5177 $this->appendDebug("value=" . $this->varDump($value));
5179 $encodingStyle = ' SOAP-ENV:encodingStyle="' . $encodingStyle . '"';
5184 if ($value->type_ns) {
5185 $type = $value->type_ns . ':' . $value->type;
5187 $this->debug("in serializeType: soapval overrides type to $type");
5188 } elseif ($value->type) {
5189 $type = $value->type;
5191 $this->debug("in serializeType: soapval overrides type to $type");
5194 $this->debug("in serializeType: soapval does not override type");
5196 $attrs = $value->attributes;
5197 $value = $value->value;
5198 $this->debug("in serializeType: soapval overrides value to $value");
5206 $this->debug("in serializeType: soapval provides attributes");
5216 $this->debug("in serializeType: got a prefixed type: $uqType, $ns");
5217 if ($this->getNamespaceFromPrefix($ns)) {
5218 $ns = $this->getNamespaceFromPrefix($ns);
5219 $this->debug("in serializeType: expanded prefixed type: $uqType, $ns");
5222 if($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/'){
5223 $this->debug('in serializeType: type namespace indicates XML Schema or SOAP Encoding type');
5235 …$xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$u…
5237 $this->debug("in serializeType: returning: $xml");
5248 $value = $this->expandEntities($value);
5256 if (!$this->getTypeDef($uqType, $ns)) {
5259 …$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$…
5264 …$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingS…
5266 $this->debug("in serializeType: returning: $xml");
5269 $this->debug('custom type extends XML Schema or SOAP Encoding namespace (yuck)');
5270 } else if ($ns == 'http://xml.apache.org/xml-soap') {
5271 $this->debug('in serializeType: appears to be Apache SOAP type');
5273 $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap');
5275 $this->debug('in serializeType: Add namespace for Apache SOAP type');
5277 $this->namespaces[$tt_prefix] = 'http://xml.apache.org/xml-soap';
5279 $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap');
5283 $this->debug("serializing map element: key $k, value $v");
5285 $contents .= $this->serialize_val($k,'key',false,false,false,false,$use);
5286 $contents .= $this->serialize_val($v,'value',false,false,false,false,$use);
5298 $this->debug("in serializeType: returning: $xml");
5301 $this->debug('in serializeType: Apache SOAP type, but only support Map');
5306 $this->debug("in serializeType: No namespace for type $type");
5310 if(!$typeDef = $this->getTypeDef($uqType, $ns)){
5311 $this->setError("$type ($uqType) is not a supported type.");
5312 $this->debug("in serializeType: $type ($uqType) is not a supported type.");
5315 $this->debug("in serializeType: found typeDef");
5316 $this->appendDebug('typeDef=' . $this->varDump($typeDef));
5319 …$this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset…
5342 …$xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns)…
5344 $this->debug("in serializeType: returning: $xml");
5351 $elementAttrs = $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType);
5354 …$xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . "…
5359 …$xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . "…
5362 … $xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle);
5365 $this->debug("in serializeType: phpType is struct, but value is not an array");
5366 $this->setError("phpType is struct, but value is not an array: see debug output for details");
5385 $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') .
5387 $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') .
5389 $this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) .
5391 $this->getLocalPart($typeDef['arrayType'])."[0]\"/>";
5393 $this->debug("in serializeType: returning: $xml");
5410 $this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]");
5412 if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) {
5413 $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use);
5415 …$contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion…
5429 …$xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/so…
5430 $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/')
5432 .$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType']))
5433 .":".$this->getLocalPart($typeDef['arrayType'])."[$rows$cols]\">"
5449 …$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$…
5454 …$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingS…
5457 $this->debug("in serializeType: returning: $xml");
5474 $this->debug("serialize attributes for XML Schema type $ns:$uqType");
5480 $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType");
5486 $this->debug("value provided for attribute $aName with key $xname");
5489 $this->debug("value provided for attribute $aName with key $xname");
5493 $this->debug('use default value of ' . $xvalue[$aName] . ' for attribute ' . $aName);
5496 $this->debug("no value provided for attribute $aName");
5499 $xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\"";
5503 $this->debug("no attributes to serialize for XML Schema type $ns:$uqType");
5506 $ns = $this->getPrefix($typeDef['extensionBase']);
5507 $uqType = $this->getLocalPart($typeDef['extensionBase']);
5508 if ($this->getNamespaceFromPrefix($ns)) {
5509 $ns = $this->getNamespaceFromPrefix($ns);
5511 if ($typeDef = $this->getTypeDef($uqType, $ns)) {
5512 $this->debug("serialize attributes for extension base $ns:$uqType");
5513 $xml .= $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType);
5515 $this->debug("extension base $ns:$uqType is not a supported type");
5536 …$this->debug("in serializeComplexTypeElements, serialize elements for XML Schema type $ns:$uqType"…
5542 $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType");
5545 // toggle whether all elements are present - ideally should validate against schema
5553 $this->debug('use default value of ' . $xvalue[$eName] . ' for element ' . $eName);
5562 …$this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minO…
5565 …$this->debug("no value provided for complexType element $eName and element is not nillable, so ser…
5578 …unbounded' || $attrs['maxOccurs'] > 1) && isset($v) && is_array($v) && $this->isArraySimpleOrStruc…
5582 // serialize schema-defined type
5583 …$xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $…
5586 $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use");
5587 $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use);
5592 // serialize schema-defined type
5593 …$xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $…
5596 $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use");
5597 $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use);
5603 $this->debug("no elements to serialize for XML Schema type $ns:$uqType");
5606 $ns = $this->getPrefix($typeDef['extensionBase']);
5607 $uqType = $this->getLocalPart($typeDef['extensionBase']);
5608 if ($this->getNamespaceFromPrefix($ns)) {
5609 $ns = $this->getNamespaceFromPrefix($ns);
5611 if ($typeDef = $this->getTypeDef($uqType, $ns)) {
5612 $this->debug("serialize elements for extension base $ns:$uqType");
5613 … $xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle);
5615 $this->debug("extension base $ns:$uqType is not a supported type");
5630 * @param array attrs = array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]'))
5640 $k = strpos($k,':') ? $this->expandQname($k) : $k;
5641 $v = strpos($v,':') ? $this->expandQname($v) : $v;
5653 $k = strpos($k,':') ? $this->expandQname($k) : $k;
5654 $v = strpos($v,':') ? $this->expandQname($v) : $v;
5662 …$restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrict…
5663 $arrayType = strpos($arrayType,':') ? $this->expandQname($arrayType) : $arrayType;
5665 …$typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'…
5666 …$this->schemas[$typens][0]->addComplexType($name,$typeClass,$phpType,$compositor,$restrictionBase,…
5681 …$restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrict…
5683 …$typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'…
5684 …$this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumerat…
5695 …$typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'…
5696 $this->schemas[$typens][0]->addElement($attrs);
5723 $this->addComplexType($name . 'RequestType', 'complexType', 'struct', 'all', '', $elements);
5724 $this->addElement(array('name' => $name, 'type' => $name . 'RequestType'));
5731 $this->addComplexType($name . 'ResponseType', 'complexType', 'struct', 'all', '', $elements);
5732 $this->addElement(array('name' => $name . 'Response', 'type' => $name . 'ResponseType'));
5737 $this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] =
5740 'binding' => $this->serviceName . 'Binding',
5741 'endpoint' => $this->endpoint,
5766 … $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType);
5768 $this->messages[$name.'Request'][$pName] = $pType;
5771 $this->messages[$name.'Request']= '0';
5778 … $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType);
5780 $this->messages[$name.'Response'][$pName] = $pType;
5783 $this->messages[$name.'Response']= '0';
5832 // toggle for auto-decoding element content
5841 * @param string $decode_utf8 whether to decode UTF-8 to ISO-8859-1
5844 function soap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){
5846 $this->xml = $xml;
5847 $this->xml_encoding = $encoding;
5848 $this->method = $method;
5849 $this->decode_utf8 = $decode_utf8;
5856 $xml_decl = substr($xml, $pos_xml, strpos($xml, '?>', $pos_xml + 2) - $pos_xml + 1);
5860 …$err = "Charset from HTTP Content-Type '" . $encoding . "' does not match encoding from XML declar…
5861 $this->debug($err);
5862 if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') {
5863 $this->setError($err);
5866 …// when HTTP says ISO-8859-1 (the default) and XML says UTF-8 (the typical), assume the other endp…
5868 $this->debug('Charset from HTTP Content-Type matches encoding from XML declaration');
5871 $this->debug('No encoding specified in XML declaration');
5874 $this->debug('No XML declaration');
5876 $this->debug('Entering soap_parser(), length='.strlen($xml).', encoding='.$encoding);
5877 // Create an XML parser - why not xml_parser_create_ns?
5878 $this->parser = xml_parser_create($this->xml_encoding);
5881 xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
5882 xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding);
5884 xml_set_object($this->parser, $this);
5886 xml_set_element_handler($this->parser, 'start_element','end_element');
5887 xml_set_character_data_handler($this->parser,'character_data');
5890 if(!xml_parse($this->parser,$xml,true)){
5893 xml_get_current_line_number($this->parser),
5894 xml_error_string(xml_get_error_code($this->parser)));
5895 $this->debug($err);
5896 $this->debug("XML payload:\n" . $xml);
5897 $this->setError($err);
5899 …$this->debug('parsed successfully, found root struct: '.$this->root_struct.' of name '.$this->root…
5901 $this->soapresponse = $this->message[$this->root_struct]['result'];
5903 // if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){
5904 // $this->responseHeaders = $this->message[$this->root_header]['result'];
5907 if(sizeof($this->multirefs) > 0){
5908 foreach($this->multirefs as $id => $hrefs){
5909 $this->debug('resolving multirefs for id: '.$id);
5910 $idVal = $this->buildVal($this->ids[$id]);
5915 $this->debug('resolving href at pos '.$refPos);
5916 $this->multirefs[$id][$refPos] = $idVal;
5921 xml_parser_free($this->parser);
5923 $this->debug('xml was empty, didn\'t parse!');
5924 $this->setError('xml was empty, didn\'t parse!');
5929 * start-element handler
5939 $pos = $this->position++;
5941 $this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>'');
5944 $this->message[$pos]['depth'] = $this->depth++;
5948 $this->message[$this->parent]['children'] .= '|'.$pos;
5951 $this->message[$pos]['parent'] = $this->parent;
5953 $this->parent = $pos;
5955 $this->depth_array[$this->depth] = $pos;
5965 $this->status = 'envelope';
5967 $this->root_header = $pos;
5968 $this->status = 'header';
5970 $this->status = 'body';
5971 $this->body_position = $pos;
5973 } elseif($this->status == 'body' && $pos == ($this->body_position+1)){
5974 $this->status = 'method';
5975 $this->root_struct_name = $name;
5976 $this->root_struct = $pos;
5977 $this->message[$pos]['type'] = 'struct';
5978 $this->debug("found root struct $this->root_struct_name, pos $this->root_struct");
5981 $this->message[$pos]['status'] = $this->status;
5983 $this->message[$pos]['name'] = htmlspecialchars($name);
5985 $this->message[$pos]['attrs'] = $attrs;
5990 $key_prefix = $this->getPrefix($key);
5991 $key_localpart = $this->getLocalPart($key);
5994 if(ereg('^http://www.w3.org/[0-9]{4}/XMLSchema$',$value)){
5995 $this->XMLSchemaVersion = $value;
5996 $this->namespaces['xsd'] = $this->XMLSchemaVersion;
5997 $this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance';
5999 $this->namespaces[$key_localpart] = $value;
6001 if($name == $this->root_struct_name){
6002 $this->methodNamespace = $value;
6006 $value_prefix = $this->getPrefix($value);
6007 $value_localpart = $this->getLocalPart($value);
6008 $this->message[$pos]['type'] = $value_localpart;
6009 $this->message[$pos]['typePrefix'] = $value_prefix;
6010 if(isset($this->namespaces[$value_prefix])){
6011 $this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix];
6013 $this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix];
6017 $this->message[$pos]['type'] = 'array';
6026 $expr = '([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]';
6028 $this->message[$pos]['typePrefix'] = $regs[1];
6029 $this->message[$pos]['arrayTypePrefix'] = $regs[1];
6030 if (isset($this->namespaces[$regs[1]])) {
6031 $this->message[$pos]['arrayTypeNamespace'] = $this->namespaces[$regs[1]];
6033 $this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:'.$regs[1]];
6035 $this->message[$pos]['arrayType'] = $regs[2];
6036 $this->message[$pos]['arraySize'] = $regs[3];
6037 $this->message[$pos]['arrayCols'] = $regs[4];
6041 $this->message[$pos]['nil'] = ($value == 'true' || $value == '1');
6044 $this->message[$pos]['xattrs']['!' . $key] = $value;
6048 $this->default_namespace = $value;
6052 $this->ids[$value] = $pos;
6056 $this->status = 'method';
6057 $this->root_struct_name = $name;
6058 $this->root_struct = $pos;
6059 $this->debug("found root struct $this->root_struct_name, pos $pos");
6064 // get namespace - must be done after namespace atts are processed
6066 $this->message[$pos]['namespace'] = $this->namespaces[$prefix];
6067 $this->default_namespace = $this->namespaces[$prefix];
6069 $this->message[$pos]['namespace'] = $this->default_namespace;
6071 if($this->status == 'header'){
6072 if ($this->root_header != $pos) {
6073 $this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
6075 } elseif($this->root_struct_name != ''){
6076 $this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
6081 * end-element handler
6089 $pos = $this->depth_array[$this->depth--];
6100 if(isset($this->body_position) && $pos > $this->body_position){
6102 if(isset($this->message[$pos]['attrs']['href'])){
6104 $id = substr($this->message[$pos]['attrs']['href'],1);
6106 $this->multirefs[$id][$pos] = 'placeholder';
6108 $this->message[$pos]['result'] =& $this->multirefs[$id][$pos];
6110 } elseif($this->message[$pos]['children'] != ''){
6112 if(!isset($this->message[$pos]['result'])){
6113 $this->message[$pos]['result'] = $this->buildVal($pos);
6116 } elseif (isset($this->message[$pos]['xattrs'])) {
6117 if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
6118 $this->message[$pos]['xattrs']['!'] = null;
6119 } elseif (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
6120 if (isset($this->message[$pos]['type'])) {
6121->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message…
6123 $parent = $this->message[$pos]['parent'];
6124 …if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isse…
6125->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message…
6127 $this->message[$pos]['xattrs']['!'] = $this->message[$pos]['cdata'];
6131 $this->message[$pos]['result'] = $this->message[$pos]['xattrs'];
6134 …//$this->debug('adding data for scalar value '.$this->message[$pos]['name'].' of value '.$this->me…
6135 if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
6136 $this->message[$pos]['xattrs']['!'] = null;
6137 } elseif (isset($this->message[$pos]['type'])) {
6138->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos…
6140 $parent = $this->message[$pos]['parent'];
6141 …if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isse…
6142->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$par…
6144 $this->message[$pos]['result'] = $this->message[$pos]['cdata'];
6149 $parent = $this->message[$pos]['parent'];
6150 if($this->message[$parent]['type'] != 'map'){
6151 if(strtolower($this->message[$parent]['type']) == 'array'){
6152 $this->message[$parent]['result'][] = $this->message[$pos]['result'];
6154 … $this->message[$parent]['result'][$this->message[$pos]['name']] = $this->message[$pos]['result'];
6162 if($this->status == 'header'){
6163 if ($this->root_header != $pos) {
6164 $this->responseHeaders .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
6166 } elseif($pos >= $this->root_struct){
6167 $this->document .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
6170 if($pos == $this->root_struct){
6171 $this->status = 'body';
6172 $this->root_struct_namespace = $this->message[$pos]['namespace'];
6174 $this->status = 'envelope';
6176 $this->status = 'envelope';
6181 $this->parent = $this->message[$pos]['parent'];
6192 $pos = $this->depth_array[$this->depth];
6193 if ($this->xml_encoding=='UTF-8'){
6195 // raw UTF-8 that, e.g., might not map to iso-8859-1
6196 …can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-885…
6197 if($this->decode_utf8){
6201 $this->message[$pos]['cdata'] .= $data;
6203 if($this->status == 'header'){
6204 $this->responseHeaders .= $data;
6206 $this->document .= $data;
6217 return $this->soapresponse;
6227 return $this->responseHeaders;
6257 $this->debug('Decode base64 value');
6284 if(!isset($this->message[$pos]['type'])){
6285 $this->message[$pos]['type'] = '';
6287 …$this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->messag…
6289 if($this->message[$pos]['children'] != ''){
6290 $this->debug('in buildVal, there are children');
6291 $children = explode('|',$this->message[$pos]['children']);
6294 if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){
6298 $this->debug("in buildVal, got an MD array element: $r, $c");
6299 $params[$r][] = $this->message[$child_pos]['result'];
6301 if($c == $this->message[$pos]['arrayCols']){
6307 } elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){
6308 $this->debug('in buildVal, adding array '.$this->message[$pos]['name']);
6310 $params[] = &$this->message[$child_pos]['result'];
6313 …} elseif($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http:…
6314 $this->debug('in buildVal, Java Map '.$this->message[$pos]['name']);
6316 $kv = explode("|",$this->message[$child_pos]['children']);
6317 $params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result'];
6320 …//} elseif($this->message[$pos]['type'] == 'SOAPStruct' || $this->message[$pos]['type'] == 'struct…
6323 $this->debug('in buildVal, adding Java Vector '.$this->message[$pos]['name']);
6324 …if ($this->message[$pos]['type'] == 'Vector' && $this->message[$pos]['type_namespace'] == 'http://…
6332 $params[] = &$this->message[$child_pos]['result'];
6334 if (isset($params[$this->message[$child_pos]['name']])) {
6335 // de-serialize repeated element name into an array
6336 …if ((!is_array($params[$this->message[$child_pos]['name']])) || (!isset($params[$this->message[$ch…
6337 … $params[$this->message[$child_pos]['name']] = array($params[$this->message[$child_pos]['name']]);
6339 … $params[$this->message[$child_pos]['name']][] = &$this->message[$child_pos]['result'];
6341 $params[$this->message[$child_pos]['name']] = &$this->message[$child_pos]['result'];
6346 if (isset($this->message[$pos]['xattrs'])) {
6347 $this->debug('in buildVal, handling attributes');
6348 foreach ($this->message[$pos]['xattrs'] as $n => $v) {
6353 if (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
6354 $this->debug('in buildVal, handling simpleContent');
6355 if (isset($this->message[$pos]['type'])) {
6356 …!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this
6358 $parent = $this->message[$pos]['parent'];
6359 …if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isse…
6360 …this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($thi…
6362 $params['!'] = $this->message[$pos]['cdata'];
6368 $this->debug('in buildVal, no children, building scalar');
6369 $cdata = isset($this->message[$pos]['cdata']) ? $this->message[$pos]['cdata'] : '';
6370 if (isset($this->message[$pos]['type'])) {
6371 …return $this->decodeSimple($cdata, $this->message[$pos]['type'], isset($this->message[$pos]['type_…
6373 $parent = $this->message[$pos]['parent'];
6374 …if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isse…
6375 …return $this->decodeSimple($cdata, $this->message[$parent]['arrayType'], isset($this->message[$par…
6377 return $this->message[$pos]['cdata'];
6398 * echo $soapclient->call( string methodname [ ,array parameters] );
6476 $this->endpoint = $endpoint;
6477 $this->proxyhost = $proxyhost;
6478 $this->proxyport = $proxyport;
6479 $this->proxyusername = $proxyusername;
6480 $this->proxypassword = $proxypassword;
6481 $this->timeout = $timeout;
6482 $this->response_timeout = $response_timeout;
6487 $this->wsdl = $endpoint;
6488 $this->endpoint = $this->wsdl->wsdl;
6489 $this->wsdlFile = $this->endpoint;
6490 $this->debug('existing wsdl instance created from ' . $this->endpoint);
6492 $this->wsdlFile = $this->endpoint;
6495 $this->debug('instantiating wsdl class with doc: '.$endpoint);
6496 …$this->wsdl =& new wsdl($this->wsdlFile,$this->proxyhost,$this->proxyport,$this->proxyusername,$th…
6498 $this->appendDebug($this->wsdl->getDebug());
6499 $this->wsdl->clearDebug();
6501 if($errstr = $this->wsdl->getError()){
6502 $this->debug('got wsdl error: '.$errstr);
6503 $this->setError('wsdl error: '.$errstr);
6504 } elseif($this->operations = $this->wsdl->getOperations()){
6505 $this->debug( 'got '.count($this->operations).' operations from wsdl '.$this->wsdlFile);
6506 $this->endpointType = 'wsdl';
6508 $this->debug( 'getOperations returned false');
6509 $this->setError('no operations defined in the WSDL document!');
6512 $this->debug("instantiate SOAP with endpoint at $endpoint");
6513 $this->endpointType = 'soap';
6543 $this->operation = $operation;
6544 $this->fault = false;
6545 $this->setError('');
6546 $this->request = '';
6547 $this->response = '';
6548 $this->responseData = '';
6549 $this->faultstring = '';
6550 $this->faultcode = '';
6551 $this->opData = array();
6553 …is->debug("call: operation=$operation, namespace=$namespace, soapAction=$soapAction, rpcParams=$rp…
6554 $this->appendDebug('params=' . $this->varDump($params));
6555 $this->appendDebug('headers=' . $this->varDump($headers));
6557 $this->requestHeaders = $headers;
6560 if($this->endpointType == 'wsdl' && $opData = $this->getOperationData($operation)){
6562 $this->opData = $opData;
6563 $this->debug("found operation");
6564 $this->appendDebug('opData=' . $this->varDump($opData));
6568 if (! $this->forceEndpoint) {
6569 $this->endpoint = $opData['endpoint'];
6571 $this->endpoint = $this->forceEndpoint;
6577 if($namespace != '' && !isset($this->wsdl->namespaces[$namespace])){
6579 $this->wsdl->namespaces[$nsPrefix] = $namespace;
6581 $nsPrefix = $this->wsdl->getPrefixFromNamespace($namespace);
6584 $this->debug("serializing param string for WSDL operation $operation");
6587 $this->debug("serializing param array for WSDL operation $operation");
6588 $payload = $this->wsdl->serializeRPCParameters($operation,'input',$params);
6590 $this->debug('params must be array or string');
6591 $this->setError('params must be array or string');
6594 $usedNamespaces = $this->wsdl->usedNamespaces;
6600 $this->appendDebug($this->wsdl->getDebug());
6601 $this->wsdl->clearDebug();
6602 if ($errstr = $this->wsdl->getError()) {
6603 $this->debug('got wsdl error: '.$errstr);
6604 $this->setError('wsdl error: '.$errstr);
6607 } elseif($this->endpointType == 'wsdl') {
6609 $this->appendDebug($this->wsdl->getDebug());
6610 $this->wsdl->clearDebug();
6611 $this->setError( 'operation '.$operation.' not present.');
6612 $this->debug("operation '$operation' not present.");
6616 //$this->namespaces['ns1'] = $namespace;
6621 $this->debug("serializing param string for operation $operation");
6624 $this->debug("serializing param array for operation $operation");
6626 $payload .= $this->serialize_val($v,$k,false,false,false,false,$use);
6629 $this->debug('params must be array or string');
6630 $this->setError('params must be array or string');
6643 $this->debug("wrapping RPC request with literal method element");
6650 $this->debug("wrapping RPC request with encoded method element");
6663 …$soapmsg = $this->serializeEnvelope($payload,$this->requestHeaders,$usedNamespaces,$style,$use,$en…
6664 …$this->debug("endpoint=$this->endpoint, soapAction=$soapAction, namespace=$namespace, style=$style…
6665 …$this->debug('SOAP message length=' . strlen($soapmsg) . ' contents (max 1000 bytes)=' . substr($s…
6667 …$return = $this->send($this->getHTTPBody($soapmsg),$soapAction,$this->timeout,$this->response_time…
6668 if($errstr = $this->getError()){
6669 $this->debug('Error: '.$errstr);
6672 $this->return = $return;
6673 $this->debug('sent message successfully and got a(n) '.gettype($return));
6674 $this->appendDebug('return=' . $this->varDump($return));
6678 $this->debug('got fault');
6679 $this->setError($return['faultcode'].': '.$return['faultstring']);
6680 $this->fault = true;
6682 $this->$k = $v;
6683 $this->debug("$k = $v<br>");
6700 $this->debug('return shifted value: ');
6701 $this->appendDebug($this->varDump($return));
6719 if(isset($this->operations[$operation])){
6720 return $this->operations[$operation];
6722 $this->debug("No data for operation: $operation");
6740 $this->checkCookies();
6744 case ereg('^http',$this->endpoint):
6745 $this->debug('transporting via HTTP');
6746 if($this->persistentConnection == true && is_object($this->persistentConnection)){
6747 $http =& $this->persistentConnection;
6749 $http = new soap_transport_http($this->endpoint);
6750 if ($this->persistentConnection) {
6751 $http->usePersistentConnection();
6754 $http->setContentType($this->getHTTPContentType(), $this->getHTTPContentTypeCharset());
6755 $http->setSOAPAction($soapaction);
6756 if($this->proxyhost && $this->proxyport){
6757 $http->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword);
6759 if($this->authtype != '') {
6760 …$http->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certReque…
6762 if($this->http_encoding != ''){
6763 $http->setEncoding($this->http_encoding);
6765 $this->debug('sending message, length='.strlen($msg));
6766 if(ereg('^http:',$this->endpoint)){
6767 //if(strpos($this->endpoint,'http:')){
6768 $this->responseData = $http->send($msg,$timeout,$response_timeout,$this->cookies);
6769 } elseif(ereg('^https',$this->endpoint)){
6770 //} elseif(strpos($this->endpoint,'https:')){
6771 //if(phpversion() == '4.3.0-dev'){
6772 //$response = $http->send($msg,$timeout,$response_timeout);
6773 //$this->request = $http->outgoing_payload;
6774 //$this->response = $http->incoming_payload;
6776 $this->responseData = $http->sendHTTPS($msg,$timeout,$response_timeout,$this->cookies);
6778 $this->setError('no http/s in endpoint url');
6780 $this->request = $http->outgoing_payload;
6781 $this->response = $http->incoming_payload;
6782 $this->appendDebug($http->getDebug());
6783 $this->UpdateCookies($http->incoming_cookies);
6786 if ($this->persistentConnection) {
6787 $http->clearDebug();
6788 if (!is_object($this->persistentConnection)) {
6789 $this->persistentConnection = $http;
6793 if($err = $http->getError()){
6794 $this->setError('HTTP Error: '.$err);
6796 } elseif($this->getError()){
6799 …$this->debug('got response, length='. strlen($this->responseData).' type='.$http->incoming_headers…
6800 return $this->parseResponse($http->incoming_headers, $this->responseData);
6804 $this->setError('no transport found, or selected transport is not yet supported!');
6819 …$this->debug('Entering parseResponse() for data of length ' . strlen($data) . ' and type ' . $head…
6820 if (!strstr($headers['content-type'], 'text/xml')) {
6821 $this->setError('Response not of type text/xml');
6824 if (strpos($headers['content-type'], '=')) {
6825 $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
6826 $this->debug('Got response encoding: ' . $enc);
6827 if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
6828 $this->xml_encoding = strtoupper($enc);
6830 $this->xml_encoding = 'US-ASCII';
6833 // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
6834 $this->xml_encoding = 'ISO-8859-1';
6836 $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating soap_parser');
6837 $parser = new soap_parser($data,$this->xml_encoding,$this->operation,$this->decode_utf8);
6838 // add parser debug data to our debug
6839 $this->appendDebug($parser->getDebug());
6841 if($errstr = $parser->getError()){
6842 $this->setError( $errstr);
6848 $this->responseHeaders = $parser->getHeaders();
6850 $return = $parser->get_response();
6852 $this->document = $parser->document;
6867 $this->forceEndpoint = $endpoint;
6877 $this->requestHeaders = $headers;
6887 return $this->responseHeaders;
6900 $this->proxyhost = $proxyhost;
6901 $this->proxyport = $proxyport;
6902 $this->proxyusername = $proxyusername;
6903 $this->proxypassword = $proxypassword;
6916 $this->username = $username;
6917 $this->password = $password;
6918 $this->authtype = $authtype;
6919 $this->certRequest = $certRequest;
6929 $this->http_encoding = $enc;
6938 $this->persistentConnection = true;
6953 return $this->defaultRpcParams;
6968 $this->defaultRpcParams = $rpcParams;
6980 $evalStr = $this->_getProxyClassCode($r);
6981 //$this->debug("proxy class: $evalStr";
6987 $proxy->endpointType = 'wsdl';
6988 $proxy->wsdlFile = $this->wsdlFile;
6989 $proxy->wsdl = $this->wsdl;
6990 $proxy->operations = $this->operations;
6991 $proxy->defaultRpcParams = $this->defaultRpcParams;
6993 $proxy->username = $this->username;
6994 $proxy->password = $this->password;
6995 $proxy->authtype = $this->authtype;
6996 $proxy->proxyhost = $this->proxyhost;
6997 $proxy->proxyport = $this->proxyport;
6998 $proxy->proxyusername = $this->proxyusername;
6999 $proxy->proxypassword = $this->proxypassword;
7000 $proxy->timeout = $this->timeout;
7001 $proxy->response_timeout = $this->response_timeout;
7002 $proxy->http_encoding = $this->http_encoding;
7003 $proxy->persistentConnection = $this->persistentConnection;
7004 $proxy->requestHeaders = $this->requestHeaders;
7005 $proxy->soap_defencoding = $this->soap_defencoding;
7006 $proxy->endpoint = $this->endpoint;
7007 $proxy->forceEndpoint = $this->forceEndpoint;
7018 if ($this->endpointType != 'wsdl') {
7020 $this->setError($evalStr);
7024 foreach ($this->operations as $operation => $opData) {
7036 $paramStr = substr($paramStr, 0, strlen($paramStr)-2);
7037 $paramArrayStr = substr($paramArrayStr, 0, strlen($paramArrayStr)-2);
7038 $paramCommentStr = substr($paramCommentStr, 0, strlen($paramCommentStr)-2);
7047 …return \$this->call('$operation', \$params, '".$opData['namespace']."', '".(isset($opData['soapAct…
7068 return $this->_getProxyClassCode($r);
7096 * returns false for non-text content types.
7104 return $this->soap_defencoding;
7114 $this->decode_utf8 = $bool;
7119 * adds a new Cookie into $this->cookies array
7123 * @return if cookie-set was successful returns true, else false
7130 $this->cookies[] = array('name' => $name, 'value' => $value);
7141 return $this->cookies;
7151 if (sizeof($this->cookies) == 0) {
7154 $this->debug('checkCookie: check ' . sizeof($this->cookies) . ' cookies');
7155 $curr_cookies = $this->cookies;
7156 $this->cookies = array();
7159 $this->debug('Remove cookie that is not an array');
7164 $this->cookies[] = $cookie;
7166 $this->debug('Remove expired cookie ' . $cookie['name']);
7169 $this->cookies[] = $cookie;
7172 $this->debug('checkCookie: '.sizeof($this->cookies).' cookies left in array');
7184 if (sizeof($this->cookies) == 0) {
7187 $this->debug('Setting new cookie(s)');
7188 $this->cookies = $cookies;
7207 for ($i = 0; $i < count($this->cookies); $i++) {
7208 $cookie = $this->cookies[$i];
7228 $this->cookies[$i] = $newCookie;
7230 $this->debug('Update cookie ' . $newName . '=' . $newCookie['value']);
7234 $this->debug('Add cookie ' . $newName . '=' . $newCookie['value']);
7235 $this->cookies[] = $newCookie;