Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 24 additions & 17 deletions src/nusoap.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,12 @@ class nusoap_base
var $xmlEntities = array('quot' => '"', 'amp' => '&',
'lt' => '<', 'gt' => '>', 'apos' => "'");

/**
* @var string
*/
var $contentType;


/**
* constructor
*
Expand All @@ -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
*
Expand Down Expand Up @@ -3200,11 +3206,7 @@ function getResponse()
$err = 'cURL ERROR: ' . curl_errno($this->ch) . ': ' . $cErr . '<br>';
// 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<br>");
}
$err .= "$k: $v<br>";
}
$this->debug($err);
$this->setError($err);
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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'];
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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.
Expand Down