function soapclient::parseResponse in Salesforce Suite 5
Same name and namespace in other branches
- 5.2 includes/nusoap.orig.php \soapclient::parseResponse()
* processes SOAP message returned from server * *
Parameters
array $headers The HTTP headers: * @param string $data unprocessed response data from server * @return mixed value of the message, decoded into a PHP type * @access private
1 call to soapclient::parseResponse()
- soapclient::send in includes/
nusoap.orig.php - send the SOAP message
File
- includes/
nusoap.orig.php, line 6808
Class
- soapclient
- soapclient higher level class for easy usage.
Code
function parseResponse($headers, $data) {
$this
->debug('Entering parseResponse() for data of length ' . strlen($data) . ' and type ' . $headers['content-type']);
if (!strstr($headers['content-type'], 'text/xml')) {
$this
->setError('Response not of type text/xml');
return false;
}
if (strpos($headers['content-type'], '=')) {
$enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
$this
->debug('Got response encoding: ' . $enc);
if (eregi('^(ISO-8859-1|US-ASCII|UTF-8)$', $enc)) {
$this->xml_encoding = strtoupper($enc);
}
else {
$this->xml_encoding = 'US-ASCII';
}
}
else {
// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
$this->xml_encoding = 'ISO-8859-1';
}
$this
->debug('Use encoding: ' . $this->xml_encoding . ' when creating soap_parser');
$parser = new soap_parser($data, $this->xml_encoding, $this->operation, $this->decode_utf8);
// add parser debug data to our debug
$this
->appendDebug($parser
->getDebug());
// if parse errors
if ($errstr = $parser
->getError()) {
$this
->setError($errstr);
// destroy the parser object
unset($parser);
return false;
}
else {
// get SOAP headers
$this->responseHeaders = $parser
->getHeaders();
// get decoded message
$return = $parser
->get_response();
// add document for doclit support
$this->document = $parser->document;
// destroy the parser object
unset($parser);
// return decode message
return $return;
}
}