本文整理汇总了PHP中SoapClient::__getLastResponseHeaders方法的典型用法代码示例。如果您正苦于以下问题:PHP SoapClient::__getLastResponseHeaders方法的具体用法?PHP SoapClient::__getLastResponseHeaders怎么用?PHP SoapClient::__getLastResponseHeaders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoapClient
的用法示例。
在下文中一共展示了SoapClient::__getLastResponseHeaders方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: requestDebug
public function requestDebug()
{
echo "Last Request:\n\n";
echo $this->client->__getLastRequestHeaders() . "\n\n";
echo self::tidyit($this->client->__getLastRequest()) . "\n\n";
echo $this->client->__getLastResponseHeaders() . "\n\n";
echo self::tidyit($this->client->__getLastResponse()) . "\n";
}
示例2: testEnv
private function testEnv(array $functions, $url, OutputInterface $output)
{
$soapClient = new \SoapClient($url, array('cache_wsdl' => 0, 'trace' => 1, 'soap_version' => SOAP_1_1));
foreach ($functions as $function => $parameters) {
$output->writeln('Test de la fonction soap <comment>' . $function . '</comment>');
$output->writeln('Parameters : ');
dump($parameters);
if (!array_key_exists('methodCall', $this->config) || $this->config['methodCall'] == 'soapCall') {
$result = $soapClient->__soapCall($function, $parameters);
} else {
$result = $soapClient->{$function}($parameters);
}
$headers = $soapClient->__getLastResponseHeaders();
if ($output->isDebug()) {
$output->writeln('Entete de la reponse : ');
dump($headers);
}
if (false === ($site = $this->getSiteHeader($headers))) {
throw new \Exception('Site Header introuvable dans la réponse.', 1);
}
$output->writeln('Serveur ayant repondu : <info>' . $site . '</info>');
$output->writeln('Reponse : ');
dump($result);
if ($output->isDebug()) {
dump($soapClient->__getLastResponse());
}
}
}
示例3: getLastResponseHeaders
/**
* Retrieve response headers (as string)
*
* @return string
*/
public function getLastResponseHeaders()
{
if ($this->_soapClient !== null) {
return $this->_soapClient->__getLastResponseHeaders();
}
return '';
}
示例4: dumpSoapMessages
/**
* Dump Client response and request messages
*
* @param SoapClient $client Client instance
*
* @return void
*/
private function dumpSoapMessages($client)
{
echo '<br />$client->__getLastRequest():<br />';
var_dump($client->__getLastRequest());
echo '<br />$client->__getLastRequestHeaders():<br />';
var_dump($client->__getLastRequestHeaders());
echo '<br />$client->__getLastResponse():<br />';
var_dump($client->__getLastResponse());
echo '<br />$client->__getLastResponseHeaders():<br />';
var_dump($client->__getLastResponseHeaders());
}
示例5: run
public function run($reportName, $formatType = 'PDF', $reportParams = null, $saveFile = false)
{
$client = new \SoapClient($this->jasperServer->getWsdl(), array('login' => $this->jasperServer->getUsername(), 'password' => $this->jasperServer->getPassword(), "trace" => 1, "exceptions" => 0));
$client->runReport($this->_requestMock($reportName, $formatType, $reportParams));
preg_match('/boundary="(.*?)"/', $client->__getLastResponseHeaders(), $gotcha);
$bound = $gotcha[1];
$invokeReturnPart = explode($bound, $client->__getLastResponse());
$output = substr($invokeReturnPart[2], strpos($invokeReturnPart[2], '<report>') + 9);
$content = trim(str_replace("\n--", "", $output));
if ($saveFile === true) {
$filename = $this->jasperServer->getPathToSave() . DIRECTORY_SEPARATOR . 'generate_report_at_' . time() . ".{$formatType}";
file_put_contents($filename, $content);
return $filename;
} else {
return $content;
}
}
示例6: send
/**
* @param array $data
* @param bool|false $returnXml
*
* @return \stdClass|array|string
*
* @throws WebGateException
*/
public function send($data, $returnXml = false)
{
try {
$options = ['trace' => true, 'exceptions' => true, 'connection_timeout' => $this->connectionTimeout];
if (!empty($this->login)) {
$options['login'] = $this->login;
$options['password'] = $this->password;
}
if (0) {
$options['location'] = '';
$options['uri'] = '';
$wsdl = null;
} else {
$wsdl = $this->wsdlPath;
}
$client = new \SoapClient($wsdl, $options);
ini_set("default_socket_timeout", $this->connectionTimeout);
$response = $client->__soapCall($this->methodName, array('params' => $data));
$this->logger->addDebug('Response XML: ' . PHP_EOL . $client->__getLastResponse());
$this->logger->addDebug('Response JSON: ' . PHP_EOL . json_encode($response));
return $returnXml ? $client->__getLastResponse() : $response;
} catch (\SoapFault $e) {
if (isset($client)) {
$this->logger->addDebug(PHP_EOL . __METHOD__ . ':');
$this->logger->addDebug('Request Headers: ' . $client->__getLastRequestHeaders());
$this->logger->addDebug('Request: ' . $client->__getLastRequest());
$this->logger->addDebug('Response Headers: ' . $client->__getLastResponseHeaders());
$this->logger->addDebug('Response: ' . PHP_EOL . $client->__getLastResponse());
}
if ($e->getCode()) {
$code = $e->getCode();
} else {
$code = isset($e->faultcode) && is_numeric($e->faultcode) ? $e->faultcode : 500;
}
$this->logger->addCritical(PHP_EOL . __METHOD__ . sprintf('[%s/%s] %s', $e->getCode(), $code, $e->getMessage()));
throw new WebGateException($e->getMessage(), $code, $e);
}
}
示例7: SoapClient
<?php
$client = new SoapClient("http://sparesprit.de/sprit.wsdl", array('location' => "http://sparesprit.de/server.php", 'uri' => "http://localhost", 'trace' => 1));
try {
$result = $client->__soapCall("getCoordsByTown", array("town" => "Leipzig"));
//echo $result;
echo gettype($result);
} catch (Exception $e) {
echo 'Exception abgefangen: ', $e->getMessage(), "\n";
}
echo "\nReturning value of __soapCall() call: " . $return;
echo "\nDumping request headers:\n" . $client->__getLastRequestHeaders();
echo "\nDumping request:\n" . $client->__getLastRequest();
echo "\nDumping response headers:\n" . $client->__getLastResponseHeaders();
echo "\nDumping response:\n" . $client->__getLastResponse();
示例8: request
/**
* Submits an API request through the iATS SOAP API Toolkit.
*
* @param $request
* The request object or array containing the parameters of the requested services.
*
* @return
* The response object from the API with properties pertinent to the requested
* services.
*/
function request($credentials, $payment)
{
// Attempt the SOAP request and log the exception on failure.
$method = $this->method['method'];
if (empty($method)) {
dsm($this->method);
return FALSE;
}
// do some massaging of parameters for badly behaving iATS methods ($method is now the iATS method, not our internal key)
switch ($method) {
case 'CreateCreditCardCustomerCode':
case 'UpdateCreditCardCustomerCode':
$dummy_date = date('c', time());
// now
foreach (array('beginDate', 'endDate') as $key) {
if (empty($request_params[$key])) {
$request_params[$key] = $dummy_date;
}
}
break;
}
$message = $this->method['message'];
$response = $this->method['response'];
// always log requests to my own table, start by making a copy of the original request
// note: this is different from the drupal watchdog logging that only happens if userframework logging and debug are enabled
if (!empty($payment['invoiceNum'])) {
$logged_request = $payment;
// mask the cc numbers
$this->mask($logged_request);
// log: ip, invoiceNum, , cc, total, date
// dpm($logged_request);
$cc = isset($logged_request['creditCardNum']) ? $logged_request['creditCardNum'] : (isset($logged_request['ccNum']) ? $logged_request['ccNum'] : '');
$ip = $logged_request['customerIPAddress'];
$query_params = array(1 => array($logged_request['invoiceNum'], 'String'), 2 => array($ip, 'String'), 3 => array(substr($cc, -4), 'String'), 4 => array('', 'String'), 5 => array($logged_request['total'], 'String'));
CRM_Core_DAO::executeQuery("INSERT INTO civicrm_iats_request_log\n (invoice_num, ip, cc, customer_code, total, request_datetime) VALUES (%1, %2, %3, %4, %5, NOW())", $query_params);
if (!$this->is_ipv4($ip)) {
$payment['customerIPAddress'] = substr($ip, 0, 30);
}
// save the invoiceNum so I can log it for the response
$this->invoiceNum = $logged_request['invoiceNum'];
}
// the agent user and password only get put in here so they don't end up in a log above
try {
/* until iATS fixes it's box verify, we need to have trace on to make the hack below work */
$soapClient = new SoapClient($this->_wsdl_url, array('trace' => 1, 'soap_version' => SOAP_1_2));
/* build the request manually as per the iATS docs */
$xml = '<' . $message . ' xmlns="' . $this->_wsdl_url_ns . '">';
$request = array_merge($this->request, (array) $credentials, (array) $payment);
// Pass CiviCRM tag + version to iATS
$request['comment'] = 'CiviCRM: ' . CRM_Utils_System::version() . ' + ' . 'iATS Extension: ' . $this->iats_extension_version();
$tags = !empty($this->_tag_order) ? $this->_tag_order : array_keys($request);
foreach ($tags as $k) {
if (isset($request[$k])) {
$xml .= '<' . $k . '>' . $request[$k] . '</' . $k . '>';
}
}
$xml .= '</' . $message . '>';
if (!empty($this->options['log'])) {
watchdog('civicrm_iatspayments_com', 'Method info: !method', array('!method' => $method), WATCHDOG_NOTICE);
watchdog('civicrm_iatspayments_com', 'XML: !xml', array('!xml' => $xml), WATCHDOG_NOTICE);
}
$soapRequest = new SoapVar($xml, XSD_ANYXML);
if (!empty($this->options['log'])) {
watchdog('civicrm_iatspayments_com', 'Request !request', array('!request' => print_r($soapRequest, TRUE)), WATCHDOG_NOTICE);
}
$soapResponse = $soapClient->{$method}($soapRequest);
if (!empty($this->options['log']) && !empty($this->options['debug'])) {
$request_log = "\n HEADER:\n";
$request_log .= $soapClient->__getLastRequestHeaders();
$request_log .= "\n BODY:\n";
$request_log .= $soapClient->__getLastRequest();
$request_log .= "\n BODYEND:\n";
watchdog('civicrm_iatspayments_com', 'Request: !request', array('!request' => '<pre>' . $request_log . '</pre>'), WATCHDOG_NOTICE);
$response_log = "\n HEADER:\n";
$response_log .= $soapClient->__getLastResponseHeaders();
$response_log .= "\n BODY:\n";
$response_log .= $soapClient->__getLastResponse();
$response_log .= "\n BODYEND:\n";
watchdog('civicrm_iatspayments_com', 'Response: !response', array('!response' => '<pre>' . $response_log . '</pre>'), WATCHDOG_NOTICE);
}
} catch (SoapFault $exception) {
if (!empty($this->options['log'])) {
watchdog('civicrm_iatspayments_com', 'SoapFault: !exception', array('!exception' => '<pre>' . print_r($exception, TRUE) . '</pre>'), WATCHDOG_ERROR);
$response_log = "\n HEADER:\n";
$response_log .= $soapClient->__getLastResponseHeaders();
$response_log .= "\n BODY:\n";
$response_log .= $soapClient->__getLastResponse();
$response_log .= "\n BODYEND:\n";
watchdog('civicrm_iatspayments_com', 'Raw Response: !response', array('!response' => '<pre>' . $response_log . '</pre>'), WATCHDOG_NOTICE);
}
//.........这里部分代码省略.........
示例9: getLastResponseHeaders
/**
* returns last response headers
*
* @return string
*/
public function getLastResponseHeaders()
{
return $this->soapClient->__getLastResponseHeaders();
}
示例10: date
/** sends a SOAP request to a FedEx server. see what happens */
function send_fedex_query($request)
{
if ($this->debug) {
$log = "\n\n==\n" . get_class($this) . "::send_fedex_query()\n" . date('r');
$log .= "\nIP: " . $_SERVER['REMOTE_ADDR'];
error_log($log, 3, $this->debug_log);
}
$wsdl = dirname(__FILE__) . '/' . $this->_path_to_wsdl;
if ($this->test_mode) {
// testing version wsql hacked in, has a one-line difference
$wsdl = preg_replace('/\\.wsdl$/', '-testing.wsdl', $wsdl);
}
$client = new SoapClient($wsdl, array('trace' => $this->debug));
// http://us3.php.net/manual/en/ref.soap.php
$quotes = array();
try {
$response = $client->getRates($request);
} catch (SoapFault $e) {
if ($this->debug) {
$log = "\n\n==== EXCEPTION CAUGHT : SoapFault Exception ====\n";
$log .= "====REQUEST====: \n" . $client->__getLastRequestHeaders() . "\n";
$log .= $client->__getLastRequest() . "\n\n";
$log .= "====RESPONSE===: \n" . $client->__getLastResponseHeaders() . "\n";
$log .= $client->__getLastResponse() . "\n\n";
error_log($log, 3, $this->debug_log);
}
return $this->raiseError($e->getMessage());
}
if ($this->debug) {
$log = "\n====REQUEST==== \n" . $client->__getLastRequest() . "\n\n";
error_log($log, 3, $this->debug_log);
error_log("\nHighestSeverity: {$response->HighestSeverity}\n", 3, $this->debug_log);
$log = "====RESPONSE===: \n" . serialize($response) . "\n\n";
error_log($log, 3, $this->debug_log);
}
if ($response->HighestSeverity == 'SUCCESS') {
foreach ($response->RateReplyDetails as $rateReply) {
if (!is_object($rateReply) || !isset($rateReply->ServiceType)) {
continue;
}
$service = $rateReply->ServiceType;
foreach ($rateReply->RatedShipmentDetails as $detail) {
$last_rate = null;
if (isset($detail->ShipmentRateDetail)) {
$rate = $detail->ShipmentRateDetail->TotalNetFedExCharge->Amount;
/* fedex returns multiple rate detail objects for each method, but they are always identical (maybe) */
if (!empty($last_rate) and $rate != $last_rate) {
$msg = "got different rates for the same shipping method {$service}";
trigger_error($msg, E_USER_WARNING);
if ($this->debug) {
error_log("{$msg}\n", 3, $this->debug_log);
}
}
$last_rate = $rate;
}
}
$quotes[$service] = $rate;
}
if (empty($quotes)) {
$err = "No ship methods are available for this destination at this time. Please try again.";
if ($this->debug) {
error_log("ERROR: {$err}\n", 3, $this->debug_log);
}
return $this->raiseError($err);
}
return $quotes;
} else {
if (is_object($response->Notifications)) {
if ($response->Notifications->Code == 556) {
$err = "The Address or Postal/ZIP code was not valid.";
} else {
$err = $response->Notifications->Severity . ': ' . $response->Notifications->Message . ' ';
}
} elseif (is_array($response->Notifications)) {
foreach ($response->Notifications as $notification) {
$err .= $notification->Message . ' ';
}
}
if ($this->debug) {
error_log("Notification: {$err}\n", 3, $this->debug_log);
}
return $this->raiseError($err);
}
}
示例11: dbConnect
require_once 'helpers.inc.php';
spl_autoload_register(function ($className) {
require_once "classes/{$className}" . '.php';
});
$conn = dbConnect();
$sql = 'INSERT INTO requests (id, startdate, enddate, request_time, result, body, header) VALUES (NULL,?,?,?,?,?,?)';
try {
$client = new SoapClient('http://82.138.16.126:8888/TaxiPublic/Service.svc?wsdl', array("trace" => 1));
$start = date('Y-m-d H:i:s');
$startmicro = microtime(true);
$result = $client->GetTaxiInfos(array('request' => array('RegNum' => 'лЋлю33377')));
$endmicro = microtime(true);
$end = date('Y-m-d H:i:s');
$time = $endmicro - $startmicro;
$response = $client->__getLastResponse();
$response_head = $client->__getLastResponseHeaders();
$arr = parseXmlResponse($response);
$compare_result = Taxi::compareWithPattern($arr[0]);
$stmt = $conn->prepare($sql);
if ($compare_result) {
$stmt->execute(array($start, $end, $time, 1, NULL, NULL));
} else {
$stmt->execute(array($start, $end, $time, 0, $response, $response_head));
}
if ($stmt->rowCount()) {
echo 'SQL INSERT SUCCESS';
echo '<br/>';
}
} catch (SoapFault $fault) {
trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
}
示例12: invoke
/**
* Invoke method call
*
* @param string method name
* @param var vars
* @return var answer
* @throws webservices.soap.SOAPFaultException
*/
public function invoke()
{
$args = func_get_args();
$method = array_shift($args);
$options = ['encoding' => $this->getEncoding(), 'exceptions' => 0, 'trace' => $this->cat != null, 'user_agent' => 'XP-Framework/' . get_class($this)];
if (null !== $this->ctimeout) {
$options['connection_timeout'] = $this->ctimeout;
}
if (null !== $this->timeout) {
// NOOP
}
if (null !== $this->endpoint->getUser()) {
$options['login'] = $this->endpoint->getUser();
}
if (null !== $this->endpoint->getPassword()) {
$options['password'] = $this->endpoint->getPassword();
}
if (sizeof($this->map)) {
$options['classmap'] = $this->map;
}
$this->version && ($options['soap_version'] = $this->version);
$this->location && ($options['location'] = $this->location);
if ($this->wsdl) {
$client = new \SoapClient($this->endpoint->getURL(), $options);
} else {
// Do not overwrite location if already set from outside
isset($options['location']) || ($options['location'] = $this->endpoint->getURL());
// Assert we have a uri
if (!$this->uri) {
throw new \lang\IllegalArgumentException('SOAP uri required in non-wsdl mode.');
}
$options['uri'] = $this->uri;
$options['style'] = $this->getStyle();
$options['use'] = $this->getSoapEncoding();
$client = new \SoapClient(null, $options);
}
// Take care of wrapping XP SOAP types into respective ext/soap value objects
$result = $client->__soapCall($method, $this->checkParams($args));
$this->cat && $this->cat->debug('>>>', $client->__getLastRequestHeaders(), $client->__getLastRequest());
$this->cat && $this->cat->debug('<<<', $client->__getLastResponseHeaders(), $client->__getLastResponse());
if (is_soap_fault($result)) {
throw new SOAPFaultException(new CommonSoapFault($result->faultcode, $result->faultstring));
}
return $result;
}
示例13: array
function __doRequest($request, $location, $action, $version, $one_way)
{
// FIXME: allow sending attachments
$this->attachments = array();
$response = parent::__doRequest($request, $location, $action, $version, $one_way);
$headers = parent::__getLastResponseHeaders();
// if it is a multipart response, split the parts, return the main xml
// part, and add the attachments
if (strpos($headers, 'Content-Type: multipart/related')) {
preg_match('/start="([^"]*)";.*boundary="([^"]*)"/', $headers, $matches);
$start = $matches[1];
$boundary = $matches[2];
$parts = explode('--' . $boundary, $response);
foreach ($parts as $part) {
$pieces = explode("\r\n\r\n", $part, 2);
if (count($pieces) != 2) {
// skip "empty" parts
continue;
}
$header = $pieces[0];
$body = $pieces[1];
preg_match('/Content-Id: (.*)$/m', $header, $matches);
if ($matches[1] == $start) {
$response = $body;
} else {
$this->attachments[] = $pieces;
}
}
}
return $response;
}
示例14: getLastRequest
/**
* @return array
*/
public function getLastRequest()
{
return array('request' => array('header' => $this->soapClient->__getLastRequestHeaders(), 'body' => $this->soapClient->__getLastRequest()), 'response' => array('header' => $this->soapClient->__getLastResponseHeaders(), 'body' => $this->soapClient->__getLastResponse()));
}
示例15: getLastResponseHeaders
/**
* Get last request headers as array
*
* @return array
*/
protected function getLastResponseHeaders()
{
return ParserRegistry::getInstance()->getParser('message')->parseResponse($this->client->__getLastResponseHeaders());
}