本文整理汇总了PHP中nusoap_parser类的典型用法代码示例。如果您正苦于以下问题:PHP nusoap_parser类的具体用法?PHP nusoap_parser怎么用?PHP nusoap_parser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了nusoap_parser类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: parseResponse
/**
* processes SOAP message returned from server
*
* @param 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
*/
function parseResponse($headers, $data)
{
$this->debug('Entering parseResponse() for data of length ' . strlen($data) . ' headers:');
$this->appendDebug($this->varDump($headers));
if (!strstr($headers['content-type'], 'text/xml')) {
$this->setError('Response not of type text/xml: ' . $headers['content-type']);
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 nusoap_parser');
$parser = new nusoap_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 SOAP headers
$this->responseHeader = $parser->get_soapheader();
// get decoded message
$return = $parser->get_soapbody();
// add document for doclit support
$this->document = $parser->document;
// destroy the parser object
unset($parser);
// return decode message
return $return;
}
}
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:53,代码来源:nusoap.php
示例2: parseRequest
/**
* 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 data of length ' . strlen($data) . ' headers:');
$this->appendDebug($this->publicDump($headers));
if (!isset($headers['content-type'])) {
$this->setError('Request not of type text/xml (no content-type header)');
return false;
}
if (!strstr($headers['content-type'], 'text/xml')) {
$this->setError('Request 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 (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $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 nusoap_parser');
// parse response, get soap parser obj
$parser = new nusoap_parser($data, $this->xml_encoding, '', $this->decode_utf8);
// parser debug
$this->debug("parser debug: \n" . $parser->getDebug());
// if fault occurred during message parsing
if ($err = $parser->getError()) {
$this->result = 'fault: error in msg parsing: ' . $err;
$this->fault('SOAP-ENV:Client', "error in msg parsing:\n" . $err);
// else successfully parsed request into soapval object
} else {
// get/set methodname
$this->methodURI = $parser->root_struct_namespace;
$this->methodname = $parser->root_struct_name;
$this->debug('methodname: ' . $this->methodname . ' methodURI: ' . $this->methodURI);
$this->debug('calling parser->get_soapbody()');
$this->methodparams = $parser->get_soapbody();
// get SOAP headers
$this->requestHeaders = $parser->getHeaders();
// get SOAP Header
$this->requestHeader = $parser->get_soapheader();
// add document for doclit support
$this->document = $parser->document;
}
}
开发者ID:rajveerbeniwal,项目名称:rooms-dhkh,代码行数:57,代码来源:class.soap_server.php
示例3: array
// return false;
return array('username' => $parameters->getParameter('username'), 'name' => 'Prueba', 'type' => 'test', 'email' => '[email protected]');
}));
//////////////////////////////////////////////////////////////////////////////////////////////////////////
$xml = file_get_contents('php://input');
if (!preg_match('/\\<SOAP\\-ENV\\:Body\\>\\<\\w+\\:([^\\> ]+)[^\\>]*\\>/', $xml, $aux)) {
//file_put_contents('error', 'Es un error');
die;
}
//require_once(realpath(dirname(__FILE__) . '/../lib/nusoap/nusoap.php'));
require_once realpath(dirname(__FILE__) . '/../../extras/nusoap/nusoap.php');
//$h = HTTPRequest::getParameter('soap');
$h = 'users';
$c = $aux[1];
preg_match('/xml [^ ]+ encoding="([^"]+)"/', $xml, $aux2);
$parser = new nusoap_parser($xml, $aux2[1], '', 1);
if (!$control->isExecutable("{$h}_c.{$c}")) {
header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found");
die;
}
function var_error_log($object = null)
{
ob_start();
// start buffer capture
var_dump($object);
// dump the values
$contents = ob_get_contents();
// put the buffer into a variable
ob_end_clean();
// end capture
return $contents;
开发者ID:axoquen,项目名称:tt780,代码行数:31,代码来源:soap.php
示例4: parseResponse
function parseResponse($headers, $data)
{
$this->debug('Entering parseResponse() for data of length ' . strlen($data) . ' headers:');
$this->appendDebug($this->varDump($headers));
if (!isset($headers['content-type'])) {
$this->setError('Response not of type text/xml (no content-type header)');
return false;
}
if (!strstr($headers['content-type'], 'text/xml')) {
$this->setError('Response not of type text/xml: ' . $headers['content-type']);
return false;
}
if (strpos($headers['content-type'], '=')) {
$enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
$this->debug('Got response encoding: ' . $enc);
if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
$this->xml_encoding = strtoupper($enc);
} else {
$this->xml_encoding = 'US-ASCII';
}
} else {
$this->xml_encoding = 'ISO-8859-1';
}
$this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser');
$parser = new nusoap_parser($data, $this->xml_encoding, $this->operation, $this->decode_utf8);
$this->appendDebug($parser->getDebug());
if ($errstr = $parser->getError()) {
$this->setError($errstr);
unset($parser);
return false;
} else {
$this->responseHeaders = $parser->getHeaders();
$this->responseHeader = $parser->get_soapheader();
$return = $parser->get_soapbody();
$this->document = $parser->document;
unset($parser);
return $return;
}
}
开发者ID:forthrobot,项目名称:inuvik,代码行数:39,代码来源:SOAP.php
示例5: handleRequest
/**
* This method parses, validates and routes the incoming request to the correct methods.
*
* @param string $soapaction optional, if not provided it will be taken from $_SERVER['HTTP_SOAPACTION']
* @param string $body optional, if not provided it will be taken directly from php://input
*/
public function handleRequest($soapaction = null, $body = null)
{
$this->log->LogSystemDebug('ebay', 'Incoming eBay notification');
if ($soapaction === null) {
if (isset($_SERVER['HTTP_SOAPACTION'])) {
// for some reason, the soapaction header value is double-quoted, so...
$soapaction = stripcslashes(trim($_SERVER['HTTP_SOAPACTION'], '"'));
if (!preg_match('#^http://developer\\.ebay\\.com/notification/([^/]+)$#', $soapaction, $matches)) {
$this->log->LogSystemDebug('ebay', 'Invalid SOAPACTION header', $soapaction);
return;
}
$soapaction = $matches[1];
unset($matches);
}
}
if (!$soapaction) {
$this->log->LogSystemDebug('ebay', 'No SOAPACTION header defined');
return;
}
if ($body === null) {
$body = file_get_contents('php://input');
}
// parse incoming xml
require_once(ISC_BASE_PATH . '/lib/nusoap/nusoap.php');
$parser = new nusoap_parser($body);
if ($parser->getError()) {
$this->log->LogSystemDebug('ebay', 'eBay notification could not be parsed to xml: ' . $parser->getError(), $body);
return;
}
unset($body);
// validate signature as genuine ebay notification, see http://developer.ebay.com/DevZone/XML/docs/WebHelp/WorkingWithNotifications-Receiving_Platform_Notifications.html
$header = $parser->get_soapheader();
$body = $parser->get_soapbody();
$providedSignature = $header['RequesterCredentials']['NotificationSignature'];
$timestamp = $body['Timestamp'];
$expectedSignature = base64_encode(md5($timestamp . GetConfig("EbayDevId") . GetConfig("EbayAppId") . GetConfig("EbayCertId"), true));
if (strcmp($expectedSignature, $providedSignature) !== 0) {
$this->log->LogSystemDebug('ebay', 'eBay notification failed signature validation, provided signature was: ' . $providedSignature);
return;
}
unset($expectedSignature, $providedSignature, $timestamp, $body, $header);
// route to protected methods or ignore if a method for this notification is not implemented
$method = '_handle' . $soapaction;
if (!is_callable(array($this, $method))) {
$this->log->LogSystemDebug('ebay', 'No processor defined for eBay notification event: ' . $soapaction);
return false;
}
$body = $parser->get_soapbody();
unset($parser);
$this->log->LogSystemDebug('ebay', 'Accepted eBay notification event: ' . $soapaction, '<pre>' . isc_html_escape(var_export($body, true)) . '</pre>');
return $this->$method($body);
}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:71,代码来源:class.ebay.notifications.listener.php
注:本文中的nusoap_parser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论