function parseRequest($headers, $data) { $this->debug('Entering parseRequest() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']); $this->requestAttachments = array(); if (strstr($headers['content-type'], $this->dimeContentType)) { $this->_decodeDIMEMessage($headers, $data); } else { $this->debug('Not dime content'); } if (!$this->validate_signatrue($data)) { $errmsg = 'SOAP Signatrue ERROR'; if (isset($GLOBALS['validate_signatrue_errmsg'])) { $errmsg = $GLOBALS['validate_signatrue_errmsg']; } $this->fault('TokenError', $errmsg); } return parent::parseRequest($headers, $data); }
function parseRequest($headers, $data) { $this->debug('Entering parseRequest() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']); $this->requestAttachments = array(); //ob_start(); //var_dump($headers); //var_dump($data); //echo "\r\n\r\n"; if (strstr($headers['content-type'], $this->dimeContentType)) { $this->_decodeDIMEMessage($headers, $data); } else { $this->debug('Not dime content'); } if (!$this->validate_signatrue($data)) { $this->fault('TokenError', '证书验证失败,请使用正确的ShopEx证书。'); } //var_dump($this->requestAttachments); //$logdata = ob_get_contents(); //file_put_contents(dirname(__FILE__).'/log.txt', $logdata); //ob_end_clean(); return parent::parseRequest($headers, $data); }
/** * processes SOAP message received from client * * @param array $headers The HTTP headers * @param string $data unprocessed request data from client * @return mixed value of the message, decoded into a PHP type * @access private */ function parseRequest($headers, $data) { $this->debug('Entering parseRequest() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']); $this->requestAttachments = array(); if (strstr($headers['content-type'], 'multipart/related')) { $this->debug('Decode multipart/related'); $input = ''; foreach ($headers as $k => $v) { $input .= "{$k}: {$v}\r\n"; } $params['input'] = $input . "\r\n" . $data; $params['include_bodies'] = true; $params['decode_bodies'] = true; $params['decode_headers'] = true; $structure = Mail_mimeDecode::decode($params); foreach ($structure->parts as $part) { if (!isset($part->disposition) && strstr($part->headers['content-type'], 'text/xml')) { $this->debug('Have root part of type ' . $part->headers['content-type']); $return = parent::parseRequest($part->headers, $part->body); } else { $this->debug('Have an attachment of type ' . $part->headers['content-type']); $info['data'] = $part->body; $info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : ''; $info['contenttype'] = $part->headers['content-type']; $info['cid'] = $part->headers['content-id']; $this->requestAttachments[] = $info; } } if (isset($return)) { return $return; } $this->setError('No root part found in multipart/related content'); return; } $this->debug('Not multipart/related'); return parent::parseRequest($headers, $data); }