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

159 	 * whether to append debug to response as XML comment
176 global $debug;
180 $this->debug("_SERVER is defined:");
181 $this->appendDebug($this->varDump($_SERVER));
183 $this->debug("HTTP_SERVER_VARS is defined:");
184 $this->appendDebug($this->varDump($HTTP_SERVER_VARS));
186 $this->debug("Neither _SERVER nor HTTP_SERVER_VARS is defined.");
189 if (isset($debug)) {
190 $this->debug("In nusoap_server, set debug_flag=$debug based on global flag");
191 $this->debug_flag = $debug;
195 if (substr($v, 0, 6) == 'debug=') {
196 … $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #1");
197 $this->debug_flag = substr($v, 6);
203 if (substr($v, 0, 6) == 'debug=') {
204 … $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #2");
205 $this->debug_flag = substr($v, 6);
212 $this->debug("In nusoap_server, WSDL is specified");
214 $this->wsdl = $wsdl;
215 $this->externalWSDLURL = $this->wsdl->wsdl;
216 $this->debug('Use existing wsdl instance from ' . $this->externalWSDLURL);
218 $this->debug('Create wsdl from ' . $wsdl);
219 $this->wsdl = new wsdl($wsdl);
220 $this->externalWSDLURL = $wsdl;
222 $this->appendDebug($this->wsdl->getDebug());
223 $this->wsdl->clearDebug();
224 if($err = $this->wsdl->getError()){
246 $this->debug("In service, query string=$qs");
249 $this->debug("In service, this is a request for WSDL");
250 if($this->externalWSDLURL){
251 if (strpos($this->externalWSDLURL,"://")!==false) { // assume URL
252 header('Location: '.$this->externalWSDLURL);
254 header("Content-Type: text/xml\r\n");
255 $fp = fopen($this->externalWSDLURL, 'r');
258 } elseif ($this->wsdl) {
259 header("Content-Type: text/xml; charset=ISO-8859-1\r\n");
260 print $this->wsdl->serialize($this->debug_flag);
261 if ($this->debug_flag) {
262 $this->debug('wsdl:');
263 $this->appendDebug($this->varDump($this->wsdl));
264 print $this->getDebugAsXMLComment();
267 header("Content-Type: text/html; charset=ISO-8859-1\r\n");
270 } elseif ($data == '' && $this->wsdl) {
271 $this->debug("In service, there is no data, so return Web description");
272 print $this->wsdl->webDescription();
274 $this->debug("In service, invoke the request");
275 $this->parse_request($data);
276 if (! $this->fault) {
277 $this->invoke_method();
279 if (! $this->fault) {
280 $this->serialize_return();
282 $this->send_response();
301 $this->request = '';
302 $this->SOAPAction = '';
304 $this->debug("In parse_http_headers, use getallheaders");
308 $this->headers[$k] = $v;
309 $this->request .= "$k: $v\r\n";
310 $this->debug("$k: $v");
313 if(isset($this->headers['soapaction'])){
314 $this->SOAPAction = str_replace('"','',$this->headers['soapaction']);
317 if(isset($this->headers['content-type']) && strpos($this->headers['content-type'],'=')){
318 $enc = str_replace('"','',substr(strstr($this->headers["content-type"],'='),1));
319 if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
320 $this->xml_encoding = strtoupper($enc);
322 $this->xml_encoding = 'US-ASCII';
325 // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
326 $this->xml_encoding = 'ISO-8859-1';
329 $this->debug("In parse_http_headers, use _SERVER");
332 $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5))));
334 $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k)));
341 $this->SOAPAction = $v;
342 } else if ($k == 'content-type') {
348 if (eregi('^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
349 $this->xml_encoding = strtoupper($enc);
351 $this->xml_encoding = 'US-ASCII';
354 // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
355 $this->xml_encoding = 'ISO-8859-1';
358 $this->headers[$k] = $v;
359 $this->request .= "$k: $v\r\n";
360 $this->debug("$k: $v");
363 $this->debug("In parse_http_headers, use HTTP_SERVER_VARS");
366 …$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); …
368 …$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); …
375 $this->SOAPAction = $v;
376 } else if ($k == 'content-type') {
382 if (eregi('^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
383 $this->xml_encoding = strtoupper($enc);
385 $this->xml_encoding = 'US-ASCII';
388 // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
389 $this->xml_encoding = 'ISO-8859-1';
392 $this->headers[$k] = $v;
393 $this->request .= "$k: $v\r\n";
394 $this->debug("$k: $v");
397 $this->debug("In parse_http_headers, HTTP headers not accessible");
398 $this->setError("HTTP headers not accessible");
425 $this->debug('entering parse_request()');
426 $this->parse_http_headers();
427 $this->debug('got character encoding: '.$this->xml_encoding);
429 if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] != '') {
430 $this->debug('got content encoding: ' . $this->headers['content-encoding']);
431 …if ($this->headers['content-encoding'] == 'deflate' || $this->headers['content-encoding'] == 'gzip…
434 if ($this->headers['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) {
436 …} elseif ($this->headers['content-encoding'] == 'gzip' && $degzdata = gzinflate(substr($data, 10))…
439 $this->fault('SOAP-ENV:Client', 'Errors occurred when trying to decode the data');
443 $this->fault('SOAP-ENV:Client', 'This Server does not support compressed data');
448 $this->request .= "\r\n".$data;
449 $data = $this->parseRequest($this->headers, $data);
450 $this->requestSOAP = $data;
451 $this->debug('leaving parse_request');
472 …$this->debug('in invoke_method, methodname=' . $this->methodname . ' methodURI=' . $this->methodUR…
474 if ($this->wsdl) {
475 if ($this->opData = $this->wsdl->getOperationData($this->methodname)) {
476 $this->debug('in invoke_method, found WSDL operation=' . $this->methodname);
477 $this->appendDebug('opData=' . $this->varDump($this->opData));
478 } elseif ($this->opData = $this->wsdl->getOperationDataForSoapAction($this->SOAPAction)) {
480 …$this->debug('in invoke_method, found WSDL soapAction=' . $this->SOAPAction . ' for operation=' . …
481 $this->appendDebug('opData=' . $this->varDump($this->opData));
482 $this->methodname = $this->opData['name'];
484 $this->debug('in invoke_method, no WSDL for operation=' . $this->methodname);
485 …$this->fault('SOAP-ENV:Client', "Operation '" . $this->methodname . "' is not defined in the WSDL …
489 $this->debug('in invoke_method, no WSDL to validate method');
492 // if a . is present in $this->methodname, we see if there is a class in scope,
496 $method = $this->methodname; //TODO FIXME HELP this is absolutely hardcoded!!!
498 if (strpos($this->methodname, '..') > 0) {
500 } else if (strpos($this->methodname, '.') > 0) {
502 } else if (strpos($this->methodname, '_') > 0) {
508 if (strlen($delim) > 0 && substr_count($this->methodname, $delim) == 1 &&
509 class_exists(substr($this->methodname, 0, strpos($this->methodname, $delim)))) {
511 $class = substr($this->methodname, 0, strpos($this->methodname, $delim));
512 $method = substr($this->methodname, strpos($this->methodname, $delim) + strlen($delim));
513 $this->debug("in invoke_method, class=$class method=$method delim=$delim");
518 if (!function_exists($this->methodname)) {
519 $this->debug("in invoke_method, function '$this->methodname' not found!");
520 $this->result = 'fault: method not found';
521 $this->fault('SOAP-ENV:Client',"method '$this->methodname' not defined in service");
527 $this->debug("in invoke_method, method '$this->methodname' not found in class '$class'!");
528 $this->result = 'fault: method not found';
529 $this->fault('SOAP-ENV:Client',"method '$this->methodname' not defined in service");
536 if(! $this->verify_method($this->methodname,$this->methodparams)){
537 // debug
538 $this->debug('ERROR: request not verified against method signature');
539 $this->result = 'fault: request failed validation against method signature';
541 $this->fault('SOAP-ENV:Client',"Operation '$this->methodname' not defined in service.");
546 $this->debug('in invoke_method, params:');
547 $this->appendDebug($this->varDump($this->methodparams));
548 $this->debug("in invoke_method, calling '$this->methodname'");
551 $this->debug('in invoke_method, calling function using eval()');
552 $funcCall = "\$this->methodreturn = $this->methodname(";
555 $this->debug('in invoke_method, calling class method using eval()');
556 $funcCall = "\$this->methodreturn = ".$class."::".$method."(";
558 $this->debug('in invoke_method, calling instance method using eval()');
562 $funcCall .= "\$this->methodreturn = ".$instname."->".$method."(";
565 if ($this->methodparams) {
566 foreach ($this->methodparams as $param) {
568 …$this->fault('SOAP-ENV:Client', 'NuSOAP does not handle complexType parameters correctly when usin…
573 $funcCall = substr($funcCall, 0, -1);
576 $this->debug('in invoke_method, function call: '.$funcCall);
580 $this->debug('in invoke_method, calling function using call_user_func_array()');
581 …$call_arg = "$this->methodname"; // straight assignment changes $this->methodname to lower case af…
583 $this->debug('in invoke_method, calling class method using call_user_func_array()');
586 $this->debug('in invoke_method, calling instance method using call_user_func_array()');
590 if (is_array($this->methodparams)) {
591 $this->methodreturn = call_user_func_array($call_arg, array_values($this->methodparams));
593 $this->methodreturn = call_user_func_array($call_arg, array());
596 $this->debug('in invoke_method, methodreturn:');
597 $this->appendDebug($this->varDump($this->methodreturn));
598 …$this->debug("in invoke_method, called method $this->methodname, received data of type ".gettype($…
613 …$this->debug('Entering serialize_return methodname: ' . $this->methodname . ' methodURI: ' . $this
615 …if (isset($this->methodreturn) && ((get_class($this->methodreturn) == 'soap_fault') || (get_class(…
616 $this->debug('got a fault object from method');
617 $this->fault = $this->methodreturn;
619 } elseif ($this->methodreturnisliteralxml) {
620 $return_val = $this->methodreturn;
623 $this->debug('got a(n) '.gettype($this->methodreturn).' from method');
624 $this->debug('serializing return value');
625 if($this->wsdl){
626 if (sizeof($this->opData['output']['parts']) > 1) {
627 $this->debug('more than one output part, so use the method return unchanged');
628 $opParams = $this->methodreturn;
629 } elseif (sizeof($this->opData['output']['parts']) == 1) {
630 $this->debug('exactly one output part, so wrap the method return in a simple array');
632 //foreach ($this->opData['output']['parts'] as $name => $type) {
633 // $this->debug('wrap in element named ' . $name);
635 $opParams = array($this->methodreturn);
637 $return_val = $this->wsdl->serializeRPCParameters($this->methodname,'output',$opParams);
638 $this->appendDebug($this->wsdl->getDebug());
639 $this->wsdl->clearDebug();
640 if($errstr = $this->wsdl->getError()){
641 $this->debug('got wsdl error: '.$errstr);
642 $this->fault('SOAP-ENV:Server', 'unable to serialize result');
646 if (isset($this->methodreturn)) {
647 $return_val = $this->serialize_val($this->methodreturn, 'return');
650 $this->debug('in absence of WSDL, assume void return for backward compatibility');
654 $this->debug('return value:');
655 $this->appendDebug($this->varDump($return_val));
657 $this->debug('serializing response');
658 if ($this->wsdl) {
659 $this->debug('have WSDL for serialization: style is ' . $this->opData['style']);
660 if ($this->opData['style'] == 'rpc') {
661 $this->debug('style is rpc for serialization: use is ' . $this->opData['output']['use']);
662 if ($this->opData['output']['use'] == 'literal') {
663 …// http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor e…
664 …$payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</n…
666 …$payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</n…
669 $this->debug('style is not rpc for serialization: assume document');
673 $this->debug('do not have WSDL for serialization: assume rpc/encoded');
674 …$payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</n…
676 $this->result = 'successful';
677 if($this->wsdl){
678 //if($this->debug_flag){
679 $this->appendDebug($this->wsdl->getDebug());
687 …$this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders,$this->wsdl->usedNa…
689 $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders);
691 $this->debug("Leaving serialize_return");
705 $this->debug('Enter send_response');
706 if ($this->fault) {
707 $payload = $this->fault->serialize();
708 $this->outgoing_headers[] = "HTTP/1.0 500 Internal Server Error";
709 $this->outgoing_headers[] = "Status: 500 Internal Server Error";
711 $payload = $this->responseSOAP;
715 // $this->outgoing_headers[] = "HTTP/1.0 200 OK";
716 // $this->outgoing_headers[] = "Status: 200 OK";
718 // add debug data if in debug mode
719 if(isset($this->debug_flag) && $this->debug_flag){
720 $payload .= $this->getDebugAsXMLComment();
722 $this->outgoing_headers[] = "Server: $this->title Server v$this->version";
723 ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
724 $this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")";
726 //$this->outgoing_headers[] = "Connection: Close\r\n";
727 $payload = $this->getHTTPBody($payload);
728 $type = $this->getHTTPContentType();
729 $charset = $this->getHTTPContentTypeCharset();
730 $this->outgoing_headers[] = "Content-Type: $type" . ($charset ? '; charset=' . $charset : '');
731 //begin code to compress payload - by John
734 …if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) …
735 if (strstr($this->headers['accept-encoding'], 'gzip')) {
737 if (isset($this->debug_flag) && $this->debug_flag) {
738 $payload .= "<!-- Content being gzipped -->";
740 $this->outgoing_headers[] = "Content-Encoding: gzip";
743 if (isset($this->debug_flag) && $this->debug_flag) {
744 $payload .= "<!-- Content will not be gzipped: no gzencode -->";
747 } elseif (strstr($this->headers['accept-encoding'], 'deflate')) {
750 …// which conflicts with HTTP 1.1 spec (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.…
752 if (isset($this->debug_flag) && $this->debug_flag) {
753 $payload .= "<!-- Content being deflated -->";
755 $this->outgoing_headers[] = "Content-Encoding: deflate";
758 if (isset($this->debug_flag) && $this->debug_flag) {
759 $payload .= "<!-- Content will not be deflated: no gzcompress -->";
765 $this->outgoing_headers[] = "Content-Length: ".strlen($payload);
766 reset($this->outgoing_headers);
767 foreach($this->outgoing_headers as $hdr){
772 $this->response = join("\r\n",$this->outgoing_headers)."\r\n\r\n".$payload;
785 if(isset($this->wsdl) && is_object($this->wsdl)){
786 if($this->wsdl->getOperationData($operation)){
789 } elseif(isset($this->operations[$operation])){
804 …$this->debug('Entering parseRequest() for data of length ' . strlen($data) . ' and type ' . $heade…
805 if (!strstr($headers['content-type'], 'text/xml')) {
806 $this->setError('Request not of type text/xml');
809 if (strpos($headers['content-type'], '=')) {
810 $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
811 $this->debug('Got response encoding: ' . $enc);
812 if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
813 $this->xml_encoding = strtoupper($enc);
815 $this->xml_encoding = 'US-ASCII';
818 // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
819 $this->xml_encoding = 'ISO-8859-1';
821 $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser');
823 $parser = new nusoap_parser($data,$this->xml_encoding,'',$this->decode_utf8);
824 // parser debug
825 $this->debug("parser debug: \n".$parser->getDebug());
827 if($err = $parser->getError()){
828 $this->result = 'fault: error in msg parsing: '.$err;
829 $this->fault('SOAP-ENV:Client',"error in msg parsing:\n".$err);
833 $this->methodURI = $parser->root_struct_namespace;
834 $this->methodname = $parser->root_struct_name;
835 $this->debug('methodname: '.$this->methodname.' methodURI: '.$this->methodURI);
836 $this->debug('calling parser->get_soapbody()');
837 $this->methodparams = $parser->get_soapbody();
839 $this->requestHeaders = $parser->getHeaders();
841 $this->requestHeader = $parser->get_soapheader();
843 $this->document = $parser->document;
872 * returns false for non-text content types.
880 return $this->soap_defencoding;
893 $this->operations[$methodname] = array('name' => $methodname,'in' => $in,'out' => $out);
913 if($this->externalWSDLURL){
937 $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
956 $this->operations[$name] = array(
963 if($this->wsdl){
964 …$this->wsdl->addOperation($name,$in,$out,$namespace,$soapaction,$style,$use,$documentation,$encodi…
980 if ($faultdetail == '' && $this->debug_flag) {
981 $faultdetail = $this->getDebug();
983 $this->fault = new nusoap_fault($faultcode,$faultactor,$faultstring,$faultdetail);
984 $this->fault->soap_defencoding = $this->soap_defencoding;
1013 $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
1042 $this->wsdl = new wsdl;
1043 $this->wsdl->serviceName = $serviceName;
1044 $this->wsdl->endpoint = $endpoint;
1045 $this->wsdl->namespaces['tns'] = $namespace;
1046 $this->wsdl->namespaces['soap'] = 'http://schemas.xmlsoap.org/wsdl/soap/';
1047 $this->wsdl->namespaces['wsdl'] = 'http://schemas.xmlsoap.org/wsdl/';
1049 $this->wsdl->namespaces['types'] = $schemaTargetNamespace;
1051 …$this->wsdl->schemas[$schemaTargetNamespace][0] = new nusoap_xmlschema('', '', $this->wsdl->namesp…
1053 … $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaInfo['elementFormDefault'] = 'qualified';
1055 … $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaTargetNamespace = $schemaTargetNamespace;
1056 …$this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/soap/encoding…
1057 …$this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/wsdl/'][0] = …
1058 $this->wsdl->bindings[$serviceName.'Binding'] = array(
1063 $this->wsdl->ports[$serviceName.'Port'] = array(