Lines Matching refs:this

447 				$atts .= " $k=\"".$this->expandEntities($v).'"';
452 $this->debug("serialize_val: serialize null");
456 $this->debug("serialize_val returning $xml");
465 $this->debug("serialize_val returning $xml");
470 if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){
471 $this->debug("serialize_val: serialize xsd built-in primitive type");
479 $val = $this->expandEntities($val);
483 $this->debug("serialize_val returning $xml");
487 $this->debug("serialize_val returning $xml");
495 $this->debug("serialize_val: serialize boolean");
508 $this->debug("serialize_val: serialize int");
516 $this->debug("serialize_val: serialize float");
524 $this->debug("serialize_val: serialize string");
525 $val = $this->expandEntities($val);
533 $this->debug("serialize_val: serialize object");
535 $this->debug("serialize_val: serialize soapval object");
537 $this->appendDebug($val->getDebug());
542 $this->debug("In serialize_val, used class name $name as element name");
544 …$this->debug("In serialize_val, do not override name $name for element name for class " . get_clas…
547 …$pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,false,false,false,false,$use) : $this->ser…
564 $valueType = $this->isArraySimpleOrStruct($val);
566 $this->debug("serialize_val: serialize array");
574 $tt = $this->isArraySimpleOrStruct($v);
580 $xml .= $this->serialize_val($v,'item',false,false,false,false,$use);
585 } elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) {
596 if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']){
628 $this->debug("serialize_val: serialize struct");
712 '<?xml version="1.0" encoding="'.$this->soap_defencoding .'"?'.">".
773 if(isset($this->namespaces[$prefix])){
774 return $this->namespaces[$prefix].':'.$name;
824 if (isset($this->namespaces[$prefix])) {
825 return $this->namespaces[$prefix];
840 foreach ($this->namespaces as $p => $n) {
842 $this->usedNamespaces[$p] = $n;
889 return $this->varDump($this);
1031 $this->faultcode = $faultcode;
1032 $this->faultactor = $faultactor;
1033 $this->faultstring = $faultstring;
1034 $this->faultdetail = $faultdetail;
1045 foreach($this->namespaces as $k => $v){
1049 '<?xml version="1.0" encoding="'.$this->soap_defencoding.'"?>'.
1053 $this->serialize_val($this->faultcode, 'faultcode').
1054 $this->serialize_val($this->faultactor, 'faultactor').
1055 $this->serialize_val($this->faultstring, 'faultstring').
1056 $this->serialize_val($this->faultdetail, 'detail').
1124 $this->debug('nusoap_xmlschema class instantiated, inside constructor');
1126 $this->schema = $schema;
1127 $this->xml = $xml;
1130 $this->enclosingNamespaces = $namespaces;
1131 $this->namespaces = array_merge($this->namespaces, $namespaces);
1135 $this->debug('initial schema file: '.$schema);
1136 $this->parseFile($schema, 'schema');
1141 $this->debug('initial xml file: '.$xml);
1142 $this->parseFile($xml, 'xml');
1161 $this->setError($msg);
1162 $this->debug($msg);
1165 $this->debug("parsing $xml");
1166 $this->parseString($xmlStr,$type);
1167 $this->debug("done parsing $xml");
1186 $this->parser = xml_parser_create();
1188 xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
1191 xml_set_object($this->parser, $this);
1195 xml_set_element_handler($this->parser, 'schemaStartElement','schemaEndElement');
1196 xml_set_character_data_handler($this->parser,'schemaCharacterData');
1198 xml_set_element_handler($this->parser, 'xmlStartElement','xmlEndElement');
1199 xml_set_character_data_handler($this->parser,'xmlCharacterData');
1203 if(!xml_parse($this->parser,$xml,true)){
1206 xml_get_current_line_number($this->parser),
1207 xml_error_string(xml_get_error_code($this->parser))
1209 $this->debug($errstr);
1210 $this->debug("XML payload:\n" . $xml);
1211 $this->setError($errstr);
1214 xml_parser_free($this->parser);
1216 $this->debug('no xml passed to parseString()!!');
1217 $this->setError('no xml passed to parseString()!!');
1230 for ($i = 0; $i < count($this->complexTypeStack); $i++) {
1231 $scope .= $this->complexTypeStack[$i] . '_';
1247 $pos = $this->position++;
1248 $depth = $this->depth++;
1250 $this->depth_array[$depth] = $pos;
1251 $this->message[$pos] = array('cdata' => '');
1253 $this->defaultNamespace[$pos] = $this->defaultNamespace[$this->depth_array[$depth - 1]];
1255 $this->defaultNamespace[$pos] = false;
1259 if($prefix = $this->getPrefix($name)){
1261 $name = $this->getLocalPart($name);
1275 $this->namespaces[$ns_prefix] = $v;
1277 $this->defaultNamespace[$pos] = $v;
1278 if (! $this->getPrefixFromNamespace($v)) {
1279 $this->namespaces['ns'.(count($this->namespaces)+1)] = $v;
1283 $this->XMLSchemaVersion = $v;
1284 $this->namespaces['xsi'] = $v.'-instance';
1290 $k = strpos($k,':') ? $this->expandQname($k) : $k;
1291 $v = strpos($v,':') ? $this->expandQname($v) : $v;
1305 $this->complexTypes[$this->currentComplexType]['compositor'] = $name;
1312 $this->xdebug("parsing attribute:");
1313 $this->appendDebug($this->varDump($attrs));
1315 $attrs['form'] = $this->schemaInfo['attributeFormDefault'];
1321 if ($this->defaultNamespace[$pos]) {
1328 $this->attributes[$attrs['name']] = $attrs;
1346 $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
1347 $prefix = $this->getPrefix($aname);
1354 $this->complexTypes[$this->currentComplexType]['multidimensional'] = true;
1357 if(!strpos($v,':') && isset($this->typemap[$this->XMLSchemaVersion][$v])){
1358 $v = $this->XMLSchemaVersion.':'.$v;
1360 $this->complexTypes[$this->currentComplexType]['arrayType'] = $v;
1366 array_push($this->complexTypeStack, $this->currentComplexType);
1370 $this->xdebug('processing named complexType '.$attrs['name']);
1372 $this->currentComplexType = $attrs['name'];
1373 $this->complexTypes[$this->currentComplexType] = $attrs;
1374 $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType';
1383 $this->xdebug('complexType is unusual array');
1384 $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
1386 $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
1389 $name = $this->CreateTypeName($this->currentElement);
1390 …$this->xdebug('processing unnamed complexType for element ' . $this->currentElement . ' named ' . …
1391 $this->currentComplexType = $name;
1393 $this->complexTypes[$this->currentComplexType] = $attrs;
1394 $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType';
1403 $this->xdebug('complexType is unusual array');
1404 $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
1406 $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
1411 array_push($this->elementStack, $this->currentElement);
1413 $attrs['form'] = $this->schemaInfo['elementFormDefault'];
1416 $this->xdebug("processing typed element ".$attrs['name']." of type ".$attrs['type']);
1417 if (! $this->getPrefix($attrs['type'])) {
1418 if ($this->defaultNamespace[$pos]) {
1419 $attrs['type'] = $this->defaultNamespace[$pos] . ':' . $attrs['type'];
1420 $this->xdebug('used default namespace to make type ' . $attrs['type']);
1430 …if ($this->currentComplexType && $this->complexTypes[$this->currentComplexType]['phpType'] == 'arr…
1431 $this->xdebug('arrayType for unusual array is ' . $attrs['type']);
1432 $this->complexTypes[$this->currentComplexType]['arrayType'] = $attrs['type'];
1434 $this->currentElement = $attrs['name'];
1437 $this->xdebug("processing element as ref to ".$attrs['ref']);
1438 $this->currentElement = "ref to ".$attrs['ref'];
1439 $ename = $this->getLocalPart($attrs['ref']);
1441 $type = $this->CreateTypeName($this->currentComplexType . '_' . $attrs['name']);
1442 $this->xdebug("processing untyped element " . $attrs['name'] . ' type ' . $type);
1443 $this->currentElement = $attrs['name'];
1444 $attrs['type'] = $this->schemaTargetNamespace . ':' . $type;
1447 if (isset($ename) && $this->currentComplexType) {
1448 $this->xdebug("add element $ename to complexType $this->currentComplexType");
1449 $this->complexTypes[$this->currentComplexType]['elements'][$ename] = $attrs;
1451 $this->xdebug("add element $ename to elements array");
1452 $this->elements[ $attrs['name'] ] = $attrs;
1453 $this->elements[ $attrs['name'] ]['typeClass'] = 'element';
1457 $this->xdebug('enumeration ' . $attrs['value']);
1458 if ($this->currentSimpleType) {
1459 $this->simpleTypes[$this->currentSimpleType]['enumeration'][] = $attrs['value'];
1460 } elseif ($this->currentComplexType) {
1461 $this->complexTypes[$this->currentComplexType]['enumeration'][] = $attrs['value'];
1465 $this->xdebug('extension ' . $attrs['base']);
1466 if ($this->currentComplexType) {
1467 $this->complexTypes[$this->currentComplexType]['extensionBase'] = $attrs['base'];
1473 …$this->imports[$attrs['namespace']][] = array('location' => $attrs['schemaLocation'], 'loaded' => …
1476 … $this->imports[$attrs['namespace']][] = array('location' => '', 'loaded' => true);
1477 if (! $this->getPrefixFromNamespace($attrs['namespace'])) {
1478 $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace'];
1485 $this->xdebug('restriction ' . $attrs['base']);
1486 if($this->currentSimpleType){
1487 $this->simpleTypes[$this->currentSimpleType]['type'] = $attrs['base'];
1488 } elseif($this->currentComplexType){
1489 $this->complexTypes[$this->currentComplexType]['restrictionBase'] = $attrs['base'];
1491 $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
1496 $this->schemaInfo = $attrs;
1497 $this->schemaInfo['schemaVersion'] = $this->getNamespaceFromPrefix($prefix);
1499 $this->schemaTargetNamespace = $attrs['targetNamespace'];
1502 $this->schemaInfo['elementFormDefault'] = 'unqualified';
1505 $this->schemaInfo['attributeFormDefault'] = 'unqualified';
1511 array_push($this->simpleTypeStack, $this->currentSimpleType);
1513 $this->xdebug("processing simpleType for name " . $attrs['name']);
1514 $this->currentSimpleType = $attrs['name'];
1515 $this->simpleTypes[ $attrs['name'] ] = $attrs;
1516 $this->simpleTypes[ $attrs['name'] ]['typeClass'] = 'simpleType';
1517 $this->simpleTypes[ $attrs['name'] ]['phpType'] = 'scalar';
1519 $name = $this->CreateTypeName($this->currentComplexType . '_' . $this->currentElement);
1520 …$this->xdebug('processing unnamed simpleType for element ' . $this->currentElement . ' named ' . $…
1521 $this->currentSimpleType = $name;
1523 $this->simpleTypes[$this->currentSimpleType] = $attrs;
1524 $this->simpleTypes[$this->currentSimpleType]['phpType'] = 'scalar';
1543 $this->depth--;
1545 if(isset($this->depth_array[$this->depth])){
1546 $pos = $this->depth_array[$this->depth];
1549 if ($prefix = $this->getPrefix($name)){
1551 $name = $this->getLocalPart($name);
1557 …$this->xdebug('done processing complexType ' . ($this->currentComplexType ? $this->currentComplexT…
1558 $this->currentComplexType = array_pop($this->complexTypeStack);
1562 …$this->xdebug('done processing element ' . ($this->currentElement ? $this->currentElement : '(unkn…
1563 $this->currentElement = array_pop($this->elementStack);
1566 …$this->xdebug('done processing simpleType ' . ($this->currentSimpleType ? $this->currentSimpleType…
1567 $this->currentSimpleType = array_pop($this->simpleTypeStack);
1579 $pos = $this->depth_array[$this->depth - 1];
1580 $this->message[$pos]['cdata'] .= $data;
1590 $schemaPrefix = $this->getPrefixFromNamespace($this->XMLSchemaVersion);
1593 if (sizeof($this->imports) > 0) {
1594 foreach($this->imports as $ns => $list) {
1605 foreach($this->complexTypes as $typeName => $attrs){
1613 …$contentStr .= " <$schemaPrefix:element name=\"$element\" type=\"" . $this->contractQName($ePart…
1634 $contentStr .= " $a=\"".$this->contractQName($v).'"';
1637 $contentStr .= ' wsdl:arrayType="'.$this->contractQName($v).'"';
1687 foreach ($this->schemaInfo as $k => $v) {
1692 $el = "<$schemaPrefix:schema$attr targetNamespace=\"$this->schemaTargetNamespace\"\n";
1693 foreach (array_diff($this->usedNamespaces, $this->enclosingNamespaces) as $nsp => $ns) {
1707 $this->debug('<' . $this->schemaTargetNamespace . '> '.$string);
1723 if(isset($this->typemap[$ns][$type])){
1725 return $this->typemap[$ns][$type];
1726 } elseif(isset($this->complexTypes[$type])){
1728 return $this->complexTypes[$type]['phpType'];
1764 if((! $is_element) && isset($this->complexTypes[$type])){
1765 $this->xdebug("in getTypeDef, found complexType $type");
1766 return $this->complexTypes[$type];
1767 } elseif((! $is_element) && isset($this->simpleTypes[$type])){
1768 $this->xdebug("in getTypeDef, found simpleType $type");
1769 if (!isset($this->simpleTypes[$type]['phpType'])) {
1772 …$uqType = substr($this->simpleTypes[$type]['type'], strrpos($this->simpleTypes[$type]['type'], ':'…
1773 …$ns = substr($this->simpleTypes[$type]['type'], 0, strrpos($this->simpleTypes[$type]['type'], ':')…
1774 $etype = $this->getTypeDef($uqType);
1776 $this->xdebug("in getTypeDef, found type for simpleType $type:");
1777 $this->xdebug($this->varDump($etype));
1779 $this->simpleTypes[$type]['phpType'] = $etype['phpType'];
1782 $this->simpleTypes[$type]['elements'] = $etype['elements'];
1786 return $this->simpleTypes[$type];
1787 } elseif(isset($this->elements[$type])){
1788 $this->xdebug("in getTypeDef, found element $type");
1789 if (!isset($this->elements[$type]['phpType'])) {
1791 …$uqType = substr($this->elements[$type]['type'], strrpos($this->elements[$type]['type'], ':') + 1);
1792 $ns = substr($this->elements[$type]['type'], 0, strrpos($this->elements[$type]['type'], ':'));
1793 $etype = $this->getTypeDef($uqType);
1795 $this->xdebug("in getTypeDef, found type for element $type:");
1796 $this->xdebug($this->varDump($etype));
1798 $this->elements[$type]['phpType'] = $etype['phpType'];
1801 $this->elements[$type]['elements'] = $etype['elements'];
1819 $this->xdebug("in getTypeDef, did not find $type");
1833 if($typeDef = $this->getTypeDef($type)){
1840 $str .= " xmlns=\"".$this->schema['targetNamespace']."\"";
1844 $str .= $this->serializeTypeDef($element);
1869 if($typeDef = $this->getTypeDef($type)){
1875 <tr><td align='right'>$childDef[name] (type: ".$this->getLocalPart($childDef['type'])."):</td>
1940 $this->complexTypes[$name] = array(
1951 $this->xdebug("addComplexType $name:");
1952 $this->appendDebug($this->varDump($this->complexTypes[$name]));
1968 $this->simpleTypes[$name] = array(
1976 $this->xdebug("addSimpleType $name:");
1977 $this->appendDebug($this->varDump($this->simpleTypes[$name]));
1988 if (! $this->getPrefix($attrs['type'])) {
1989 $attrs['type'] = $this->schemaTargetNamespace . ':' . $attrs['type'];
1991 $this->elements[ $attrs['name'] ] = $attrs;
1992 $this->elements[ $attrs['name'] ]['typeClass'] = 'element';
1994 $this->xdebug("addElement " . $attrs['name']);
1995 $this->appendDebug($this->varDump($this->elements[ $attrs['name'] ]));
2077 $this->name = $name;
2078 $this->type = $type;
2079 $this->value = $value;
2080 $this->element_ns = $element_ns;
2081 $this->type_ns = $type_ns;
2082 $this->attributes = $attributes;
2093 …return $this->serialize_val($this->value, $this->name, $this->type, $this->element_ns, $this->type…
2103 return $this->value;
2169 $this->debug("ctor url=$url use_curl=$use_curl curl_options:");
2170 $this->appendDebug($this->varDump($curl_options));
2171 $this->setURL($url);
2173 $this->ch_options = $curl_options;
2175 $this->use_curl = $use_curl;
2176 ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
2177 $this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')');
2188 $this->debug("setCurlOption option=$option, value=");
2189 $this->appendDebug($this->varDump($value));
2190 curl_setopt($this->ch, $option, $value);
2201 $this->outgoing_headers[$name] = $value;
2202 $this->debug("set header $name: $value");
2212 if (isset($this->outgoing_headers[$name])) {
2213 $this->debug("unset header $name");
2214 unset($this->outgoing_headers[$name]);
2225 $this->url = $url;
2229 $this->debug("parsed URL $k = $v");
2230 $this->$k = $v;
2235 $this->path .= '?' . $u['query'];
2241 $this->port = 443;
2243 $this->port = 80;
2247 $this->uri = $this->path;
2248 $this->digest_uri = $this->uri;
2252 $this->setHeader('Host', $this->host);
2254 $this->setHeader('Host', $this->host.':'.$this->port);
2258 $this->setCredentials(urldecode($u['user']), isset($u['pass']) ? urldecode($u['pass']) : '');
2269this->use_curl || ($this->scheme == 'https') || ($this->scheme == 'http' && $this->authtype == 'nt…
2271 …if (($this->scheme == 'http' || $this->scheme == 'ssl') && $this->authtype != 'ntlm' && (!is_array…
2297 …$this->debug("connect connection_timeout $connection_timeout, response_timeout $response_timeout, …
2298 if ($this->io_method() == 'socket') {
2299 if (!is_array($this->proxy)) {
2300 $host = $this->host;
2301 $port = $this->port;
2303 $host = $this->proxy['host'];
2304 $port = $this->proxy['port'];
2308 if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){
2309 if (!feof($this->fp)) {
2310 $this->debug('Re-use persistent connection');
2313 fclose($this->fp);
2314 $this->debug('Closed persistent connection at EOF');
2318 if ($this->scheme == 'ssl') {
2321 …$this->debug('calling fsockopen with host ' . $host . ' connection_timeout ' . $connection_timeout…
2325 $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout);
2327 $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str);
2331 if(!$this->fp) {
2332 $msg = 'Couldn\'t open socket connection to server ' . $this->url;
2333 if ($this->errno) {
2334 $msg .= ', Error ('.$this->errno.'): '.$this->error_str;
2338 $this->debug($msg);
2339 $this->setError($msg);
2344 $this->debug('set response timeout to ' . $response_timeout);
2345 socket_set_timeout( $this->fp, $response_timeout);
2347 $this->debug('socket connected');
2349 } else if ($this->io_method() == 'curl') {
2352 …$this->setError('The PHP cURL Extension is required for HTTPS or NLTM. You will need to re-build …
2381 $this->debug('connect using cURL');
2383 $this->ch = curl_init();
2385 …$hostURL = ($this->port != '') ? "$this->scheme://$this->host:$this->port" : "$this->scheme://$thi…
2387 $hostURL .= $this->path;
2388 $this->setCurlOption(CURLOPT_URL, $hostURL);
2391 $this->debug('safe_mode or open_basedir set, so do not set CURLOPT_FOLLOWLOCATION');
2392 $this->debug('safe_mode = ');
2393 $this->appendDebug($this->varDump(ini_get('safe_mode')));
2394 $this->debug('open_basedir = ');
2395 $this->appendDebug($this->varDump(ini_get('open_basedir')));
2397 $this->setCurlOption(CURLOPT_FOLLOWLOCATION, 1);
2400 $this->setCurlOption(CURLOPT_HEADER, 1);
2402 $this->setCurlOption(CURLOPT_RETURNTRANSFER, 1);
2409 if ($this->persistentConnection) {
2415 $this->persistentConnection = false;
2416 $this->setHeader('Connection', 'close');
2420 $this->setCurlOption($CURLOPT_CONNECTIONTIMEOUT, $connection_timeout);
2423 $this->setCurlOption(CURLOPT_TIMEOUT, $response_timeout);
2426 if ($this->scheme == 'https') {
2427 $this->debug('set cURL SSL verify options');
2432 $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 0);
2433 $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 0);
2436 if ($this->authtype == 'certificate') {
2437 $this->debug('set cURL certificate options');
2438 if (isset($this->certRequest['cainfofile'])) {
2439 $this->setCurlOption(CURLOPT_CAINFO, $this->certRequest['cainfofile']);
2441 if (isset($this->certRequest['verifypeer'])) {
2442 $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, $this->certRequest['verifypeer']);
2444 $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 1);
2446 if (isset($this->certRequest['verifyhost'])) {
2447 $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, $this->certRequest['verifyhost']);
2449 $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 1);
2451 if (isset($this->certRequest['sslcertfile'])) {
2452 $this->setCurlOption(CURLOPT_SSLCERT, $this->certRequest['sslcertfile']);
2454 if (isset($this->certRequest['sslkeyfile'])) {
2455 $this->setCurlOption(CURLOPT_SSLKEY, $this->certRequest['sslkeyfile']);
2457 if (isset($this->certRequest['passphrase'])) {
2458 $this->setCurlOption(CURLOPT_SSLKEYPASSWD, $this->certRequest['passphrase']);
2460 if (isset($this->certRequest['certpassword'])) {
2461 $this->setCurlOption(CURLOPT_SSLCERTPASSWD, $this->certRequest['certpassword']);
2465 if ($this->authtype && ($this->authtype != 'certificate')) {
2466 if ($this->username) {
2467 $this->debug('set cURL username/password');
2468 $this->setCurlOption(CURLOPT_USERPWD, "$this->username:$this->password");
2470 if ($this->authtype == 'basic') {
2471 $this->debug('set cURL for Basic authentication');
2472 $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_BASIC);
2474 if ($this->authtype == 'digest') {
2475 $this->debug('set cURL for digest authentication');
2476 $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_DIGEST);
2478 if ($this->authtype == 'ntlm') {
2479 $this->debug('set cURL for NTLM authentication');
2480 $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_NTLM);
2483 if (is_array($this->proxy)) {
2484 $this->debug('set cURL proxy options');
2485 if ($this->proxy['port'] != '') {
2486 $this->setCurlOption(CURLOPT_PROXY, $this->proxy['host'].':'.$this->proxy['port']);
2488 $this->setCurlOption(CURLOPT_PROXY, $this->proxy['host']);
2490 if ($this->proxy['username'] || $this->proxy['password']) {
2491 $this->debug('set cURL proxy authentication options');
2492 … $this->setCurlOption(CURLOPT_PROXYUSERPWD, $this->proxy['username'].':'.$this->proxy['password']);
2493 if ($this->proxy['authtype'] == 'basic') {
2494 $this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_BASIC);
2496 if ($this->proxy['authtype'] == 'ntlm') {
2497 $this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_NTLM);
2501 $this->debug('cURL connection set up');
2504 $this->setError('Unknown scheme ' . $this->scheme);
2505 $this->debug('Unknown scheme ' . $this->scheme);
2522 $this->debug('entered send() with data of length: '.strlen($data));
2524 $this->tryagain = true;
2526 while ($this->tryagain) {
2527 $this->tryagain = false;
2530 if (!$this->connect($timeout, $response_timeout)){
2535 if (!$this->sendRequest($data, $cookies)){
2540 $respdata = $this->getResponse();
2542 $this->setError("Too many tries to get an OK response ($this->response_status_line)");
2545 $this->debug('end of send()');
2562 return $this->send($data, $timeout, $response_timeout, $cookies);
2576 $this->debug("setCredentials username=$username authtype=$authtype digestRequest=");
2577 $this->appendDebug($this->varDump($digestRequest));
2578 $this->debug("certRequest=");
2579 $this->appendDebug($this->varDump($certRequest));
2582 …$this->setHeader('Authorization', 'Basic '.base64_encode(str_replace(':','',$username).':'.$passwo…
2596 $A2 = $this->request_method . ':' . $this->digest_uri;
2628 …$this->setHeader('Authorization', 'Digest username="' . $username . '", realm="' . $digestRequest[…
2631 $this->certRequest = $certRequest;
2632 $this->debug('Authorization header not set for certificate');
2635 $this->debug('Authorization header not set for ntlm');
2637 $this->username = $username;
2638 $this->password = $password;
2639 $this->authtype = $authtype;
2640 $this->digestRequest = $digestRequest;
2650 $this->setHeader('SOAPAction', '"' . $soapaction . '"');
2661 $this->protocol_version = '1.1';
2662 $this->setHeader('Accept-Encoding', $enc);
2663 if (!isset($this->outgoing_headers['Connection'])) {
2664 $this->setHeader('Connection', 'close');
2665 $this->persistentConnection = false;
2669 $this->encoding = $enc;
2685 $this->proxy = array(
2693 …$this->setHeader('Proxy-Authorization', ' Basic '.base64_encode($proxyusername.':'.$proxypassword)…
2696 $this->debug('remove proxy');
2747 $this->debug('no linebreak found in decodeChunked');
2755 $this->debug("chunkstart: $chunkstart chunk_size: $chunk_size");
2801 $this->setHeader('Content-Length', strlen($data));
2804 if ($this->proxy) {
2805 $uri = $this->url;
2807 $uri = $this->uri;
2809 $req = "$this->request_method $uri HTTP/$this->protocol_version";
2810 $this->debug("HTTP request: $req");
2811 $this->outgoing_payload = "$req\r\n";
2814 foreach($this->outgoing_headers as $k => $v){
2816 $this->debug("HTTP header: $hdr");
2817 $this->outgoing_payload .= "$hdr\r\n";
2823 $this->debug("HTTP header: $hdr");
2824 $this->outgoing_payload .= "$hdr\r\n";
2828 $this->outgoing_payload .= "\r\n";
2831 $this->outgoing_payload .= $data;
2844 …$cookie_str = $this->getCookiesForRequest($cookies, (($this->scheme == 'ssl') || ($this->scheme ==…
2847 $this->buildPayload($data, $cookie_str);
2849 if ($this->io_method() == 'socket') {
2851 if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) {
2852 $this->setError('couldn\'t write message data to socket');
2853 $this->debug('couldn\'t write message data to socket');
2856 $this->debug('wrote data to socket, length = ' . strlen($this->outgoing_payload));
2858 } else if ($this->io_method() == 'curl') {
2865 foreach($this->outgoing_headers as $k => $v){
2867 $this->debug("Skip cURL header $k: $v");
2875 $this->setCurlOption(CURLOPT_HTTPHEADER, $curl_headers);
2876 $this->debug('set cURL HTTP headers');
2877 if ($this->request_method == "POST") {
2878 $this->setCurlOption(CURLOPT_POST, 1);
2879 $this->setCurlOption(CURLOPT_POSTFIELDS, $data);
2880 $this->debug('set cURL POST data');
2884 foreach ($this->ch_options as $key => $val) {
2885 $this->setCurlOption($key, $val);
2888 $this->debug('set cURL payload');
2900 $this->incoming_payload = '';
2902 if ($this->io_method() == 'socket') {
2908 if(feof($this->fp)) {
2909 $this->incoming_payload = $data;
2910 $this->debug('found no headers before EOF after length ' . strlen($data));
2911 $this->debug("received before EOF:\n" . $data);
2912 $this->setError('server failed to send headers');
2916 $tmp = fgets($this->fp, 256);
2918 $this->debug("read line of $tmplen bytes: " . trim($tmp));
2921 $this->incoming_payload = $data;
2922 $this->debug('socket read of headers timed out after length ' . strlen($data));
2923 $this->debug("read before timeout: " . $data);
2924 $this->setError('socket read of headers timed out');
2945 $this->incoming_payload .= $data;
2946 $this->debug('found end of headers after length ' . strlen($data));
2950 $this->incoming_headers = array();
2951 $this->incoming_cookies = array();
2956 $this->incoming_headers[$header_name] = trim($arr[1]);
2959 $cookie = $this->parseCookie(trim($arr[1]));
2961 $this->incoming_cookies[] = $cookie;
2962 $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
2964 $this->debug('did not find cookie in ' . trim($arr[1]));
2969 $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
2974 …if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['tra…
2977 $this->debug("want to read chunked content");
2978 } elseif (isset($this->incoming_headers['content-length'])) {
2979 $content_length = $this->incoming_headers['content-length'];
2981 $this->debug("want to read content of length $content_length");
2985 $this->debug("want to read content to EOF");
2990 $tmp = fgets($this->fp, 256);
2992 $this->debug("read chunk line of $tmplen bytes");
2994 $this->incoming_payload = $data;
2995 $this->debug('socket read of chunk length timed out after length ' . strlen($data));
2996 $this->debug("read before timeout:\n" . $data);
2997 $this->setError('socket read of chunk length timed out');
3001 $this->debug("chunk length $content_length");
3004 while (($strlen < $content_length) && (!feof($this->fp))) {
3006 $tmp = fread($this->fp, $readlen);
3008 $this->debug("read buffer of $tmplen bytes");
3009 if (($tmplen == 0) && (!feof($this->fp))) {
3010 $this->incoming_payload = $data;
3011 $this->debug('socket read of body timed out after length ' . strlen($data));
3012 $this->debug("read before timeout:\n" . $data);
3013 $this->setError('socket read of body timed out');
3020 $tmp = fgets($this->fp, 256);
3022 $this->debug("read chunk terminator of $tmplen bytes");
3024 $this->incoming_payload = $data;
3025 $this->debug('socket read of chunk terminator timed out after length ' . strlen($data));
3026 $this->debug("read before timeout:\n" . $data);
3027 $this->setError('socket read of chunk terminator timed out');
3031 } while ($chunked && ($content_length > 0) && (!feof($this->fp)));
3032 if (feof($this->fp)) {
3033 $this->debug('read to EOF');
3035 $this->debug('read body of length ' . strlen($data));
3036 $this->incoming_payload .= $data;
3037 $this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server');
3041 …(isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection'])…
3042 (! $this->persistentConnection) || feof($this->fp)){
3043 fclose($this->fp);
3044 $this->fp = false;
3045 $this->debug('closed socket');
3049 if($this->incoming_payload == ''){
3050 $this->setError('no response from server');
3065 } else if ($this->io_method() == 'curl') {
3067 $this->debug('send and receive with cURL');
3068 $this->incoming_payload = curl_exec($this->ch);
3069 $data = $this->incoming_payload;
3071 $cErr = curl_error($this->ch);
3073 $err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'<br>';
3075 foreach(curl_getinfo($this->ch) as $k => $v){
3078 $this->debug($err);
3079 $this->setError($err);
3080 curl_close($this->ch);
3088 $this->debug('No cURL error, closing cURL');
3089 curl_close($this->ch);
3093 while ($this->isSkippableCurlHeader($data)) {
3094 $this->debug("Found HTTP header to skip");
3120 $this->debug('no proper separation of headers and document');
3121 $this->setError('no proper separation of headers and document');
3127 $this->debug('found proper separation of headers and document');
3128 $this->debug('cleaned data, stringlen: '.strlen($data));
3134 $this->incoming_headers[$header_name] = trim($arr[1]);
3137 $cookie = $this->parseCookie(trim($arr[1]));
3139 $this->incoming_cookies[] = $cookie;
3140 $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
3142 $this->debug('did not find cookie in ' . trim($arr[1]));
3147 $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
3152 $this->response_status_line = $header_array[0];
3153 $arr = explode(' ', $this->response_status_line, 3);
3159 if (isset($this->incoming_headers['location']) && ($http_status == 301 || $http_status == 302)) {
3160 …$this->debug("Got $http_status $http_reason with Location: " . $this->incoming_headers['location']…
3161 $this->setURL($this->incoming_headers['location']);
3162 $this->tryagain = true;
3167 if (isset($this->incoming_headers['www-authenticate']) && $http_status == 401) {
3168 …$this->debug("Got 401 $http_reason with WWW-Authenticate: " . $this->incoming_headers['www-authent…
3169 if (strstr($this->incoming_headers['www-authenticate'], "Digest ")) {
3170 $this->debug('Server wants digest authentication');
3172 $digestString = str_replace('Digest ', '', $this->incoming_headers['www-authenticate']);
3183 $this->setCredentials($this->username, $this->password, 'digest', $digestRequest);
3184 $this->tryagain = true;
3188 $this->debug('HTTP authentication failed');
3189 $this->setError('HTTP authentication failed');
3198 …$this->setError("Unsupported HTTP response status $http_status $http_reason (soapclient->response …
3203 …if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding…
3204 …if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incom…
3210 $this->debug('The gzinflate function exists');
3212 if ($this->incoming_headers['content-encoding'] == 'deflate') {
3215 $this->debug('The payload has been inflated to ' . strlen($data) . ' bytes');
3218 $this->debug('The inflated payload is smaller than the gzipped one; try again');
3221 $this->debug('The payload has been inflated again to ' . strlen($data) . ' bytes');
3225 $this->debug('Error using gzinflate to inflate the payload');
3226 $this->setError('Error using gzinflate to inflate the payload');
3228 } elseif ($this->incoming_headers['content-encoding'] == 'gzip') {
3231 $this->debug('The payload has been un-gzipped to ' . strlen($data) . ' bytes');
3234 $this->debug('The un-gzipped payload is smaller than the gzipped one; try again');
3237 $this->debug('The payload has been un-gzipped again to ' . strlen($data) . ' bytes');
3241 $this->debug('Error using gzinflate to un-gzip the payload');
3242 $this->setError('Error using gzinflate to un-gzip the payload');
3248 $this->incoming_payload = $header_data.$lb.$lb.$data;
3250 …$this->debug('The server sent compressed data. Your php install must have the Zlib extension compi…
3251 …$this->setError('The server sent compressed data. Your php install must have the Zlib extension co…
3254 $this->debug('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']);
3255 $this->setError('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']);
3258 $this->debug('No Content-Encoding header');
3262 $this->debug('no data after headers!');
3263 $this->setError('no data present after HTTP headers');
3278 $this->setHeader('Content-Type', $type . ($charset ? '; charset=' . $charset : ''));
3288 if (isset($this->outgoing_headers['Accept-Encoding'])) {
3291 $this->protocol_version = '1.1';
3292 $this->persistentConnection = true;
3293 $this->setHeader('Connection', 'Keep-Alive');
3378 $this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']);
3381 $this->debug('cookie has expired');
3387 if (! preg_match("'.*$domain$'i", $this->host)) {
3388 $this->debug('cookie has different domain');
3394 if (! preg_match("'^$path.*'i", $this->path)) {
3395 $this->debug('cookie is for a different path');
3400 $this->debug('cookie is secure, transport is not');
3404 $this->debug('add cookie to Cookie-String: ' . $cookie['name'] . '=' . $cookie['value']);
3589 $this->debug("_SERVER is defined:");
3590 $this->appendDebug($this->varDump($_SERVER));
3592 $this->debug("HTTP_SERVER_VARS is defined:");
3593 $this->appendDebug($this->varDump($HTTP_SERVER_VARS));
3595 $this->debug("Neither _SERVER nor HTTP_SERVER_VARS is defined.");
3599 $this->debug("In nusoap_server, set debug_flag=$debug based on global flag");
3600 $this->debug_flag = $debug;
3605 … $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #1");
3606 $this->debug_flag = substr($v, 6);
3613 … $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #2");
3614 $this->debug_flag = substr($v, 6);
3621 $this->debug("In nusoap_server, WSDL is specified");
3623 $this->wsdl = $wsdl;
3624 $this->externalWSDLURL = $this->wsdl->wsdl;
3625 $this->debug('Use existing wsdl instance from ' . $this->externalWSDLURL);
3627 $this->debug('Create wsdl from ' . $wsdl);
3628 $this->wsdl = new wsdl($wsdl);
3629 $this->externalWSDLURL = $wsdl;
3631 $this->appendDebug($this->wsdl->getDebug());
3632 $this->wsdl->clearDebug();
3633 if($err = $this->wsdl->getError()){
3655 $this->debug("In service, query string=$qs");
3658 $this->debug("In service, this is a request for WSDL");
3659 if($this->externalWSDLURL){
3660 if (strpos($this->externalWSDLURL,"://")!==false) { // assume URL
3661 header('Location: '.$this->externalWSDLURL);
3664 $fp = fopen($this->externalWSDLURL, 'r');
3667 } elseif ($this->wsdl) {
3669 print $this->wsdl->serialize($this->debug_flag);
3670 if ($this->debug_flag) {
3671 $this->debug('wsdl:');
3672 $this->appendDebug($this->varDump($this->wsdl));
3673 print $this->getDebugAsXMLComment();
3679 } elseif ($data == '' && $this->wsdl) {
3680 $this->debug("In service, there is no data, so return Web description");
3681 print $this->wsdl->webDescription();
3683 $this->debug("In service, invoke the request");
3684 $this->parse_request($data);
3685 if (! $this->fault) {
3686 $this->invoke_method();
3688 if (! $this->fault) {
3689 $this->serialize_return();
3691 $this->send_response();
3710 $this->request = '';
3711 $this->SOAPAction = '';
3713 $this->debug("In parse_http_headers, use getallheaders");
3717 $this->headers[$k] = $v;
3718 $this->request .= "$k: $v\r\n";
3719 $this->debug("$k: $v");
3722 if(isset($this->headers['soapaction'])){
3723 $this->SOAPAction = str_replace('"','',$this->headers['soapaction']);
3726 if(isset($this->headers['content-type']) && strpos($this->headers['content-type'],'=')){
3727 $enc = str_replace('"','',substr(strstr($this->headers["content-type"],'='),1));
3729 $this->xml_encoding = strtoupper($enc);
3731 $this->xml_encoding = 'US-ASCII';
3735 $this->xml_encoding = 'ISO-8859-1';
3738 $this->debug("In parse_http_headers, use _SERVER");
3750 $this->SOAPAction = $v;
3758 $this->xml_encoding = strtoupper($enc);
3760 $this->xml_encoding = 'US-ASCII';
3764 $this->xml_encoding = 'ISO-8859-1';
3767 $this->headers[$k] = $v;
3768 $this->request .= "$k: $v\r\n";
3769 $this->debug("$k: $v");
3772 $this->debug("In parse_http_headers, use HTTP_SERVER_VARS");
3784 $this->SOAPAction = $v;
3792 $this->xml_encoding = strtoupper($enc);
3794 $this->xml_encoding = 'US-ASCII';
3798 $this->xml_encoding = 'ISO-8859-1';
3801 $this->headers[$k] = $v;
3802 $this->request .= "$k: $v\r\n";
3803 $this->debug("$k: $v");
3806 $this->debug("In parse_http_headers, HTTP headers not accessible");
3807 $this->setError("HTTP headers not accessible");
3834 $this->debug('entering parse_request()');
3835 $this->parse_http_headers();
3836 $this->debug('got character encoding: '.$this->xml_encoding);
3838 if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] != '') {
3839 $this->debug('got content encoding: ' . $this->headers['content-encoding']);
3840 …if ($this->headers['content-encoding'] == 'deflate' || $this->headers['content-encoding'] == 'gzip…
3843 if ($this->headers['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) {
3845 …} elseif ($this->headers['content-encoding'] == 'gzip' && $degzdata = gzinflate(substr($data, 10))…
3848 $this->fault('SOAP-ENV:Client', 'Errors occurred when trying to decode the data');
3852 $this->fault('SOAP-ENV:Client', 'This Server does not support compressed data');
3857 $this->request .= "\r\n".$data;
3858 $data = $this->parseRequest($this->headers, $data);
3859 $this->requestSOAP = $data;
3860 $this->debug('leaving parse_request');
3881 …$this->debug('in invoke_method, methodname=' . $this->methodname . ' methodURI=' . $this->methodUR…
3885 $data = split("_", $this->methodname);
3899 if ($this->wsdl) {
3900 if ($this->opData = $this->wsdl->getOperationData($this->methodname)) {
3901 $this->debug('in invoke_method, found WSDL operation=' . $this->methodname);
3902 $this->appendDebug('opData=' . $this->varDump($this->opData));
3903 } elseif ($this->opData = $this->wsdl->getOperationDataForSoapAction($this->SOAPAction)) {
3905 …$this->debug('in invoke_method, found WSDL soapAction=' . $this->SOAPAction . ' for operation=' . …
3906 $this->appendDebug('opData=' . $this->varDump($this->opData));
3907 $this->methodname = $this->opData['name'];
3909 $this->debug('in invoke_method, no WSDL for operation=' . $this->methodname);
3910 …$this->fault('SOAP-ENV:Client', "Operation '" . $this->methodname . "' is not defined in the WSDL …
3914 $this->debug('in invoke_method, no WSDL to validate method');
3922 if (strpos($this->methodname, '..') > 0) {
3924 } else if (strpos($this->methodname, '.') > 0) {
3926 } else if (strpos($this->methodname, '_') > 0) {
3932 if (strlen($delim) > 0 && substr_count($this->methodname, $delim) == 1 &&
3933 class_exists(substr($this->methodname, 0, strpos($this->methodname, $delim)))) {
3935 $class = substr($this->methodname, 0, strpos($this->methodname, $delim));
3936 $method = substr($this->methodname, strpos($this->methodname, $delim) + strlen($delim));
3937 $this->debug("in invoke_method, class=$class method=$method delim=$delim");
3942 if (!function_exists($this->methodname)) {
3943 $this->debug("in invoke_method, function '$this->methodname' not found!");
3944 $this->result = 'fault: method not found';
3946this->fault('SOAP-ENV:Client',"method '$this->methodname' not defined in service methodname=' . $t…
3952 $this->debug("in invoke_method, method '$this->methodname' not found in class '$class'!");
3953 $this->result = 'fault: method not found';
3954 $this->fault('SOAP-ENV:Client',"method '$this->methodname' not defined in service");
3961 if(! $this->verify_method($this->methodname,$this->methodparams)){
3963 $this->debug('ERROR: request not verified against method signature');
3964 $this->result = 'fault: request failed validation against method signature';
3966 $this->fault('SOAP-ENV:Client',"Operation '$this->methodname' not defined in service.");
3971 $this->debug('in invoke_method, params:');
3972 $this->appendDebug($this->varDump($this->methodparams));
3973 $this->debug("in invoke_method, calling '$this->methodname'");
3976 $this->debug('in invoke_method, calling function using eval()');
3977 $funcCall = "\$this->methodreturn = $this->methodname(";
3980 $this->debug('in invoke_method, calling class method using eval()');
3983 $this->debug('in invoke_method, calling instance method using eval()');
3990 if ($this->methodparams) {
3991 foreach ($this->methodparams as $param) {
3993 …$this->fault('SOAP-ENV:Client', 'NuSOAP does not handle complexType parameters correctly when usin…
4001 $this->debug('in invoke_method, function call: '.$funcCall);
4005 $this->debug('in invoke_method, calling function using call_user_func_array()');
4006 …$call_arg = "$this->methodname"; // straight assignment changes $this->methodname to lower case af…
4008 $this->debug('in invoke_method, calling class method using call_user_func_array()');
4011 $this->debug('in invoke_method, calling instance method using call_user_func_array()');
4018 call_user_func_array($bsp_call_arg, array($this));
4021 if (is_array($this->methodparams)) {
4022 $this->methodreturn = call_user_func_array($call_arg, array_values($this->methodparams));
4024 $this->methodreturn = call_user_func_array($call_arg, array());
4027 $this->debug('in invoke_method, methodreturn:');
4028 $this->appendDebug($this->varDump($this->methodreturn));
4029 …$this->debug("in invoke_method, called method $this->methodname, received data of type ".gettype($
4044 …$this->debug('Entering serialize_return methodname: ' . $this->methodname . ' methodURI: ' . $this
4046 …if (isset($this->methodreturn) && ((get_class($this->methodreturn) == 'soap_fault') || (get_class(…
4047 $this->debug('got a fault object from method');
4048 $this->fault = $this->methodreturn;
4050 } elseif ($this->methodreturnisliteralxml) {
4051 $return_val = $this->methodreturn;
4054 $this->debug('got a(n) '.gettype($this->methodreturn).' from method');
4055 $this->debug('serializing return value');
4056 if($this->wsdl){
4057 if (sizeof($this->opData['output']['parts']) > 1) {
4058 $this->debug('more than one output part, so use the method return unchanged');
4059 $opParams = $this->methodreturn;
4060 } elseif (sizeof($this->opData['output']['parts']) == 1) {
4061 $this->debug('exactly one output part, so wrap the method return in a simple array');
4066 $opParams = array($this->methodreturn);
4068 $return_val = $this->wsdl->serializeRPCParameters($this->methodname,'output',$opParams);
4069 $this->appendDebug($this->wsdl->getDebug());
4070 $this->wsdl->clearDebug();
4071 if($errstr = $this->wsdl->getError()){
4072 $this->debug('got wsdl error: '.$errstr);
4073 $this->fault('SOAP-ENV:Server', 'unable to serialize result');
4077 if (isset($this->methodreturn)) {
4078 $return_val = $this->serialize_val($this->methodreturn, 'return');
4081 $this->debug('in absence of WSDL, assume void return for backward compatibility');
4085 $this->debug('return value:');
4086 $this->appendDebug($this->varDump($return_val));
4088 $this->debug('serializing response');
4089 if ($this->wsdl) {
4090 $this->debug('have WSDL for serialization: style is ' . $this->opData['style']);
4091 if ($this->opData['style'] == 'rpc') {
4092 $this->debug('style is rpc for serialization: use is ' . $this->opData['output']['use']);
4093 if ($this->opData['output']['use'] == 'literal') {
4095 …$payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</n…
4097 …$payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</n…
4100 $this->debug('style is not rpc for serialization: assume document');
4104 $this->debug('do not have WSDL for serialization: assume rpc/encoded');
4105 …$payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</n…
4107 $this->result = 'successful';
4108 if($this->wsdl){
4110 $this->appendDebug($this->wsdl->getDebug());
4124 …$this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders,$this->wsdl->usedNa…
4126 $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders);
4129 $this->debug("Leaving serialize_return");
4143 $this->debug('Enter send_response');
4144 if ($this->fault) {
4145 $payload = $this->fault->serialize();
4146 $this->outgoing_headers[] = "HTTP/1.0 500 Internal Server Error";
4147 $this->outgoing_headers[] = "Status: 500 Internal Server Error";
4149 $payload = $this->responseSOAP;
4157 if(isset($this->debug_flag) && $this->debug_flag){
4158 $payload .= $this->getDebugAsXMLComment();
4160 $this->outgoing_headers[] = "Server: $this->title Server v$this->version";
4161 ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
4162 $this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")";
4165 $payload = $this->getHTTPBody($payload);
4166 $type = $this->getHTTPContentType();
4167 $charset = $this->getHTTPContentTypeCharset();
4168 $this->outgoing_headers[] = "Content-Type: $type" . ($charset ? '; charset=' . $charset : '');
4172 …if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) …
4173 if (strstr($this->headers['accept-encoding'], 'gzip')) {
4175 if (isset($this->debug_flag) && $this->debug_flag) {
4178 $this->outgoing_headers[] = "Content-Encoding: gzip";
4181 if (isset($this->debug_flag) && $this->debug_flag) {
4185 } elseif (strstr($this->headers['accept-encoding'], 'deflate')) {
4190 if (isset($this->debug_flag) && $this->debug_flag) {
4193 $this->outgoing_headers[] = "Content-Encoding: deflate";
4196 if (isset($this->debug_flag) && $this->debug_flag) {
4203 $this->outgoing_headers[] = "Content-Length: ".strlen($payload);
4204 reset($this->outgoing_headers);
4205 foreach($this->outgoing_headers as $hdr){
4210 $this->response = join("\r\n",$this->outgoing_headers)."\r\n\r\n".$payload;
4223 if(isset($this->wsdl) && is_object($this->wsdl)){
4224 if($this->wsdl->getOperationData($operation)){
4227 } elseif(isset($this->operations[$operation])){
4242 …$this->debug('Entering parseRequest() for data of length ' . strlen($data) . ' and type ' . $heade…
4244 $this->setError('Request not of type text/xml');
4249 $this->debug('Got response encoding: ' . $enc);
4251 $this->xml_encoding = strtoupper($enc);
4253 $this->xml_encoding = 'US-ASCII';
4257 $this->xml_encoding = 'ISO-8859-1';
4259 $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser');
4261 $parser = new nusoap_parser($data,$this->xml_encoding,'',$this->decode_utf8);
4263 $this->debug("parser debug: \n".$parser->getDebug());
4266 $this->result = 'fault: error in msg parsing: '.$err;
4267 $this->fault('SOAP-ENV:Client',"error in msg parsing:\n".$err);
4271 $this->methodURI = $parser->root_struct_namespace;
4272 $this->methodname = $parser->root_struct_name;
4273 $this->debug('methodname: '.$this->methodname.' methodURI: '.$this->methodURI);
4274 $this->debug('calling parser->get_soapbody()');
4275 $this->methodparams = $parser->get_soapbody();
4277 $this->requestHeaders = $parser->getHeaders();
4279 $this->requestHeader = $parser->get_soapheader();
4281 $this->document = $parser->document;
4318 return $this->soap_defencoding;
4331 $this->operations[$methodname] = array('name' => $methodname,'in' => $in,'out' => $out);
4351 if($this->externalWSDLURL){
4375 $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
4451 $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
4480 $this->wsdl = new wsdl;
4481 $this->wsdl->serviceName = $serviceName;
4482 $this->wsdl->endpoint = $endpoint;
4483 $this->wsdl->namespaces['tns'] = $namespace;
4484 $this->wsdl->namespaces['soap'] = 'http://schemas.xmlsoap.org/wsdl/soap/';
4487 $this->wsdl->namespaces['types'] = $schemaTargetNamespace;
4489 …$this->wsdl->schemas[$schemaTargetNamespace][0] = new nusoap_xmlschema('', '', $this->wsdl->namesp…
4491 … $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaInfo['elementFormDefault'] = 'qualified';
4493 … $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaTargetNamespace = $schemaTargetNamespace;
4494 …$this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/soap/encoding…
4496 $this->wsdl->bindings[$serviceName.'Binding'] = array(
4501 $this->wsdl->ports[$serviceName.'Port'] = array(
4586 $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout");
4587 $this->proxyhost = $proxyhost;
4588 $this->proxyport = $proxyport;
4589 $this->proxyusername = $proxyusername;
4590 $this->proxypassword = $proxypassword;
4591 $this->timeout = $timeout;
4592 $this->response_timeout = $response_timeout;
4594 $this->curl_options = $curl_options;
4595 $this->use_curl = $use_curl;
4596 $this->fetchWSDL($wsdl);
4605 $this->debug("parse and process WSDL path=$wsdl");
4606 $this->wsdl = $wsdl;
4608 if ($this->wsdl != "") {
4609 $this->parseWSDL($this->wsdl);
4618 foreach ($this->schemas as $ns => $list) {
4620 $wsdlparts = parse_url($this->wsdl); // this is bogusly simple!
4624 $this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true;
4633 $this->parseWSDL($url);
4638 $this->debug("Unexpected scenario: empty URL for unloaded import");
4646 $wsdlparts = parse_url($this->wsdl); // this is bogusly simple!
4647 foreach ($this->import as $ns => $list) {
4650 $this->import[$ns][$ii]['loaded'] = true;
4659 $this->parseWSDL($url);
4664 $this->debug("Unexpected scenario: empty URL for unloaded import");
4671 foreach($this->bindings as $binding => $bindingData) {
4674 $this->debug('post-parse data gathering for ' . $operation);
4675 $this->bindings[$binding]['operations'][$operation]['input'] =
4676 isset($this->bindings[$binding]['operations'][$operation]['input']) ?
4677 …array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindi…
4678 $this->portTypes[ $bindingData['portType'] ][$operation]['input'];
4679 $this->bindings[$binding]['operations'][$operation]['output'] =
4680 isset($this->bindings[$binding]['operations'][$operation]['output']) ?
4681 …array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bind…
4682 $this->portTypes[ $bindingData['portType'] ][$operation]['output'];
4683 …if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] …
4684 …$this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bi…
4686 …if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message']…
4687 …$this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->b…
4690 …if (isset($bindingData['style']) && !isset($this->bindings[$binding]['operations'][$operation]['st…
4691 … $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style'];
4693 …$this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']…
4694this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bin…
4695 …$this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) …
4708 $this->debug("parse WSDL at path=$wsdl");
4711 $this->debug('no wsdl passed to parseWSDL()!!');
4712 $this->setError('no wsdl passed to parseWSDL()!!');
4720 $this->debug('getting WSDL http(s) URL ' . $wsdl);
4722 $tr = new soap_transport_http($wsdl, $this->curl_options, $this->use_curl);
4725 if($this->proxyhost && $this->proxyport){
4726 $tr->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword);
4728 if ($this->authtype != '') {
4729 …$tr->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest…
4732 $wsdl_string = $tr->send('', $this->timeout, $this->response_timeout);
4735 $this->appendDebug($tr->getDebug());
4739 $this->debug($errstr);
4740 $this->setError($errstr);
4745 $this->debug("got WSDL URL");
4753 $this->debug('getting WSDL file ' . $path);
4762 $this->debug($errstr);
4763 $this->setError($errstr);
4767 $this->debug('Parse WSDL');
4770 $this->parser = xml_parser_create();
4773 xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
4775 xml_set_object($this->parser, $this);
4777 xml_set_element_handler($this->parser, 'start_element', 'end_element');
4778 xml_set_character_data_handler($this->parser, 'character_data');
4780 if (!xml_parse($this->parser, $wsdl_string, true)) {
4785 xml_get_current_line_number($this->parser),
4786 xml_error_string(xml_get_error_code($this->parser))
4788 $this->debug($errstr);
4789 $this->debug("XML payload:\n" . $wsdl_string);
4790 $this->setError($errstr);
4794 xml_parser_free($this->parser);
4795 $this->debug('Parsing WSDL done');
4797 if($this->getError()){
4813 if ($this->status == 'schema') {
4814 $this->currentSchema->schemaStartElement($parser, $name, $attrs);
4815 $this->appendDebug($this->currentSchema->getDebug());
4816 $this->currentSchema->clearDebug();
4818 $this->debug('Parsing WSDL schema');
4820 $this->status = 'schema';
4821 $this->currentSchema = new nusoap_xmlschema('', '', $this->namespaces);
4822 $this->currentSchema->schemaStartElement($parser, $name, $attrs);
4823 $this->appendDebug($this->currentSchema->getDebug());
4824 $this->currentSchema->clearDebug();
4827 $pos = $this->position++;
4828 $depth = $this->depth++;
4830 $this->depth_array[$depth] = $pos;
4831 $this->message[$pos] = array('cdata' => '');
4838 $this->namespaces[$ns_prefix] = $v;
4840 $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v;
4843 $this->XMLSchemaVersion = $v;
4844 $this->namespaces['xsi'] = $v . '-instance';
4850 $k = strpos($k, ':') ? $this->expandQname($k) : $k;
4852 $v = strpos($v, ':') ? $this->expandQname($v) : $v;
4865 $namespace = isset($this->namespaces[$prefix]) ? $this->namespaces[$prefix] : '';
4871 switch ($this->status) {
4875 …$this->debug("msg " . $this->currentMessage . ": found part (with type) $attrs[name]: " . implode(…
4876 $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type'];
4879 …$this->debug("msg " . $this->currentMessage . ": found part (with element) $attrs[name]: " . implo…
4880 $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'] . '^';
4887 $this->currentPortOperation = $attrs['name'];
4888 … $this->debug("portType $this->currentPortType operation: $this->currentPortOperation");
4890 …$this->portTypes[$this->currentPortType][$attrs['name']]['parameterOrder'] = $attrs['parameterOrde…
4894 $this->documentation = true;
4898 $m = isset($attrs['message']) ? $this->getLocalPart($attrs['message']) : '';
4899 … $this->portTypes[$this->currentPortType][$this->currentPortOperation][$name]['message'] = $m;
4908 $this->bindings[$this->currentBinding]['prefix'] = $prefix;
4910 …$this->bindings[$this->currentBinding] = array_merge($this->bindings[$this->currentBinding], $attr…
4913 …$this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus]['he…
4917 …$this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['soapAction'] = $att…
4920 …$this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['style'] = $attrs['s…
4923 $this->currentOperation = $attrs['name'];
4924 $this->debug("current binding operation: $this->currentOperation");
4925 …$this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['name'] = $attrs['na…
4926 …$this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['binding'] = $this->…
4927this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['endpoint'] = isset($
4931 $this->opStatus = 'input';
4934 $this->opStatus = 'output';
4937 …if (isset($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opS…
4938this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = ar…
4940 …$this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = $…
4948 $this->currentPort = $attrs['name'];
4949 $this->debug('current port: ' . $this->currentPort);
4950 $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']);
4954 $this->ports[$this->currentPort]['location'] = $attrs['location'];
4955 $this->ports[$this->currentPort]['bindingType'] = $namespace;
4956 … $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace;
4957 … $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location'];
4966 … $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false);
4967 …$this->debug('parsing import ' . $attrs['namespace']. ' - ' . $attrs['location'] . ' (' . count($t…
4969 … $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true);
4970 if (! $this->getPrefixFromNamespace($attrs['namespace'])) {
4971 $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace'];
4973 …$this->debug('parsing import ' . $attrs['namespace']. ' - [no location] (' . count($this->import[$…
4981 $this->status = 'message';
4982 $this->messages[$attrs['name']] = array();
4983 $this->currentMessage = $attrs['name'];
4986 $this->status = 'portType';
4987 $this->portTypes[$attrs['name']] = array();
4988 $this->currentPortType = $attrs['name'];
4994 $this->currentBinding = $this->getLocalPart($attrs['name']);
4996 $this->currentBinding = $attrs['name'];
4998 $this->status = 'binding';
4999 $this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']);
5000 $this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']);
5004 $this->serviceName = $attrs['name'];
5005 $this->status = 'service';
5006 $this->debug('current service: ' . $this->serviceName);
5010 $this->wsdl_info[$name] = $value;
5027 $this->status = "";
5028 $this->appendDebug($this->currentSchema->getDebug());
5029 $this->currentSchema->clearDebug();
5030 $this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema;
5031 $this->debug('Parsing WSDL schema done');
5033 if ($this->status == 'schema') {
5034 $this->currentSchema->schemaEndElement($parser, $name);
5037 $this->depth--;
5040 if ($this->documentation) {
5043 $this->documentation = false;
5056 $pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0;
5057 if (isset($this->message[$pos]['cdata'])) {
5058 $this->message[$pos]['cdata'] .= $data;
5060 if ($this->documentation) {
5061 $this->documentation .= $data;
5075 $this->debug("setCredentials username=$username authtype=$authtype certRequest=");
5076 $this->appendDebug($this->varDump($certRequest));
5077 $this->username = $username;
5078 $this->password = $password;
5079 $this->authtype = $authtype;
5080 $this->certRequest = $certRequest;
5085 if (is_array($this->bindings[$binding])) {
5086 return $this->bindings[$binding];
5105 foreach($this->ports as $port => $portData) {
5112 if (isset($this->bindings[ $portData['binding'] ]['operations'])) {
5113 $ops = array_merge ($ops, $this->bindings[ $portData['binding'] ]['operations']);
5136 foreach($this->ports as $port => $portData) {
5141 foreach(array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) {
5144 $opData = $this->bindings[ $portData['binding'] ]['operations'][$operation];
5167 foreach($this->ports as $port => $portData) {
5171 foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
5199 $this->debug("in getTypeDef: type=$type, ns=$ns");
5200 if ((! $ns) && isset($this->namespaces['tns'])) {
5201 $ns = $this->namespaces['tns'];
5202 $this->debug("in getTypeDef: type namespace forced to $ns");
5204 if (!isset($this->schemas[$ns])) {
5205 foreach ($this->schemas as $ns0 => $schema0) {
5207 $this->debug("in getTypeDef: replacing schema namespace $ns with $ns0");
5213 if (isset($this->schemas[$ns])) {
5214 $this->debug("in getTypeDef: have schema for namespace $ns");
5215 for ($i = 0; $i < count($this->schemas[$ns]); $i++) {
5216 $xs = &$this->schemas[$ns][$i];
5225 $etype = $this->getTypeDef($uqType, $ns);
5227 $this->debug("found type for [element] $type:");
5228 $this->debug($this->varDump($etype));
5244 $this->debug("in getTypeDef: do not have schema for namespace $ns");
5262 $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
5266 <html><head><title>NuSOAP: '.$this->serviceName.'</title>
5342 <div class=title>'.$this->serviceName.'</div>
5347 foreach($this->getOperations() as $op => $data){
5391 foreach($this->namespaces as $k => $v) {
5395 if (isset($this->namespaces['wsdl'])) {
5396 $xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\"";
5398 if (isset($this->namespaces['tns'])) {
5399 $xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\"";
5403 if (sizeof($this->import) > 0) {
5404 foreach($this->import as $ns => $list) {
5415 if (count($this->schemas)>=1) {
5417 foreach ($this->schemas as $ns => $list) {
5425 if (count($this->messages) >= 1) {
5426 foreach($this->messages as $msgName => $msgParts) {
5432 $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType));
5433 } elseif (isset($this->typemap[$this->namespaces['xsd']][$partType])) {
5437 foreach($this->typemap as $ns => $types) {
5439 $typePrefix = $this->getPrefixFromNamespace($ns);
5446 $ns = $this->getNamespaceFromPrefix($typePrefix);
5447 $localPart = $this->getLocalPart($partType);
5448 $typeDef = $this->getTypeDef($localPart, $ns);
5464 if (count($this->bindings) >= 1) {
5467 foreach($this->bindings as $bindingName => $attrs) {
5505 $xml .= "\n<service name=\"" . $this->serviceName . '">';
5506 if (count($this->ports) >= 1) {
5507 foreach($this->ports as $pName => $attrs) {
5527 $this->debug("in parametersMatchWrapped type=$type, parameters=");
5528 $this->appendDebug($this->varDump($parameters));
5534 $this->debug("in parametersMatchWrapped: got a prefixed type: $uqType, $ns");
5535 if ($this->getNamespaceFromPrefix($ns)) {
5536 $ns = $this->getNamespaceFromPrefix($ns);
5537 $this->debug("in parametersMatchWrapped: expanded prefixed type: $uqType, $ns");
5542 $this->debug("in parametersMatchWrapped: No namespace for type $type");
5548 if (!$typeDef = $this->getTypeDef($uqType, $ns)) {
5549 $this->debug("in parametersMatchWrapped: $type ($uqType) is not a supported type.");
5552 $this->debug("in parametersMatchWrapped: found typeDef=");
5553 $this->appendDebug($this->varDump($typeDef));
5559 …$this->debug("in parametersMatchWrapped: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: $…
5563 $this->debug("in parametersMatchWrapped: not a struct");
5572 …if ($this->isArraySimpleOrStruct($parameters) == 'arraySimple' && count($parameters) == count($typ…
5573 …$this->debug("in parametersMatchWrapped: (wrapped return value kludge) correct number of elements …
5578 $this->debug("in parametersMatchWrapped: change parameter $element to name $name");
5583 $this->debug("in parametersMatchWrapped: have parameter named $name");
5586 $this->debug("in parametersMatchWrapped: do not have parameter named $name");
5591 …$this->debug("in parametersMatchWrapped: $matches parameter names match $elements wrapped paramete…
5600 $this->debug("in parametersMatchWrapped: no elements type $ns:$uqType");
5620 …$this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVers…
5621 $this->appendDebug('parameters=' . $this->varDump($parameters));
5624 $this->debug('The value of the \$direction argument needs to be either "input" or "output"');
5625 $this->setError('The value of the \$direction argument needs to be either "input" or "output"');
5628 if (!$opData = $this->getOperationData($operation, $bindingType)) {
5629 …$this->debug('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bin…
5630 …$this->setError('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $…
5633 $this->debug('in serializeRPCParameters: opData:');
5634 $this->appendDebug($this->varDump($opData));
5660 if ($this->parametersMatchWrapped($parts['parameters'], $parameters)) {
5661 $this->debug('wrap the parameters for the caller');
5668 $this->debug("serializing part $name of type $type");
5680 $this->debug('calling serializeType w/indexed param');
5681 $xml .= $this->serializeType($name, $type, $p, $use, $enc_style);
5683 $this->debug('calling serializeType w/named param');
5684 $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style);
5687 $this->debug('calling serializeType w/null param');
5688 $xml .= $this->serializeType($name, $type, null, $use, $enc_style);
5692 $this->debug('no parameters passed.');
5695 $this->debug("serializeRPCParameters returning: $xml");
5715 …$this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion…
5716 $this->appendDebug('parameters=' . $this->varDump($parameters));
5719 $this->debug('The value of the \$direction argument needs to be either "input" or "output"');
5720 $this->setError('The value of the \$direction argument needs to be either "input" or "output"');
5723 if (!$opData = $this->getOperationData($operation)) {
5724 $this->debug('Unable to retrieve WSDL data for operation: ' . $operation);
5725 $this->setError('Unable to retrieve WSDL data for operation: ' . $operation);
5728 $this->debug('opData:');
5729 $this->appendDebug($this->varDump($opData));
5841 $this->debug('in serializeType: type namespace indicates XML Schema or SOAP Encoding type');
5853 …$xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$u…
5855 $this->debug("in serializeType: returning: $xml");
5860 return $this->serialize_val($value, $name, false, false, false, false, $use);
5877 $value = $this->expandEntities($value);
5886 if (!$this->getTypeDef($uqType, $ns)) {
5889 …$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$…
5905 …$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingS…
5907 $this->debug("in serializeType: returning: $xml");
5910 $this->debug('custom type extends XML Schema or SOAP Encoding namespace (yuck)');
5916 $this->debug('in serializeType: Add namespace for Apache SOAP type');
5918 $this->namespaces[$tt_prefix] = 'http://xml.apache.org/xml-soap';
5924 $this->debug("serializing map element: key $k, value $v");
5926 $contents .= $this->serialize_val($k,'key',false,false,false,false,$use);
5927 $contents .= $this->serialize_val($v,'value',false,false,false,false,$use);
5939 $this->debug("in serializeType: returning: $xml");
5942 $this->debug('in serializeType: Apache SOAP type, but only support Map');
5947 $this->debug("in serializeType: No namespace for type $type");
5951 if(!$typeDef = $this->getTypeDef($uqType, $ns)){
5952 $this->setError("$type ($uqType) is not a supported type.");
5953 $this->debug("in serializeType: $type ($uqType) is not a supported type.");
5956 $this->debug("in serializeType: found typeDef");
5957 $this->appendDebug('typeDef=' . $this->varDump($typeDef));
5963 …$this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset…
5986 …$xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns)…
5988 $this->debug("in serializeType: returning: $xml");
5995 $elementAttrs = $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType);
5998 …$xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . "…
6003 …$xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . "…
6006 … $xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle);
6009 $this->debug("in serializeType: phpType is struct, but value is not an array");
6010 $this->setError("phpType is struct, but value is not an array: see debug output for details");
6029 $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') .
6033 $this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) .
6035 $this->getLocalPart($typeDef['arrayType'])."[0]\"/>";
6037 $this->debug("in serializeType: returning: $xml");
6054 $this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]");
6056 if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) {
6074 $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/')
6076 .$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType']))
6077 .":".$this->getLocalPart($typeDef['arrayType'])."[$rows$cols]\">"
6093 …$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$…
6098 …$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingS…
6101 $this->debug("in serializeType: returning: $xml");
6118 $this->debug("serialize attributes for XML Schema type $ns:$uqType");
6124 $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType");
6130 $this->debug("value provided for attribute $aName with key $xname");
6133 $this->debug("value provided for attribute $aName with key $xname");
6137 $this->debug('use default value of ' . $xvalue[$aName] . ' for attribute ' . $aName);
6140 $this->debug("no value provided for attribute $aName");
6143 $xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\"";
6147 $this->debug("no attributes to serialize for XML Schema type $ns:$uqType");
6150 $ns = $this->getPrefix($typeDef['extensionBase']);
6151 $uqType = $this->getLocalPart($typeDef['extensionBase']);
6152 if ($this->getNamespaceFromPrefix($ns)) {
6153 $ns = $this->getNamespaceFromPrefix($ns);
6155 if ($typeDef = $this->getTypeDef($uqType, $ns)) {
6156 $this->debug("serialize attributes for extension base $ns:$uqType");
6157 $xml .= $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType);
6159 $this->debug("extension base $ns:$uqType is not a supported type");
6180 …$this->debug("in serializeComplexTypeElements, serialize elements for XML Schema type $ns:$uqType"…
6186 $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType");
6197 $this->debug('use default value of ' . $xvalue[$eName] . ' for element ' . $eName);
6206 …$this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minO…
6209 …$this->debug("no value provided for complexType element $eName and element is not nillable, so ser…
6222 … 'unbounded' || $attrs['maxOccurs'] > 1) && isset($v) && is_array($v) && $this->isArraySimpleOrStr…
6227 …$xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $…
6230 $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use");
6231 $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use);
6237 …$xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $…
6240 $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use");
6241 $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use);
6247 $this->debug("no elements to serialize for XML Schema type $ns:$uqType");
6250 $ns = $this->getPrefix($typeDef['extensionBase']);
6251 $uqType = $this->getLocalPart($typeDef['extensionBase']);
6252 if ($this->getNamespaceFromPrefix($ns)) {
6253 $ns = $this->getNamespaceFromPrefix($ns);
6255 if ($typeDef = $this->getTypeDef($uqType, $ns)) {
6256 $this->debug("serialize elements for extension base $ns:$uqType");
6257 … $xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle);
6259 $this->debug("extension base $ns:$uqType is not a supported type");
6286 $k = strpos($k,':') ? $this->expandQname($k) : $k;
6287 $v = strpos($v,':') ? $this->expandQname($v) : $v;
6299 $k = strpos($k,':') ? $this->expandQname($k) : $k;
6300 $v = strpos($v,':') ? $this->expandQname($v) : $v;
6308 …$restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrict…
6309 $arrayType = strpos($arrayType,':') ? $this->expandQname($arrayType) : $arrayType;
6311 …$typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'…
6312 …$this->schemas[$typens][0]->addComplexType($name,$typeClass,$phpType,$compositor,$restrictionBase,…
6327 …$restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrict…
6329 …$typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'…
6330 …$this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumerat…
6341 …$typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'…
6342 $this->schemas[$typens][0]->addElement($attrs);
6412 … $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType);
6414 $this->messages[$name.'Request'][$pName] = $pType;
6417 $this->messages[$name.'Request']= '0';
6424 … $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType);
6426 $this->messages[$name.'Response'][$pName] = $pType;
6429 $this->messages[$name.'Response']= '0';
6494 $this->xml = $xml;
6495 $this->xml_encoding = $encoding;
6496 $this->method = $method;
6497 $this->decode_utf8 = $decode_utf8;
6509 $this->debug($err);
6511 $this->setError($err);
6516 $this->debug('Charset from HTTP Content-Type matches encoding from XML declaration');
6519 $this->debug('No encoding specified in XML declaration');
6522 $this->debug('No XML declaration');
6524 $this->debug('Entering nusoap_parser(), length='.strlen($xml).', encoding='.$encoding);
6526 $this->parser = xml_parser_create($this->xml_encoding);
6529 xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
6530 xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding);
6532 xml_set_object($this->parser, $this);
6534 xml_set_element_handler($this->parser, 'start_element','end_element');
6535 xml_set_character_data_handler($this->parser,'character_data');
6538 if(!xml_parse($this->parser,$xml,true)){
6541 xml_get_current_line_number($this->parser),
6542 xml_error_string(xml_get_error_code($this->parser)));
6543 $this->debug($err);
6544 $this->debug("XML payload:\n" . $xml);
6545 $this->setError($err);
6547 …$this->debug('parsed successfully, found root struct: '.$this->root_struct.' of name '.$this->root…
6549 $this->soapresponse = $this->message[$this->root_struct]['result'];
6551 if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){
6552 $this->soapheader = $this->message[$this->root_header]['result'];
6555 if(sizeof($this->multirefs) > 0){
6556 foreach($this->multirefs as $id => $hrefs){
6557 $this->debug('resolving multirefs for id: '.$id);
6558 $idVal = $this->buildVal($this->ids[$id]);
6563 $this->debug('resolving href at pos '.$refPos);
6564 $this->multirefs[$id][$refPos] = $idVal;
6569 xml_parser_free($this->parser);
6571 $this->debug('xml was empty, didn\'t parse!');
6572 $this->setError('xml was empty, didn\'t parse!');
6587 $pos = $this->position++;
6589 $this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>'');
6592 $this->message[$pos]['depth'] = $this->depth++;
6596 $this->message[$this->parent]['children'] .= '|'.$pos;
6599 $this->message[$pos]['parent'] = $this->parent;
6601 $this->parent = $pos;
6603 $this->depth_array[$this->depth] = $pos;
6613 $this->status = 'envelope';
6614 } elseif($name == 'Header' && $this->status = 'envelope'){
6615 $this->root_header = $pos;
6616 $this->status = 'header';
6617 } elseif($name == 'Body' && $this->status = 'envelope'){
6618 $this->status = 'body';
6619 $this->body_position = $pos;
6621 } elseif($this->status == 'body' && $pos == ($this->body_position+1)){
6622 $this->status = 'method';
6623 $this->root_struct_name = $name;
6624 $this->root_struct = $pos;
6625 $this->message[$pos]['type'] = 'struct';
6626 $this->debug("found root struct $this->root_struct_name, pos $this->root_struct");
6629 $this->message[$pos]['status'] = $this->status;
6631 $this->message[$pos]['name'] = htmlspecialchars($name);
6633 $this->message[$pos]['attrs'] = $attrs;
6638 $key_prefix = $this->getPrefix($key);
6639 $key_localpart = $this->getLocalPart($key);
6643 $this->XMLSchemaVersion = $value;
6644 $this->namespaces['xsd'] = $this->XMLSchemaVersion;
6645 $this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance';
6647 $this->namespaces[$key_localpart] = $value;
6649 if($name == $this->root_struct_name){
6650 $this->methodNamespace = $value;
6654 if (isset($this->message[$pos]['type']) && $this->message[$pos]['type'] == 'array') {
6657 $value_prefix = $this->getPrefix($value);
6658 $value_localpart = $this->getLocalPart($value);
6659 $this->message[$pos]['type'] = $value_localpart;
6660 $this->message[$pos]['typePrefix'] = $value_prefix;
6661 if(isset($this->namespaces[$value_prefix])){
6662 $this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix];
6664 $this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix];
6669 $this->message[$pos]['type'] = 'array';
6680 $this->message[$pos]['typePrefix'] = $regs[1];
6681 $this->message[$pos]['arrayTypePrefix'] = $regs[1];
6682 if (isset($this->namespaces[$regs[1]])) {
6683 $this->message[$pos]['arrayTypeNamespace'] = $this->namespaces[$regs[1]];
6685 $this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:'.$regs[1]];
6687 $this->message[$pos]['arrayType'] = $regs[2];
6688 $this->message[$pos]['arraySize'] = $regs[3];
6689 $this->message[$pos]['arrayCols'] = $regs[4];
6693 $this->message[$pos]['nil'] = ($value == 'true' || $value == '1');
6696 $this->message[$pos]['xattrs']['!' . $key] = $value;
6700 $this->default_namespace = $value;
6704 $this->ids[$value] = $pos;
6708 $this->status = 'method';
6709 $this->root_struct_name = $name;
6710 $this->root_struct = $pos;
6711 $this->debug("found root struct $this->root_struct_name, pos $pos");
6718 $this->message[$pos]['namespace'] = $this->namespaces[$prefix];
6719 $this->default_namespace = $this->namespaces[$prefix];
6721 $this->message[$pos]['namespace'] = $this->default_namespace;
6723 if($this->status == 'header'){
6724 if ($this->root_header != $pos) {
6725 $this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
6727 } elseif($this->root_struct_name != ''){
6728 $this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
6741 $pos = $this->depth_array[$this->depth--];
6752 if(isset($this->body_position) && $pos > $this->body_position){
6754 if(isset($this->message[$pos]['attrs']['href'])){
6756 $id = substr($this->message[$pos]['attrs']['href'],1);
6758 $this->multirefs[$id][$pos] = 'placeholder';
6760 $this->message[$pos]['result'] =& $this->multirefs[$id][$pos];
6762 } elseif($this->message[$pos]['children'] != ''){
6764 if(!isset($this->message[$pos]['result'])){
6765 $this->message[$pos]['result'] = $this->buildVal($pos);
6768 } elseif (isset($this->message[$pos]['xattrs'])) {
6769 if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
6770 $this->message[$pos]['xattrs']['!'] = null;
6771 } elseif (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
6772 if (isset($this->message[$pos]['type'])) {
6773this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->mes…
6775 $parent = $this->message[$pos]['parent'];
6776 …if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isse…
6777this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->mes…
6779 $this->message[$pos]['xattrs']['!'] = $this->message[$pos]['cdata'];
6783 $this->message[$pos]['result'] = $this->message[$pos]['xattrs'];
6787 if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
6788 $this->message[$pos]['xattrs']['!'] = null;
6789 } elseif (isset($this->message[$pos]['type'])) {
6790this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[…
6792 $parent = $this->message[$pos]['parent'];
6793 …if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isse…
6794this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[…
6796 $this->message[$pos]['result'] = $this->message[$pos]['cdata'];
6814 if($this->status == 'header'){
6815 if ($this->root_header != $pos) {
6816 $this->responseHeaders .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
6818 } elseif($pos >= $this->root_struct){
6819 $this->document .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
6822 if($pos == $this->root_struct){
6823 $this->status = 'body';
6824 $this->root_struct_namespace = $this->message[$pos]['namespace'];
6826 $this->status = 'envelope';
6828 $this->status = 'envelope';
6833 $this->parent = $this->message[$pos]['parent'];
6844 $pos = $this->depth_array[$this->depth];
6845 if ($this->xml_encoding=='UTF-8'){
6849 if($this->decode_utf8){
6853 $this->message[$pos]['cdata'] .= $data;
6855 if($this->status == 'header'){
6856 $this->responseHeaders .= $data;
6858 $this->document .= $data;
6870 return $this->soapresponse;
6880 return $this->soapresponse;
6890 return $this->soapheader;
6900 return $this->responseHeaders;
6930 $this->debug('Decode base64 value');
6957 if(!isset($this->message[$pos]['type'])){
6958 $this->message[$pos]['type'] = '';
6960 …$this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->messag…
6962 if($this->message[$pos]['children'] != ''){
6963 $this->debug('in buildVal, there are children');
6964 $children = explode('|',$this->message[$pos]['children']);
6967 if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){
6971 $this->debug("in buildVal, got an MD array element: $r, $c");
6972 $params[$r][] = $this->message[$child_pos]['result'];
6974 if($c == $this->message[$pos]['arrayCols']){
6980 } elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){
6981 $this->debug('in buildVal, adding array '.$this->message[$pos]['name']);
6983 $params[] = &$this->message[$child_pos]['result'];
6986 …} elseif($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http:…
7005 $params[] = &$this->message[$child_pos]['result'];
7007 if (isset($params[$this->message[$child_pos]['name']])) {
7009 …if ((!is_array($params[$this->message[$child_pos]['name']])) || (!isset($params[$this->message[$ch…
7010 … $params[$this->message[$child_pos]['name']] = array($params[$this->message[$child_pos]['name']]);
7012 … $params[$this->message[$child_pos]['name']][] = &$this->message[$child_pos]['result'];
7014 $params[$this->message[$child_pos]['name']] = &$this->message[$child_pos]['result'];
7019 if (isset($this->message[$pos]['xattrs'])) {
7020 $this->debug('in buildVal, handling attributes');
7021 foreach ($this->message[$pos]['xattrs'] as $n => $v) {
7026 if (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
7027 $this->debug('in buildVal, handling simpleContent');
7028 if (isset($this->message[$pos]['type'])) {
7029 …s['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($t…
7031 $parent = $this->message[$pos]['parent'];
7032 …if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isse…
7033 … $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($t…
7035 $params['!'] = $this->message[$pos]['cdata'];
7040 $this->debug('in buildVal, return:');
7041 $this->appendDebug($this->varDump($ret));
7044 $this->debug('in buildVal, no children, building scalar');
7045 $cdata = isset($this->message[$pos]['cdata']) ? $this->message[$pos]['cdata'] : '';
7046 if (isset($this->message[$pos]['type'])) {
7047 …$ret = $this->decodeSimple($cdata, $this->message[$pos]['type'], isset($this->message[$pos]['type_…
7048 $this->debug("in buildVal, return: $ret");
7051 $parent = $this->message[$pos]['parent'];
7052 …if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isse…
7053 …$ret = $this->decodeSimple($cdata, $this->message[$parent]['arrayType'], isset($this->message[$par…
7054 $this->debug("in buildVal, return: $ret");
7057 $ret = $this->message[$pos]['cdata'];
7058 $this->debug("in buildVal, return: $ret");
7167 $this->endpoint = $endpoint;
7168 $this->proxyhost = $proxyhost;
7169 $this->proxyport = $proxyport;
7170 $this->proxyusername = $proxyusername;
7171 $this->proxypassword = $proxypassword;
7172 $this->timeout = $timeout;
7173 $this->response_timeout = $response_timeout;
7175 $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout");
7176 $this->appendDebug('endpoint=' . $this->varDump($endpoint));
7181 $this->wsdl = $endpoint;
7182 $this->endpoint = $this->wsdl->wsdl;
7183 $this->wsdlFile = $this->endpoint;
7184 $this->debug('existing wsdl instance created from ' . $this->endpoint);
7185 $this->checkWSDL();
7187 $this->wsdlFile = $this->endpoint;
7188 $this->wsdl = null;
7189 $this->debug('will use lazy evaluation of wsdl from ' . $this->endpoint);
7191 $this->endpointType = 'wsdl';
7193 $this->debug("instantiate SOAP with endpoint at $endpoint");
7194 $this->endpointType = 'soap';
7329 $this->debug("wrapping RPC request with literal method element");
7339 $this->debug("wrapping RPC request with encoded method element");
7352 …$soapmsg = $this->serializeEnvelope($payload,$this->requestHeaders,$usedNamespaces,$style,$use,$en…
7353 …$this->debug("endpoint=$this->endpoint, soapAction=$soapAction, namespace=$namespace, style=$style…
7354 …$this->debug('SOAP message length=' . strlen($soapmsg) . ' contents (max 1000 bytes)=' . substr($s…
7356 …$return = $this->send($this->getHTTPBody($soapmsg),$soapAction,$this->timeout,$this->response_time…
7357 if($errstr = $this->getError()){
7358 $this->debug('Error: '.$errstr);
7361 $this->return = $return;
7362 $this->debug('sent message successfully and got a(n) '.gettype($return));
7363 $this->appendDebug('return=' . $this->varDump($return));
7367 $this->debug('got fault');
7368 $this->setError($return['faultcode'].': '.$return['faultstring']);
7369 $this->fault = true;
7371 $this->$k = $v;
7372 $this->debug("$k = $v<br>");
7389 $this->debug('return shifted value: ');
7390 $this->appendDebug($this->varDump($return));
7406 $this->appendDebug($this->wsdl->getDebug());
7407 $this->wsdl->clearDebug();
7408 $this->debug('checkWSDL');
7410 if ($errstr = $this->wsdl->getError()) {
7411 $this->debug('got wsdl error: '.$errstr);
7412 $this->setError('wsdl error: '.$errstr);
7413 } elseif ($this->operations = $this->wsdl->getOperations('soap')) {
7414 $this->bindingType = 'soap';
7415 …$this->debug('got '.count($this->operations).' operations from wsdl '.$this->wsdlFile.' for bindin…
7416 } elseif ($this->operations = $this->wsdl->getOperations('soap12')) {
7417 $this->bindingType = 'soap12';
7418 …$this->debug('got '.count($this->operations).' operations from wsdl '.$this->wsdlFile.' for bindin…
7419 $this->debug('**************** WARNING: SOAP 1.2 BINDING *****************');
7421 $this->debug('getOperations returned false');
7422 $this->setError('no operations defined in the WSDL document!');
7432 $this->debug('instantiating wsdl class with doc: '.$this->wsdlFile);
7433this->wsdl =& new wsdl('',$this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassw…
7434 …$this->wsdl->setCredentials($this->username, $this->password, $this->authtype, $this->certRequest);
7435 $this->wsdl->fetchWSDL($this->wsdlFile);
7436 $this->checkWSDL();
7447 if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) {
7448 $this->loadWSDL();
7449 if ($this->getError())
7452 if(isset($this->operations[$operation])){
7453 return $this->operations[$operation];
7455 $this->debug("No data for operation: $operation");
7473 $this->checkCookies();
7477 case ereg('^http',$this->endpoint):
7478 $this->debug('transporting via HTTP');
7479 if($this->persistentConnection == true && is_object($this->persistentConnection)){
7480 $http =& $this->persistentConnection;
7482 $http = new soap_transport_http($this->endpoint, $this->curl_options, $this->use_curl);
7483 if ($this->persistentConnection) {
7487 $http->setContentType($this->getHTTPContentType(), $this->getHTTPContentTypeCharset());
7489 if($this->proxyhost && $this->proxyport){
7490 $http->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword);
7492 if($this->authtype != '') {
7493 …$http->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certReque…
7495 if($this->http_encoding != ''){
7496 $http->setEncoding($this->http_encoding);
7498 $this->debug('sending message, length='.strlen($msg));
7499 if(ereg('^http:',$this->endpoint)){
7501 $this->responseData = $http->send($msg,$timeout,$response_timeout,$this->cookies);
7502 } elseif(ereg('^https',$this->endpoint)){
7509 $this->responseData = $http->sendHTTPS($msg,$timeout,$response_timeout,$this->cookies);
7511 $this->setError('no http/s in endpoint url');
7513 $this->request = $http->outgoing_payload;
7514 $this->response = $http->incoming_payload;
7515 $this->appendDebug($http->getDebug());
7516 $this->UpdateCookies($http->incoming_cookies);
7519 if ($this->persistentConnection) {
7521 if (!is_object($this->persistentConnection)) {
7522 $this->persistentConnection = $http;
7527 $this->setError('HTTP Error: '.$err);
7529 } elseif($this->getError()){
7532 …$this->debug('got response, length='. strlen($this->responseData).' type='.$http->incoming_headers…
7533 return $this->parseResponse($http->incoming_headers, $this->responseData);
7537 $this->setError('no transport found, or selected transport is not yet supported!');
7552 $this->debug('Entering parseResponse() for data of length ' . strlen($data) . ' headers:');
7553 $this->appendDebug($this->varDump($headers));
7555 $this->setError('Response not of type text/xml: ' . $headers['content-type']);
7560 $this->debug('Got response encoding: ' . $enc);
7562 $this->xml_encoding = strtoupper($enc);
7564 $this->xml_encoding = 'US-ASCII';
7568 $this->xml_encoding = 'ISO-8859-1';
7570 $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser');
7571 $parser = new nusoap_parser($data,$this->xml_encoding,$this->operation,$this->decode_utf8);
7573 $this->appendDebug($parser->getDebug());
7576 $this->setError( $errstr);
7582 $this->responseHeaders = $parser->getHeaders();
7584 $this->responseHeader = $parser->get_soapheader();
7588 $this->document = $parser->document;
7604 $this->debug("setCurlOption option=$option, value=");
7605 $this->appendDebug($this->varDump($value));
7606 $this->curl_options[$option] = $value;
7616 $this->debug("setEndpoint(\"$endpoint\")");
7617 $this->forceEndpoint = $endpoint;
7627 $this->debug("setHeaders headers=");
7628 $this->appendDebug($this->varDump($headers));
7629 $this->requestHeaders = $headers;
7639 return $this->responseHeaders;
7649 return $this->responseHeader;
7662 $this->proxyhost = $proxyhost;
7663 $this->proxyport = $proxyport;
7664 $this->proxyusername = $proxyusername;
7665 $this->proxypassword = $proxypassword;
7678 $this->debug("setCredentials username=$username authtype=$authtype certRequest=");
7679 $this->appendDebug($this->varDump($certRequest));
7680 $this->username = $username;
7681 $this->password = $password;
7682 $this->authtype = $authtype;
7683 $this->certRequest = $certRequest;
7693 $this->debug("setHTTPEncoding(\"$enc\")");
7694 $this->http_encoding = $enc;
7704 $this->debug("setUseCURL($use)");
7705 $this->use_curl = $use;
7714 $this->debug("useHTTPPersistentConnection");
7715 $this->persistentConnection = true;
7730 return $this->defaultRpcParams;
7745 $this->defaultRpcParams = $rpcParams;
7757 $evalStr = $this->_getProxyClassCode($r);
7759 if ($this->getError()) {
7760 $this->debug("Error from _getProxyClassCode, so return NULL");
7769 $proxy->wsdlFile = $this->wsdlFile;
7770 $proxy->wsdl = $this->wsdl;
7771 $proxy->operations = $this->operations;
7772 $proxy->defaultRpcParams = $this->defaultRpcParams;
7774 $proxy->soap_defencoding = $this->soap_defencoding;
7775 $proxy->username = $this->username;
7776 $proxy->password = $this->password;
7777 $proxy->authtype = $this->authtype;
7778 $proxy->certRequest = $this->certRequest;
7779 $proxy->requestHeaders = $this->requestHeaders;
7780 $proxy->endpoint = $this->endpoint;
7781 $proxy->forceEndpoint = $this->forceEndpoint;
7782 $proxy->proxyhost = $this->proxyhost;
7783 $proxy->proxyport = $this->proxyport;
7784 $proxy->proxyusername = $this->proxyusername;
7785 $proxy->proxypassword = $this->proxypassword;
7786 $proxy->http_encoding = $this->http_encoding;
7787 $proxy->timeout = $this->timeout;
7788 $proxy->response_timeout = $this->response_timeout;
7789 $proxy->persistentConnection = &$this->persistentConnection;
7790 $proxy->decode_utf8 = $this->decode_utf8;
7791 $proxy->curl_options = $this->curl_options;
7792 $proxy->bindingType = $this->bindingType;
7793 $proxy->use_curl = $this->use_curl;
7804 $this->debug("in getProxy endpointType=$this->endpointType");
7805 $this->appendDebug("wsdl=" . $this->varDump($this->wsdl));
7806 if ($this->endpointType != 'wsdl') {
7808 $this->setError($evalStr);
7812 if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) {
7813 $this->loadWSDL();
7814 if ($this->getError()) {
7815 return "echo \"" . $this->getError() . "\";";
7819 foreach ($this->operations as $operation => $opData) {
8003 for ($i = 0; $i < count($this->cookies); $i++) {
8004 $cookie = $this->cookies[$i];
8024 $this->cookies[$i] = $newCookie;
8026 $this->debug('Update cookie ' . $newName . '=' . $newCookie['value']);
8030 $this->debug('Add cookie ' . $newName . '=' . $newCookie['value']);
8031 $this->cookies[] = $newCookie;