本文整理汇总了PHP中SoapClient::__getLastResponse方法的典型用法代码示例。如果您正苦于以下问题:PHP SoapClient::__getLastResponse方法的具体用法?PHP SoapClient::__getLastResponse怎么用?PHP SoapClient::__getLastResponse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoapClient
的用法示例。
在下文中一共展示了SoapClient::__getLastResponse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: calculoAportacionCiudadano
/**
*
* @param array $param
* <br>Parámetros de entrada.
* @return array
*/
function calculoAportacionCiudadano($param)
{
global $respError, $farmacia;
$param = objectToArray($param);
//die(print_r($param));
if ($farmacia == FARMACIA_DEBUG or strlen(FARMACIA_DEBUG) == 0) {
if (DEBUG & DEBUG_LOG) {
$mensaje = print_r($param, TRUE);
$mensaje .= "--Llamada hecha en el fichero: " . __FILE__ . ", en la línea: " . __LINE__;
error_log("[" . date("c") . "] \r\n {$mensaje}", 3, DIRECTORIO_LOG . __FUNCTION__ . "_" . date("YmdH") . ".log");
}
}
unset($param["farmacia"]);
unset($param["DNI"]);
$client = new SoapClient(END_POINT, array("location" => LOCATION, "trace" => true, "exceptions" => false));
$result = $client->__soapCall(__FUNCTION__, array($param));
//die(print_r($result));
if (is_soap_fault($result)) {
if ($farmacia == FARMACIA_DEBUG or strlen(FARMACIA_DEBUG) == 0) {
if (DEBUG & DEBUG_LOG) {
$mensaje = "REQUEST:\n" . $client->__getLastRequest() . "\n";
$mensaje .= "RESPONSE:\n" . $client->__getLastResponse() . "\n";
$mensaje .= "RESULT:\n" . $result . "\n";
$mensaje .= "--SOAP FAULT, llamada hecha en el fichero: " . __FILE__ . ", en la línea: " . __LINE__ . "\n";
error_log("[" . date("c") . "] \r\n {$mensaje}", 3, DIRECTORIO_LOG . __FUNCTION__ . "_" . date("YmdH") . ".log");
}
}
return array(__FUNCTION__ . "Result" => array("return" => $result->return, "resultadoOperacion" => array("codigoResultadoOperacion" => -9000, "mensajeResultadoOperacion" => $result->faultstring)));
}
return array(__FUNCTION__ . "Result" => array("return" => $result->return, "resultadoOperacion" => $respError->sinErrores()));
}
示例2: 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";
}
示例3: getDebug
/**
* @param bool $response
* @param bool $request
* @param SoapClient $soapClient
* @return string
*/
public function getDebug($response, $request, SoapClient $soapClient)
{
if ($response && $request) {
return "RAW request:\n" . $soapClient->__getLastRequest() . "\n" . "RAW response:\n" . $soapClient->__getLastResponse() . "\n";
}
if ($response) {
return "RAW response:\n" . $soapClient->__getLastResponse() . "\n";
}
if ($request) {
return "RAW request:\n" . $soapClient->__getLastRequest() . "\n";
}
return "";
}
示例4: logon
/**
* Login
*
* @param string $username
* @param string $password
* @param string $organisation
* @todo should this function create a new SOAP clust clienst?
* @throw SoapFault
*/
public function logon($username, $password, $organisation)
{
$return = false;
$parameters = array('user' => $username, 'password' => $password, 'organisation' => $organisation);
$logonResponse = $this->soapLoginClient->logon($parameters);
if ($logonResponse->LogonResult == LogonResult::OK) {
// Read the SOAP client last response
$response = $this->soapLoginClient->__getLastResponse();
/*
//echo htmlentities($response);
echo '<pre>';
var_dump($this->soapLoginClient->__getTypes());
echo '</pre>';
echo '<pre>';
var_dump($logonResponse);
echo '</pre>';
*/
// Create an SimpleXML object so we can easy access XML elements
$envelope = simplexml_load_string($response, null, null, self::XML_NAMESPACE_SOAP_ENVELOPE);
// Get the Twinfield header element from SOAP evenlope header
$header = $envelope->Header->children(Twinfield::XML_NAMESPACE);
// Save the clust and session ID data
$this->cluster = $logonResponse->cluster;
$this->sessionId = $header->Header->SessionID;
// Create an SOAP input header for further SOAP request
$this->soapInputHeader = new \SoapHeader(Twinfield::XML_NAMESPACE, 'Header', array('SessionID' => $this->sessionId));
// Create a new SOAP client that connects to the cluster
$wsdlClusterUrl = sprintf(self::SOAP_WSDL_CLUSTER_URI, $this->cluster);
$this->soapClusterClient = new \SoapClient($wsdlClusterUrl);
$return = true;
}
return $return;
}
示例5: 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());
}
}
}
示例6: getLastResponse
/**
* Get response XML
*
* @return string
*/
public function getLastResponse()
{
if ($this->_soapClient !== null) {
return $this->_soapClient->__getLastResponse();
}
return '';
}
示例7: printLastResponse
/**
* Print the Last Response
*/
private function printLastResponse()
{
if ($this->_config()->isLogEnabled($this->storeId)) {
Mage::log('Mailup: printLastResponse');
Mage::log($this->soapClient->__getLastResponse());
}
}
示例8: call
/**
* method to call didww api 2 soap method
* @param string $method
* @param array $arguments
* @return mixed
* @throws ApiClientException
*/
public function call($method, $arguments = array())
{
$arguments = array_merge(array('auth_string' => self::getCredentials()->getAuthString()), $arguments);
$method = 'didww_' . $method;
$timeStart = microtime(true);
try {
$result = $this->_client->__soapCall($method, $arguments);
} catch (\Exception $e) {
if (self::$_debug) {
$this->debug("raw request", $this->_client->__getLastRequest());
$this->debug("raw response", $this->_client->__getLastResponse());
}
throw $e;
}
if (self::$_debug) {
$this->debug("raw request", $this->_client->__getLastRequest());
$this->debug("raw response", $this->_client->__getLastResponse());
}
/**
* check if api returned error and throw exception
*/
if (isset($result->error) && $result->error > 0) {
$message = isset(self::$_errorCodes[$result->error]) ? self::$_errorCodes[$result->error] : 'Unknown error with code : ' . $result->error;
throw new ApiClientException($message);
}
$timeFinish = microtime(true);
$this->time = $timeFinish - $timeStart;
if (self::$_debug) {
$this->debug("response from {$method}:", $result);
}
return (array) $result;
}
示例9: logSoapCall
/**
* Log the last soap call as request and response XML files.
*
* @param \SoapClient $client
* @param string $operation
*/
public function logSoapCall($client, $operation)
{
if (file_exists($this->path)) {
$fileName = "ryanwinchester-netsuite-php-" . date("Ymd.His") . "-" . $operation;
$logFile = $this->path . "/" . $fileName;
// REQUEST
$request = $logFile . "-request.xml";
$Handle = fopen($request, 'w');
$Data = $client->__getLastRequest();
$Data = cleanUpNamespaces($Data);
$xml = simplexml_load_string($Data, 'SimpleXMLElement', LIBXML_NOCDATA);
$privateFieldXpaths = array('//password', '//password2', '//currentPassword', '//newPassword', '//newPassword2', '//ccNumber', '//ccSecurityCode', '//socialSecurityNumber');
$privateFields = $xml->xpath(implode(" | ", $privateFieldXpaths));
foreach ($privateFields as &$field) {
$field[0] = "[Content Removed for Security Reasons]";
}
$stringCustomFields = $xml->xpath("//customField[@xsitype='StringCustomFieldRef']");
foreach ($stringCustomFields as $field) {
$field->value = "[Content Removed for Security Reasons]";
}
$xml_string = str_replace('xsitype', 'xsi:type', $xml->asXML());
fwrite($Handle, $xml_string);
fclose($Handle);
// RESPONSE
$response = $logFile . "-response.xml";
$Handle = fopen($response, 'w');
$Data = $client->__getLastResponse();
fwrite($Handle, $Data);
fclose($Handle);
}
}
示例10: __call
/**
* Magiczne wywowałanie metody $this->SoapClient->ClassName($args)
* Opakowane jest przez try-catch, więc od razu obsłużone są wyjątki i zwracany response.
*
* Przykład:
* $this->authorize($param1, $param2, $param3);
* $this->sendRegistries($registries);
* powoduje uruchomienie:
* $this->soapClient->authorize($param1, $param2, $param3);
* $this->soapClient->sendRegistries($registries);
*
* @param $name
* @param $arguments
*
* @return mixed
* @throws MK_Exception
*/
public function __call($name, $arguments)
{
if ($this->soapClient instanceof SoapClient) {
try {
$response = $this->soapClient->__soapCall($name, $arguments);
if ($this->debugRequest) {
echo $this->debugRow('Last request', $this->soapClient->__getLastRequest());
}
if ($this->debugResponse) {
echo $this->debugRow('Last response', $this->soapClient->__getLastResponse());
}
return $response;
} catch (SoapFault $e) {
$debug = $this->debugRequest ? $this->debugRow('Last request', $this->soapClient->__getLastRequest()) : '';
$debug .= $this->debugResponse ? $this->debugRow('Last response', $this->soapClient->__getLastResponse()) : '';
throw new MK_Exception($debug . $this->debugRow('SoapFault', $e->getMessage()));
} catch (Exception $e) {
$debug = $this->debugRequest ? $this->debugRow('Last request', $this->soapClient->__getLastRequest()) : '';
$debug .= $this->debugResponse ? $this->debugRow('Last response', $this->soapClient->__getLastResponse()) : '';
throw new MK_Exception($debug . $this->debugRow('Exception', $e->getMessage()));
}
} else {
throw new MK_Exception('Nie zostało nawiązane połączenie z Brokerem!');
}
}
示例11: soapExecute
protected function soapExecute($method, $data, $responseNode)
{
$xmlResponse = $this->wsClient->{$method}($data)->{$responseNode};
var_dump($xmlResponse);
exit;
$xmlResponse = $this->array_flat(json_decode(json_encode((array) simplexml_load_string($xmlResponse)), true), $arr = []);
$this->setLastError(null);
$this->setLastHttpStatusCode(0);
$this->setLastRawRequest($this->wsClient->__getLastRequest());
$this->setLastRawResponse($this->wsClient->__getLastResponse());
$this->setLastRequest($data);
$this->setLastResponse($xmlResponse);
if ($this->getLastError()) {
throw new Exception\SoapException($this->getLastError());
}
}
示例12: checkResult
/**
* Check result on errors (both: soap error and sugar's responce error)
* @param $result
* @return bool
*/
protected function checkResult($result)
{
$this->fault = null;
if (defined('SUGAR_SOAP_TRACE')) {
$this->log($this->_soap->__getLastRequest(), 'DEBUG');
$this->log($this->_soap->__getLastResponse(), 'DEBUG');
}
if (is_soap_fault($result)) {
$this->fault = array('type' => 'soap', 'code' => $result->faultcode, 'message' => $result->faultstring);
$this->log("SOAP error {$this->fault['message']}", 'ERROR');
return false;
}
if (isset($result->error) && $result->error->number != 0) {
$this->fault = array('type' => 'responce', 'code' => $result->error->number, 'message' => $result->error->name);
$this->log("SOAP sugar responce error {$this->fault['message']}", 'ERROR');
return false;
}
return true;
}
示例13: 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());
}
示例14: CallWSAA
function CallWSAA($CMS)
{
$client = new SoapClient(WSDLA, array('soap_version' => SOAP_1_2, 'location' => URL, 'trace' => 1, 'exceptions' => 0));
$results = $client->loginCms(array('in0' => $CMS));
file_put_contents("request-loginCms.xml", $client->__getLastRequest());
file_put_contents("response-loginCms.xml", $client->__getLastResponse());
if (is_soap_fault($results)) {
exit("SOAP Fault: " . $results->faultcode . "\n" . $results->faultstring . "\n");
}
return $results->loginCmsReturn;
}
示例15: call
/**
* Return result of the SOAP call
*
* @param string $method
* @param array $parameters
*
* @return string|object
*/
public function call($method, array $parameters)
{
try {
$oReturn = $this->soapClient->__soapCall($method, $parameters);
unset($this->soapClient);
return $oReturn;
} catch (\SoapFault $fault) {
print_r("Response: " . $this->soapClient->__getLastResponse());
trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
}
}