diff --git a/src/nusoap.php b/src/nusoap.php index e9155ad..8d3e70b 100644 --- a/src/nusoap.php +++ b/src/nusoap.php @@ -220,6 +220,12 @@ class nusoap_base var $xmlEntities = array('quot' => '"', 'amp' => '&', 'lt' => '<', 'gt' => '>', 'apos' => "'"); + /** + * @var string + */ + var $contentType; + + /** * constructor * @@ -228,8 +234,8 @@ class nusoap_base function __construct() { $this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel']; + $this->contentType = "text/xml"; } - /** * gets the global debug level, which applies to future instances * @@ -3200,11 +3206,7 @@ function getResponse() $err = 'cURL ERROR: ' . curl_errno($this->ch) . ': ' . $cErr . '
'; // TODO: there is a PHP bug that can cause this to SEGV for CURLINFO_CONTENT_TYPE foreach (curl_getinfo($this->ch) as $k => $v) { - if (is_array($v)) { - $this->debug("$k: " . json_encode($v)); - } else { - $this->debug("$k: $v
"); - } + $err .= "$k: $v
"; } $this->debug($err); $this->setError($err); @@ -3947,13 +3949,8 @@ function parse_http_headers() } } $this->headers[$k] = $v; - if (is_array($v)) { - $this->request .= "$k: " . json_encode($v) . "\r\n"; - $this->debug("$k: " . json_encode($v)); - } else { - $this->request .= "$k: $v\r\n"; - $this->debug("$k: $v"); - } + $this->request .= "$k: $v\r\n"; + $this->debug("$k: $v"); } } elseif (is_array($HTTP_SERVER_VARS)) { $this->debug("In parse_http_headers, use HTTP_SERVER_VARS"); @@ -4255,7 +4252,6 @@ function serialize_return() //} $opParams = array($this->methodreturn); } - $opParams = isset($opParams) ? $opParams : []; $return_val = $this->wsdl->serializeRPCParameters($this->methodname, 'output', $opParams); $this->appendDebug($this->wsdl->getDebug()); $this->wsdl->clearDebug(); @@ -4566,7 +4562,7 @@ function register($name, $in = array(), $out = array(), $namespace = false, $soa } if (false == $namespace) { } - if (false === $soapaction) { + if (false == $soapaction) { if (isset($_SERVER)) { $SERVER_NAME = $_SERVER['SERVER_NAME']; $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']; @@ -7563,7 +7559,7 @@ function call($operation, $params = array(), $namespace = 'http://tempuri.org', // no WSDL //$this->namespaces['ns1'] = $namespace; $nsPrefix = 'ns' . rand(1000, 9999); - // serialize + // serialize $payload = ''; if (is_string($params)) { $this->debug("serializing param string for operation $operation"); @@ -8185,9 +8181,20 @@ function getHTTPBody($soapmsg) */ function getHTTPContentType() { - return 'text/xml'; + return $this->contentType; + } + + /** + * allows you to change the HTTP ContentType of the request. + * + * @param string $contenTypeNew + * @return void + */ + function setHTTPContentType($contenTypeNew = "text/xml"){ + $this->contentType = $contenTypeNew; } + /** * gets the HTTP content type charset for the current request. * returns false for non-text content types.