Ejemplo n.º 1
0
function pushFault($someSoapClient, $faultOrigin, $soapParameters)
{
    // avoid annoying warnings as not all values are always set
    // API Exception level
    // supplied by the API
    if (!isset($someSoapClient->detail['fault']['code'])) {
        $someSoapClient->detail['fault']['code'] = "N/A";
    }
    if (!isset($someSoapClient->detail['fault']['message'])) {
        $someSoapClient->detail['fault']['message'] = $someSoapClient->getError();
    }
    if (!isset($someSoapClient->detail['fault']['trigger'])) {
        $someSoapClient->detail['fault']['trigger'] = "N/A";
    }
    if (!isset($someSoapClient->detail['fault']['errors'])) {
        $someSoapClient->detail['fault']['errors'] = array();
    }
    if (isset($someSoapClient->detail['fault']['errors']['code'])) {
        $saveFault = $someSoapClient->detail['fault']['errors'];
        unset($someSoapClient->detail['fault']['errors']);
        $someSoapClient->detail['fault']['errors'][0] = $saveFault;
    }
    // supplied by APIlity
    if (!isset($faultOrigin)) {
        $faultOrigin = "N/A";
    }
    if (!isset($soapParameters)) {
        $soapParameters = "N/A";
    }
    // create a fault object
    $faultObject = new APIlityFault($someSoapClient->detail['fault']['code'], $someSoapClient->detail['fault']['message'], $someSoapClient->detail['fault']['trigger'], $someSoapClient->detail['fault']['errors'], $faultOrigin, $soapParameters);
    // by default print the fault message, else when running in silence
    // stealth mode be quiet
    if (!SILENCE_STEALTH_MODE) {
        $faultObject->printFault();
    }
    // access the error stack
    $faultStack =& APIlityFault::getFaultStack();
    // push the fault object in the fault stack and keep only the last
    // #FAULT_STACK_SIZE error messages
    array_push($faultStack, $faultObject);
    if (sizeof($faultStack) <= FAULT_STACK_SIZE) {
        return;
    }
    while (sizeof($faultStack) > FAULT_STACK_SIZE) {
        array_shift($faultStack);
    }
}
Ejemplo n.º 2
0
 function getFaultStack()
 {
     $faultStack =& APIlityFault::getFaultStack();
     return $faultStack;
 }