/**
 *
 * @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()));
}
Esempio n. 2
0
 public function parse($response)
 {
     if (is_array($response)) {
         $result = array_shift($response);
         $xml = $result->any;
         $matches = array();
         if (preg_match('/<ResultStatus>(?<status>[^\\>]*)<\\/ResultStatus>/', $xml, $matches) != false) {
             $this->resultStatus = $matches['status'];
         }
         if (preg_match('/<ResultMessage>(?<message>[^\\>]*)<\\/ResultMessage>/', $xml, $matches) != false) {
             $this->resultMessage = $matches['message'];
         }
     } elseif (is_string($response)) {
         $matches = array();
         if (preg_match('/<ResultStatus>(?<status>[^\\>]*)<\\/ResultStatus>/', $response, $matches) != false) {
             $this->resultStatus = $matches['status'];
         }
         if (preg_match('/<ResultMessage>(?<message>[^\\>]*)<\\/ResultMessage>/', $response, $matches) != false) {
             $this->resultMessage = $matches['message'];
         }
     } elseif (is_soap_fault($response)) {
         $this->resultStatus = $response->getCode();
         $this->resultMessage = $response->getMessage();
     }
 }
Esempio n. 3
0
 /**
  * Function synthesizing a text 
  * Returned variable is an url of the file
  *
  * @param string $text UTF-8 encoded string to synthesize 
  * @return string URL address for speech file synthesized from $text parameter, or false in case of error
  */
 public function synthesize($text, $text_type)
 {
     error_log("Synthesizing Test: " . $text);
     // the configuration (could be moved to constants section of the website)
     // wsdl URL
     $wsdl = 'http://www.ivona.com/saasapiwsdl.php';
     // soap client initialization (it requires soap client php extension available)
     $Binding = new SoapClient($wsdl, array('exceptions' => 0));
     // getToken for the next operation
     $input = array('user' => USER);
     $token = $Binding->__soapCall('getToken', $input);
     if (is_soap_fault($token)) {
         error_log('API call: getToken error: ' . print_r($token, 1));
         return false;
     }
     // additional parameters
     $params = array();
     //$params[]=array('key'=>'Prosody-Rate', 'value'=>PROSODY_RATE); // example value for the new text speed
     // createSpeechFile (store text in IVONA.com system, invoke synthesis and get the link for the file)
     $input = array('token' => $token, 'md5' => md5(md5(PASSWORD) . $token), 'text' => $text, 'contentType' => $text_type, 'voiceId' => SELECTED_VOICE, 'codecId' => 'mp3/22050', 'params' => $params);
     $fileData = $Binding->__soapCall('createSpeechFile', $input);
     if (is_soap_fault($fileData)) {
         error_log('API call: createSpeechFile error: ' . print_r($fileData, 1));
         return false;
     }
     // return the sound file url
     return $fileData['soundUrl'];
 }
Esempio n. 4
0
 public function info($tag)
 {
     $args = array('guid' => '11111111-1111-1111-1111-111111111111', 'applicationName' => 'GLPI', 'serviceTags' => $tag);
     $response = parent::__soapCall('GetAssetInformation', array($args));
     if (is_soap_fault($response) || !isset($response->GetAssetInformationResult)) {
         return false;
     }
     $ship_time = strtotime($response->GetAssetInformationResult->Asset->AssetHeaderData->SystemShipDate);
     $info['ShipDate'] = date("Y-m-d", $ship_time);
     $warranty_end_date = "";
     $warranty_days_remaining = -1;
     if (isset($response->GetAssetInformationResult->Asset->Entitlements) && isset($response->GetAssetInformationResult->Asset->Entitlements->EntitlementData)) {
         $entitlement_data = $response->GetAssetInformationResult->Asset->Entitlements->EntitlementData;
         $entitlement_data = is_array($entitlement_data) ? $entitlement_data : array($entitlement_data);
         foreach ($entitlement_data as $data) {
             $temp_days = $data->DaysLeft;
             if ($temp_days > $warranty_days_remaining) {
                 $warranty_days_remaining = $temp_days;
                 $warranty_end_date = date('Y-m-d', strtotime($data->EndDate));
             }
             //end if
         }
         //end foreach
     }
     //end if
     if ($warranty_end_date != "") {
         $info['WarrantyEndDate'] = $warranty_end_date;
     }
     //end if
     if ($warranty_days_remaining > -1) {
         $info['WarrantyDaysRemaining'] = $warranty_days_remaining;
     }
     //end if
     return $info;
 }
Esempio n. 5
0
 public static function GetRegZavod()
 {
     $debug = false;
     $wsdl_url = dirname(__FILE__) . '/RegZavodServicePort.wsdl';
     if (!file_exists($wsdl_url)) {
         echo 'Missing WSDL shema for RegZavodServicePort.wsdl', "\n";
         echo 'WSDL PATH: ', $wsdl_url, "\n";
         die;
     }
     $client = new SoapClient($wsdl_url, array('exceptions' => 0, 'trace' => 1, 'user_agent' => 'Bober'));
     $result = $client->__soapCall('getRegZavod', array());
     if ($debug) {
         var_dump($client->__getFunctions());
         echo 'REQUEST HEADERS:', "\n", $client->__getLastRequestHeaders(), "\n";
         echo 'REQUEST:', "\n", $client->__getLastRequest(), "\n";
         var_dump($result);
         if (is_soap_fault($result)) {
             trigger_error('SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})', E_USER_ERROR);
         }
         print_r($result);
     }
     if ($result != '' && !is_soap_fault($result)) {
         $result = json_decode(json_encode($result), true);
         return $result;
     } else {
         return array();
     }
 }
Esempio n. 6
0
 public function __soapCall($function_name, $arguments, $options = null, $input_headers = null, &$output_headers = null)
 {
     $started = microtime(true);
     $this->_data = array_merge($this->_data, ['function_name' => $function_name, 'arguments' => $arguments, 'function_options' => $options, 'input_headers' => $input_headers, 'start_time' => date('Y-m-d H:i:s')]);
     try {
         $result = parent::__soapCall($function_name, $arguments, $options, $input_headers, $output_headers);
         $this->_data['duration'] = microtime(true) - $started;
         if ($output_headers) {
             $this->_data['output_headers'] = (array) $output_headers;
         }
         if (is_soap_fault($result)) {
             // Cover non-exception variant
             return $this->logSoapFault($result);
         }
         $this->_data['result_object'] = $result;
         $this->finalize();
         return $result;
     } catch (\Exception $error) {
         $this->_data['duration'] = microtime(true) - $started;
         if ($output_headers) {
             $this->_data['output_headers'] = (array) $output_headers;
         }
         $this->logSoapFault($error);
         throw $error;
     }
 }
 /**
  * @test
  */
 public function overRedirectMax()
 {
     // no exception option
     $obj = new CurlSoapClient(null, array('location' => 'http://localhost:8000/tests/server.php?redirect=2', 'uri' => 'http://test-uri/', 'redirect_max' => 1, 'exceptions' => false));
     $response = $obj->test(123);
     $this->assertInstanceOf('SoapFault', $response);
     $this->assertTrue(is_soap_fault($response));
 }
 /**
  * @param $soapResult
  * @return mixed
  * @throws \Exception
  */
 public static function check_soap($soapResult)
 {
     if (is_soap_fault($soapResult)) {
         $err = "QAS SOAP Fault - " . "Code: {" . $soapResult->faultcode . "}, " . "Description: {" . $soapResult->faultstring . "}";
         error_log($err, 0);
         throw new \Exception($err);
     }
     return $soapResult;
 }
 public static function dummy($client)
 {
     $results = $client->FEDummy();
     printf("appserver status: %s\ndbserver status: %s\nauthserver status: %s\n", $results->FEDummyResult->appserver, $results->FEDummyResult->dbserver, $results->FEDummyResult->authserver);
     if (is_soap_fault($results)) {
         throw new WsfeException($results->faultcode, $results->faultstring);
     }
     return;
 }
Esempio n. 10
0
 /**
  * Execute the request to the server
  *
  * @param string $method
  * @param array $parameters
  */
 public function __call($method, $parameters)
 {
     array_unshift($parameters, $this->token());
     $result = $this->soap()->__soapCall($method, $parameters);
     if (is_soap_fault($result)) {
         return;
     }
     return $this->sanitize($result);
 }
Esempio n. 11
0
function dummy($client)
{
    $results = $client->FEDummy();
    printf("appserver status: %s\ndbserver status: %s\nauthserver status: %s\n", $results->FEDummyResult->appserver, $results->FEDummyResult->dbserver, $results->FEDummyResult->authserver);
    if (is_soap_fault($results)) {
        printf("Fault: %s\nFaultString: %s\n", $results->faultcode, $results->faultstring);
        exit(1);
    }
    return;
}
 /**
  * Get the API ID
  *
  * @return string Returns "self"
  * @access public
  */
 public function getResponse()
 {
     if (is_soap_fault($this->wsResponse)) {
         return json_encode(array('error' => array('code' => $this->wsResponse->faultcode, 'message' => $this->wsResponse->faultstring)));
     }
     if (!is_array($this->wsResponse)) {
         return json_encode(array('result' => $this->wsResponse));
     }
     return json_encode($this->wsResponse);
 }
Esempio n. 13
0
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;
}
Esempio n. 14
0
 public function BatchSend($mobiel, $content)
 {
     $client = $this->getSoapClient();
     $param = ['Mobile' => $mobiel, 'Content' => $content, 'Cell' => '', 'SendTime' => ''];
     $param = array_merge($this->getInitParams(), $param);
     $result = $client->__Call('BatchSend', array('paramters' => $param));
     if (is_soap_fault($result)) {
         trigger_error("SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})", E_USER_ERROR);
     }
     return $result;
 }
Esempio n. 15
0
 function getInfo($tag)
 {
     $args = array('guid' => self::GUID, 'applicationName' => 'GLPI', 'serviceTags' => $tag);
     $reponse = parent::__soapCall('GetAssetInformation', array($args));
     //print_r($reponse);
     if (is_soap_fault($reponse)) {
         echo "SOAP Fault: ";
         print_r($reponse);
         return NULL;
     }
     return isset($reponse->GetAssetInformationResult) ? $reponse->GetAssetInformationResult : NULL;
 }
Esempio n. 16
0
function CallWSAA($CMS)
{
    # Now we create a context to specify remote web server certificate checking
    # If you don want to check remote server, you may set verify_peer to FALSE.
    $ctx = stream_context_create(array('ssl' => array('CN_match' => REMCN, 'cafile' => REMCACERT, 'allow_self_signed' => REMSELFSIGN, 'verify_peer' => REMVERIFY)));
    $client = new SoapClient(WSDL, array('stream_context' => $ctx, 'soap_version' => SOAP_1_2, 'location' => WSAAURL, 'exceptions' => 0));
    $results = $client->loginCms(array('in0' => $CMS));
    if (is_soap_fault($results)) {
        exit("SOAP Fault: " . $results->faultcode . "\n" . $results->faultstring . "\n");
    }
    return $results->loginCmsReturn;
}
Esempio n. 17
0
 public function get($comany, $ip, $type = TRUE)
 {
     if ($ip == 'none') {
         $ip = $this->logs->getIP();
     }
     if ($type === 'xml') {
         $typeResult = 'xml';
     } elseif ($type === true) {
         $typeResult = 'json';
     } else {
         $typeResult = false;
     }
     if ($comany == 1 || $comany == 'movistar') {
         $url_base = 'https://pcba.telefonicachile.cl/';
         //$url_base = 'http://apimovistar.baking.cl';
         $url = $url_base . "/dhc/retrieveCustomer.php?wsdl";
         $location = $url_base . "/dhc/retrieveCustomer.php";
     } else {
         if ($typeResult == 'json') {
             echo "company error";
             exit;
         } else {
             return false;
         }
     }
     try {
         $client = @new SoapClient($url, array("connection_timeout" => 25, "soap_version" => SOAP_1_1, "exceptions" => 1, "location" => $location, "trace" => 1));
     } catch (SoapFault $e) {
         $this->logs->error("Error API de movistar: ", $e->faultstring, 'logs_api');
         return false;
     }
     $param = array("request" => array("In" => array("Account" => array('User' => 'dhc', 'Password' => 'ws_475'), "Ip" => $ip)));
     $result = $client->__call("getDatIp", $param);
     if (is_soap_fault($result)) {
         trigger_error("SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})", E_USER_ERROR);
     }
     $Out['ip'] = $result->Out->Ip;
     $Out['PhoneNumber'] = $result->Out->PhoneNumber;
     $this->logs->debug("Maldito numero:", $Out, 'logs_api');
     if ($typeResult == 'xml') {
         $result_xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" standalone="yes"?><retrieveCustomer></retrieveCustomer>');
         $result_xml->addChild('ip', $result->Out->Ip);
         $result_xml->addChild('PhoneNumber', $result->Out->PhoneNumber);
         header("Content-Type:text/xml");
         echo $result_xml->asXML();
         exit;
     } elseif ($typeResult == 'json') {
         echo json_encode($Out);
         exit;
     } else {
         return (object) $Out;
     }
 }
 /**
  * renew existing domain
  * @param  string $domain   .ir domain name
  * @param  integer $duration    currently only 1 and 5 is supported
  * @return array                first value is result in boolean and second is responded message 
  */
 public function renew($domain, $duration)
 {
     try {
         $client = new SoapClient($this->url);
         $res = $client->__soapCall('renewDomain', array('api_user' => $this->api_user, 'api_pass' => $this->api_pass, 'domain' => $domain, 'period' => $duration));
         if (is_soap_fault($res)) {
             return array(false, 'RENEW SOAP FAILED');
         }
         $result = isset($res['status']) && empty($res['status']) ? true : false;
         return array($result, $this->message[$res['status']]);
     } catch (TypeEnforcerException $e) {
         return array(false, $e->getMessage());
     }
 }
Esempio n. 19
0
 public function fetch($command)
 {
     $client = $this->client;
     if ($client == NULL) {
         return false;
     }
     $params = func_get_args();
     array_shift($params);
     $command = vsprintf($command, $params);
     $result = $client->executeCommand(new SoapParam($command, "command"));
     if (is_soap_fault($client)) {
         throw new Exception("SOAP Error | Faultcode: " . $client->faultcode . " | Faultstring: " . $client->faultstring);
     }
     return $this->getResult($client->__getLastResponse());
 }
Esempio n. 20
0
 public function soapExchange($data)
 {
     try {
         // set WSDL for authentication and create new SOAP client
         $auth_url = "http://search.webofknowledge.com/esti/wokmws/ws/WOKMWSAuthenticate?wsdl";
         // set WSDL for search and create new SOAP client
         $search_url = "http://search.webofknowledge.com/esti/wokmws/ws/WokSearch?wsdl";
         // array options are temporary and used to track request & response data
         $auth_client = @new SoapClient($auth_url);
         $this->auth_client = $auth_client;
         // array options are temporary and used to track request & response data
         $search_client = @new SoapClient($search_url);
         // run 'authenticate' method and store as variable
         $auth_response = $auth_client->authenticate();
         $this->auth_response = $auth_response;
         // add SID (SessionID) returned from authenticate() to cookie of search client
         $search_client->__setCookie('SID', $auth_response->return);
         $this->search_client = $search_client;
         // put data into suitable format for API search
         $data = ['queryParameters' => ['databaseId' => 'WOS', 'userQuery' => $data['journal1'] . $data['journal2'] . $data['journal3'] . $data['title1'] . $data['title2'] . $data['title3'], 'editions' => ['collection' => 'WOS', 'edition' => 'SCI'], 'timeSpan' => ['begin' => '1970-01-01', 'end' => date('Y-m-d')], 'queryLanguage' => 'en'], 'retrieveParameters' => ['count' => '100', 'sortField' => [['name' => 'TC', 'sort' => 'D']], 'firstRecord' => '1']];
         $this->data = $data;
         // perform search on data
         try {
             $search_response = $search_client->search($data);
             $this->search_response = $search_response;
         } catch (Exception $e) {
             echo $e->getMessage();
         }
         // number of records found by search, used to finish loop (check if no records first)
         // if soap fault, i.e. no recordsFound then set $len to null to avoid undefined variable
         if (isset($search_response->return->recordsFound)) {
             $len = $search_response->return->recordsFound;
             $this->len = $len;
         } else {
             $len = 0;
             $this->len = $len;
         }
         // check if there has been a soap fault with the query OR if there are 0 records for the search
         if (is_soap_fault($search_client->__getLastResponse()) || $len == 0) {
             echo "NO RECORDS";
             // return view('pages.norecords');
         }
     } catch (\SoapFault $e) {
         echo "THROTTLE SERVER OVERLOAD";
         // return view('pages.throttle');
     }
 }
Esempio n. 21
0
/**
 * PHP5 SOAP implementation
 */
function webServiceAction_php5(&$amfbody, $webServiceURI, $webServiceMethod, $args, $phpInternalEncoding)
{
    //Note that encoding is set to php internal encoding,
    //As SoapClient always sends and receives stuff in UTF-8 anyway
    if (class_exists('SoapClient')) {
        $client = new SoapClient($webServiceURI, array("exceptions" => 0, "trace" => 1, "encoding" => $phpInternalEncoding));
        $response = $client->__soapCall($webServiceMethod, $args[0]);
        if (is_soap_fault($response)) {
            $ex = new AMFException(E_USER_ERROR, "SOAP error: " . $client->__getLastResponse(), __FILE__, __LINE__, "AMFPHP_SOAP_ERROR");
            AMFException::throwException($amfbody, $ex);
        }
        return $response;
    } else {
        $ex = new AMFException(E_USER_ERROR, "PHP5 SoapClient is not installed", __FILE__, __LINE__, "AMFPHP_SOAP_NOT_INSTALLED_ERROR");
        AMFException::throwException($amfbody, $ex);
    }
}
Esempio n. 22
0
 /**
  * Envia e recebe requisições para o servidor da loja Tray
  * @author Fábio Rodriguez <*****@*****.**>
  */
 private final function __doRequest($SOAP_Method, $SOAP_Data)
 {
     try {
         $config = array('trace' => 0, 'exceptions' => true, 'cache_wsdl' => WSDL_CACHE_NONE);
         $this->SOAP = new SoapClient($this->WSURL, $config);
         if (!$this->SOAP) {
             throw new Exception("[CLASS INSTANCE ERROR]");
         }
         $result = $this->SOAP->__soapCall($SOAP_Method, $SOAP_Data);
         if (is_soap_fault($result)) {
             throw new Exception("{$result->faultcode}:{$result->faultstring}");
         }
         return $result;
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
Esempio n. 23
0
 private function returnResult($result, $function)
 {
     if ($this->_debug) {
         echo '<div class="qbDebug" style="border-bottom: 1px solid #ccc;">';
         echo '<h2>' . $function . '</h2>';
         echo '<h4>Header:</h4><pre>' . htmlspecialchars($this->_client->__getLastRequestHeaders()) . '</pre>' . "\n";
         echo '<h4>Request:</h4><pre>' . htmlspecialchars($this->_client->__getLastRequest()) . '</pre>' . "\n";
         echo '<h4>Response:</h4><pre>' . htmlspecialchars($this->_client->__getLastResponse()) . '</pre>' . "\n";
         echo '<pre>';
         var_dump($result);
         echo '</pre>';
         echo '</div>';
         if (is_soap_fault($result)) {
             echo 'FAULT DETECTED' . $result->faultstring;
         }
     }
     return $result;
 }
 /**
  * Chequea los errores en la operacion, si encuentra algun error falta lanza una exepcion
  * si encuentra un error no fatal, loguea lo que paso en $this->error
  */
 private function _checkErrors($results, $method)
 {
     if (self::LOG_XMLS) {
         file_put_contents("xmlgenerados/request-" . $method . ".xml", $this->client->__getLastRequest());
         file_put_contents("xmlgenerados/response-" . $method . ".xml", $this->client->__getLastResponse());
     }
     if (is_soap_fault($results)) {
         throw new Exception('WSFE class. FaultString: ' . $results->faultcode . ' ' . $results->faultstring);
     }
     if ($method == 'FEDummy') {
         return;
     }
     $XXX = $method . 'Result';
     if ($results->{$XXX}->RError->percode != 0) {
         $this->error = "Method={$method} errcode=" . $results->{$XXX}->RError->percode . " errmsg=" . $results->{$XXX}->RError->perrmsg;
     }
     return $results->{$XXX}->RError->percode != 0 ? true : false;
 }
 /**
  * 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;
 }
Esempio n. 26
0
 /**
  * Получене отчета
  * @param $inn
  * @return SimpleXMLElement
  */
 public function Statement($inn)
 {
     $client = new SoapClient($this->wsdlUrl, array("trace" => 1, "exceptions" => 0));
     $AuthCredentialHeader = array('UserName' => $this->UserName, 'Password' => $this->Password);
     $uthenticationIdentity = array("Name" => $this->Name, 'Key' => $this->Key);
     $headers = array();
     $headers[] = new SoapHeader($this->url, 'AuthenticationCredential', $AuthCredentialHeader, 'false');
     $headers[] = new SoapHeader($this->url, 'AuthenticationIdentity', $uthenticationIdentity, 'false');
     $client->__setSoapHeaders($headers);
     $result = $client->Statement(array('forID' => $inn));
     //проверка на соеденения
     //        $this->prn($result);
     //        $this->prn($result->faultcode);
     if (is_soap_fault($result)) {
         if ($result->faultcode == 'StatementFailed') {
             $this->result['zona'] = 1;
             $this->result['messege'] = 'Неправельный код ИНН.';
             $this->result['status'] = false;
             return $this->result;
         } elseif ($result->faultcode == 'soap:Server') {
             $this->result['zona'] = 1;
             $this->result['messege'] = 'Ошибка при виполнении запроса в ПВБКИ';
             $this->result['status'] = false;
             return $this->result;
         }
     }
     $arr = (array) $result;
     $load = simplexml_load_string($arr["Report-StatementResult"]);
     //        $this->prn($load->);
     //проверка на данные
     if (isset($load->Contract) && !empty($load->Contract)) {
         $this->result['zona'] = 0;
         $this->result['messege'] = 'В базе ПВБКИ нет информации про клиента.';
         $this->result['status'] = false;
         return $this->result;
     }
     //провенрка на ощибки
     //todo:реалезовать даный метод
     if ($this->debag) {
         $this->writeFile('tmp/PvbkiResult.xml', $arr["Report-StatementResult"]);
     }
     return $this->getOverdueAmount($load);
 }
Esempio n. 27
0
function Connect1C($htp_str)
{
    if (!function_exists('is_soap_fault')) {
        print 'Не настроен web сервер. Не найден модуль php-soap.';
        return false;
    }
    try {
        $Клиент1С = new SoapClient($htp_str, array('login' => 'Administrator', 'password' => 'padlopavel', 'soap_version' => SOAP_1_2, 'cache_wsdl' => WSDL_CACHE_NONE, 'exceptions' => true, 'trace' => 1));
    } catch (SoapFault $e) {
        trigger_error('Ошибка подключения или внутренняя ошибка сервера. Не удалось связаться с базой 1С.', E_ERROR);
        var_dump($e);
    }
    //echo 'Раз<br>';
    if (is_soap_fault($Клиент1С)) {
        trigger_error('Ошибка подключения или внутренняя ошибка сервера. Не удалось связаться с базой 1С.', E_ERROR);
        return false;
    }
    return $Клиент1С;
}
Esempio n. 28
0
 /**
  * request a SOAP service function call. Fault, if occur, will be
  * handle and translate to an ordinary error.
  *
  * @param $function
  *   A string represent the function name.
  *
  * @param $params
  *   An array of the function's parameters.
  *
  * @return
  *   An array of the result with following keys:
  *   - #error  : false, if no error. Otherwise, it is the error message
  *   - #return : the return value from the service.
  */
 public function __call($function, $params = array())
 {
     if (empty($function)) {
         throw new Exception('Function name is required');
     }
     $params = (array) $params;
     if ($this->_client == null) {
         throw new Exception('SOAP client object is not initialised');
     }
     if ($this->_library == "php5soap") {
         try {
             $result = $this->_client->__soapCall($function, $params);
             return $result;
         } catch (Exception $ex) {
             print $ex->getMessage();
         }
         if (is_soap_fault($result['#return'])) {
             throw new Exception('Fault !code: !msg', array('!code' => $result['#return']->faultcode, '!msg' => $result['#return']->faultstring));
         }
     }
 }
 private static function Execute($Command)
 {
     Soap::CreateConnection();
     $Result = Soap::$SConnection->executeCommand(new SoapParam($Command, 'command'));
     Soap::CloseConnection();
     Soap::FlushItemsArray();
     if (is_soap_fault($Result)) {
         return false;
     } else {
         return true;
     }
 }
Esempio n. 30
-2
/**
* Create connection to an RQP server and requests server information
*
* @param string $url  The url of the RQP server
* @return object      An object holding the results of the ServerInformation call 
*                     plus the server url. Returns false in the case of failure
*/
function remote_server_info($url)
{
    if (!($connection = rqp_connect($url))) {
        return false;
    }
    $return = rqp_server_info($connection);
    if (is_soap_fault($return)) {
        $return = false;
    }
    $return->url = $url;
    return $return;
}