PHP SoapClient Code Examples

This page contains top rated real world PHP examples of SoapClient extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: calculoAportacionCiudadano.php Project: Veridata/SISCATA
0
/**
 *
 * @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()));
}
Example #2
Show file File: ResaBookingService.php Project: NadaNafti/Thalassa
0
 public function findReservation($debut, $fin)
 {
     $configResaBooking = $this->em->find('BackResaBookingBundle:Configuration', 1);
     $client = new \SoapClient($configResaBooking->getWsdl());
     $request = array($configResaBooking->getLogin(), $configResaBooking->getPassword(), $debut, $fin);
     return $client->__soapCall('findreservation', $request);
 }
Example #3
Show file File: icepay_ideal.php Project: CristianCCIT/shop4office
0
 function create_iDeal_box()
 {
     if ($this->query_bankinfo) {
         $client = new SoapClient($this->wsdl);
         $params->merchantID = MODULE_PAYMENT_ICEPAY_MERCHANT_ID;
         $params->secretCode = MODULE_PAYMENT_ICEPAY_SECRET;
         $ideal_object = $client->GetIDEALIssuers($params);
         $ideal_issuers = $ideal_object->GetIDEALIssuersResult->string;
         $ideal_issuers_arr = array();
         foreach ($ideal_issuers as $ideal_issuer) {
             $ideal_issuers_arr[] = array('id' => $ideal_issuer, 'text' => $ideal_issuer);
         }
     } else {
         $ideal_issuers_arr[] = array('id' => 'ABNAMRO', 'text' => 'ABN AMRO');
         $ideal_issuers_arr[] = array('id' => 'ASNBANK', 'text' => 'ASN Bank');
         $ideal_issuers_arr[] = array('id' => 'FRIESLAND', 'text' => 'Friesland Bank');
         $ideal_issuers_arr[] = array('id' => 'ING', 'text' => 'ING');
         $ideal_issuers_arr[] = array('id' => 'RABOBANK', 'text' => 'Rabobank');
         $ideal_issuers_arr[] = array('id' => 'SNSBANK', 'text' => 'SNS Bank');
         $ideal_issuers_arr[] = array('id' => 'SNSREGIOBANK', 'text' => 'SNS Regio Bank');
         $ideal_issuers_arr[] = array('id' => 'TRIODOSBANK', 'text' => 'Triodos Bank');
         $ideal_issuers_arr[] = array('id' => 'VANLANSCHOT', 'text' => 'Van Lanschot');
     }
     $dropdown = '<select name="ic_issuer" >';
     foreach ($ideal_issuers_arr as $ideal_issuer) {
         $dropdown .= '<option value="' . $ideal_issuer['id'] . '" >' . $ideal_issuer['text'] . '</option>';
     }
     $dropdown .= '</select>';
     $create_iDeal_box = "<div style=\"margin-right:20px; display:block; float:left;\">" . Translate('Kies uw bank voor het afrekenen met iDEAL: ') . $dropdown . "</div>";
     return $create_iDeal_box;
 }
Example #4
Show file File: LocalezeRequester.php Project: credibility/laravel-localeze
0
 public function process(LocalezeRequest $request)
 {
     $username = $this->app->make('config')->get('laravel-localeze::username');
     $password = $this->app->make('config')->get('laravel-localeze::password');
     $response = $this->soap->query(["origination" => $this->setupOrigination($username, $password), "transId" => 1, "serviceId" => $this->serviceId, "elements" => $request->elements, "serviceKeys" => $request->serviceKeys]);
     return new LocalezeResponse($response);
 }
Example #5
Show file File: Validation.php Project: snowcap/vat-validation
0
 /**
  * @param string $countryCode
  * @param string $vatNumber
  * @return bool
  */
 public function check($countryCode, $vatNumber)
 {
     $this->initClient();
     $vatNumber = preg_replace("/[ .]/", "", $vatNumber);
     try {
         $rs = $this->_client->checkVat(array('countryCode' => $countryCode, 'vatNumber' => $vatNumber));
     } catch (\SoapFault $e) {
         if ($e->getMessage() === 'INVALID_INPUT') {
             return false;
         }
         throw $e;
     }
     if ($rs->valid) {
         $this->_valid = true;
         list($denomination, $name) = strpos($rs->name, ' ') !== false ? explode(" ", $rs->name, 2) : array('', '');
         list($streetline, $cityline) = strpos($rs->address, "\n" !== false) ? explode("\n", $rs->address) : array('', '');
         preg_match('/(.+) ([^ ]*[0-9]+[^ ]*)/', $this->cleanUpString($streetline), $parts);
         if (count($parts) === 0) {
             $street = $this->cleanUpString($streetline);
             $number = "";
         } else {
             $street = $parts[1];
             $number = $parts[2];
         }
         list($zip, $city) = $cityline !== '' ? explode(' ', $this->cleanUpString($cityline), 2) : array('', '');
         $this->_data = array('denomination' => $denomination, 'name' => $this->cleanUpString($name), 'address' => $this->cleanUpString($rs->address), 'street' => $street, 'number' => $number, 'zip' => $zip, 'city' => $city, 'country' => $countryCode);
         return true;
     } else {
         $this->_valid = false;
         $this->_data = array();
         return false;
     }
 }
Example #6
Show file File: class-checkout.php Project: apsolut/Yoast-theme-public
0
 /**
  * Check a given VAT number with the europe VIES check
  *
  * @param string $country The country code to check with the VAT number.
  * @param string $vat_nr The VAT number to check.
  *
  * @return bool|null
  */
 private function check_vat($country, $vat_nr)
 {
     $country = trim($country);
     $vat_nr = trim($vat_nr);
     // Strip all spaces from the VAT number to improve usability of the VAT field.
     $vat_nr = str_replace(' ', '', $vat_nr);
     if (0 === strpos($vat_nr, $country)) {
         $vat_nr = trim(substr($vat_nr, strlen($country)));
     }
     try {
         // Do the remote request.
         $client = new \SoapClient('http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl');
         $returnVat = $client->checkVat(array('countryCode' => $country, 'vatNumber' => $vat_nr));
     } catch (\Exception $e) {
         error_log('VIES API Error for ' . $country . ' - ' . $vat_nr . ': ' . $e->getMessage());
         return 2;
     }
     // Return the response.
     if (isset($returnVat)) {
         if (true == $returnVat->valid) {
             return 1;
         } else {
             return 0;
         }
     }
     // Return null if the service is down.
     return 2;
 }
Example #7
Show file File: InviteController.php Project: Yatko/Gifteng
0
 /**
  * Invokes the user registration on WS.
  *
  * @return response
  * @throws Exception in case of WS error
  */
 public function registerUser()
 {
     try {
         $userService = new SoapClient(Config::get('wsdl.user'));
         $user = new UserModel(Input::all());
         $array = array("user" => $user, "password" => Input::get('password'), "invitationCode" => Input::get('code'));
         if (Input::get('ref')) {
             $array['referrerId'] = Input::get('ref');
         }
         $result = $userService->registerUser($array);
         $authService = new SoapClient(Config::get('wsdl.auth'));
         $token = $authService->authenticateEmail(array("email" => Input::get('email'), "password" => Input::get('password'), "userAgent" => NULL));
         ini_set('soap.wsdl_cache_enabled', '0');
         ini_set('user_agent', "PHP-SOAP/" . PHP_VERSION . "\r\n" . "AuthToken: " . $token->AuthToken);
         Session::put('user.token', $token);
         try {
             $userService = new SoapClient(Config::get('wsdl.user'));
             $result = $userService->getUserByEmail(array("email" => Input::get('email')));
             $user = $result->user;
             /*	if ($user -> businessAccount == true) {
             				if (isset($user -> addresses) && is_object($user -> addresses)) {
             					$user -> addresses = array($user -> addresses);
             				}
             			}  */
             Session::put('user.data', $user);
             return array('success' => true);
         } catch (InnerException $ex) {
             //throw new Exception($ex -> faultstring);
             return array('success' => false, 'faultstring' => $ex->faultstring);
         }
     } catch (Exception $ex) {
         return array('success' => false, 'faultstring' => $ex->faultstring);
     }
 }
Example #8
Show file File: Track.php Project: previewict/phpie
0
 public function track($trackingNumber)
 {
     if (!isset($trackingNumber)) {
         return false;
     }
     //The WSDL is not included with the sample code.
     //Please include and reference in $path_to_wsdl variable.
     $path_to_wsdl = __DIR__ . DIRECTORY_SEPARATOR . 'TrackService_v9.wsdl';
     ini_set("soap.wsdl_cache_enabled", "0");
     $client = new \SoapClient($path_to_wsdl, array('trace' => 1));
     // Refer to http://us3.php.net/manual/en/ref.soap.php for more information
     $request['WebAuthenticationDetail'] = array('UserCredential' => array('Key' => $this->authKey, 'Password' => $this->authPassword));
     $request['ClientDetail'] = array('AccountNumber' => $this->authAccountNumber, 'MeterNumber' => $this->authMeterNumber);
     $request['TransactionDetail'] = array('CustomerTransactionId' => '*** Track Request using PHP ***');
     $request['Version'] = array('ServiceId' => 'trck', 'Major' => '9', 'Intermediate' => '1', 'Minor' => '0');
     $request['SelectionDetails'] = array('PackageIdentifier' => array('Type' => 'TRACKING_NUMBER_OR_DOORTAG', 'Value' => $trackingNumber));
     try {
         if ($this->setEndpoint('changeEndpoint')) {
             $newLocation = $client->__setLocation(setEndpoint('endpoint'));
         }
         $response = $client->track($request);
         $this->responseToArray($response);
         return $response;
     } catch (SoapFault $exception) {
         $this->printFault($exception, $client);
     }
 }
Example #9
Show file File: purolator.class.php Project: richhl/sfCartPlugin
0
 function createRatesClient()
 {
     $client = new SoapClient("EstimatingService.wsdl", array('trace' => true, 'location' => "https://webservices.purolator.com/PWS/V1/Estimating/EstimatingService.asmx", 'uri' => "http://purolator.com/pws/datatypes/v1", 'login' => PRODUCTION_KEY, 'password' => PRODUCTION_PASS));
     $headers[] = new SoapHeader('http://purolator.com/pws/datatypes/v1', 'RequestContext', array('Version' => '1.0', 'Language' => 'en', 'GroupID' => 'xxx', 'RequestReference' => 'Rating Example'));
     $client->__setSoapHeaders($headers);
     return $client;
 }
Example #10
Show file File: TurboSMS.php Project: cosmolady/cosmolady.github.io
0
 public function send($destination, $text)
 {
     $client = new SoapClient(self::URL);
     $sendResult = array('sent' => false, 'message' => '');
     $result = $client->Auth(array('login' => self::LOGIN, 'password' => self::PASS));
     var_dump($result);
     if ($result->AuthResult != 'Вы успешно авторизировались') {
         $sendResult['message'] = 'Не удалось авторизоваться';
         return $sendResult;
     }
     $result = $client->GetCreditBalance();
     if ($result->GetCreditBalanceResult <= 0) {
         $sendResult['message'] = 'Недостаточно средств для отправки';
         return false;
     }
     $destination = $this->formatPhone($destination);
     if (!$destination) {
         $sendResult['message'] = 'Неверный формат номера получателя';
         return $sendResult;
     }
     $sms = array('sender' => self::SENDER, 'destination' => $destination, 'text' => $text);
     //echo  "try to send sms to ".$destination." from ".$sender." with message = ".$text;
     // Подпись отправителя может содержать английские буквы и цифры. Максимальная длина - 11 символов.
     // Номер указывается в полном формате, включая плюс и код страны
     $result = $client->SendSMS($sms);
     if ($result->SendSMSResult->ResultArray[0] != 'Сообщения успешно отправлены') {
         var_dump($result->SendSMSResult);
         $sendResult['message'] = $result->SendSMSResult->ResultArray[0];
         return $sendResult;
     }
     $sendResult['sent'] = true;
     return $sendResult;
 }
Example #11
Show file File: productos.php Project: jjaviergr/tienda_soap_ejemplo_basico
0
function creaFormularioProductos()
{
    $productos = BD::obtieneProductos();
    $uri = "http://localhost/tienda/recursos_u5/TiendaOnlineOO/tienda";
    $url = "{$uri}/servicio_sin_wdsl.php";
    $cliente = new SoapClient(null, array('location' => $url, 'uri' => $uri, 'trace' => true));
    foreach ($productos as $p) {
        echo "<p><form id='" . $p->getcodigo() . "' action='productos.php' method='post'>";
        // Metemos ocultos los datos de los productos
        echo "<input type='hidden' name='cod' value='" . $p->getcodigo() . "'/>";
        echo "<input type='submit' name='enviar' value='Añadir'/>";
        echo $p->getnombrecorto() . ": ";
        echo $p->getPVP() . " euros.";
        echo "<input type='submit' name='detalle' value='Mostrar detalle'/>";
        echo "</p>";
        echo "</form>";
        if (isset($_POST['detalle'])) {
            if ($_POST['cod'] == $p->getcodigo()) {
                try {
                    //$unproducto=$cliente->obtieneProducto($p->getcodigo());
                    //echo $unproducto->getPVP();
                    $unprecio = $cliente->obtienePrecioProducto($p->getcodigo());
                    print "<p>Precio :" + $unprecio + "</p>";
                } catch (Exception $e) {
                    echo "Exception: " . $e->getMessage();
                }
                // echo $p->getPVP();
                echo "<p>" + $p->getcodigo() + "</p>";
                echo "<p>" + $p->getnombre() + "</p>";
                echo "<p>:" + $p->muestra() + "</p>";
            }
        }
    }
}
Example #12
Show file File: service_rdwd.class.php Project: h3len/Project
0
 public function detail($id)
 {
     $arr = array();
     $xml = '<?xml version="1.0" encoding="utf-8"?>';
     $xml .= '<paras>';
     $xml .= '<IdentityGuid>Epoint_WebSerivce_**##0601</IdentityGuid>';
     $xml .= '<infoid>' . $id . '</infoid>';
     $xml .= '</paras>';
     $cilentOptions = array('trace' => true, 'exceptions' => true, 'cache_wsdl' => WSDL_CACHE_NONE);
     $client = new SoapClient(WEB_URL, $cilentOptions);
     $ret_str = $client->SelectBMZX(array('xmlWebInfo' => $xml));
     //var_dump($ret_str);exit();
     $ret_str = $ret_str->SelectBMZXResult;
     $ret_str = xml2Array($ret_str);
     //hg_pre($ret_str);exit();
     if (!$ret_str['DATA']['ReturnInfo']['Status']) {
         return $arr;
     }
     $data = $ret_str['DATA']['UserArea'];
     //hg_pre($data);exit();
     $arr['id'] = $data['infoid'];
     $arr['create_time'] = strtotime($data['infodate']);
     $arr['title'] = $data['title'];
     $arr['content'] = str_replace("&nbsp;", "", strip_tags($data['InfoContent']));
     $arr['click_times'] = $data['ClickTimes'];
     //点击次数
     //hg_pre($arr);exit();
     return $arr;
 }
Example #13
Show file File: function.php Project: ZarinPal-Lab/RaPayment
0
function back_from_bank($Amount, $config, $transids, $lang)
{
    if ($_GET['Status'] == 'OK') {
        $client = new SoapClient('https://de.zarinpal.com/pg/services/WebGate/wsdl', array('encoding' => 'UTF-8'));
        $result = $client->PaymentVerification(array('MerchantID' => $config['merchent_code'], 'Authority' => $_GET['Authority'], 'Amount' => $Amount / 10));
        $tracking_code = $result->RefID;
        $result = $result->Status;
        if ($result == 100) {
            $show['Status'] = 1;
            $show['massage'] = $lang['Successful']['back'];
            $show['trans_id1'] = $tracking_code;
            $show['trans_id2'] = $_GET['Authority'];
        } else {
            $show['Status'] = 0;
            $show['massage'] = $lang['error'][$result];
            $show['trans_id1'] = $tracking_code;
            $show['trans_id2'] = $_GET['Authority'];
        }
    } else {
        $show['Status'] = 0;
        $show['massage'] = $lang['error']['not_back'];
        $show['trans_id1'] = $tracking_code;
        $show['trans_id2'] = $_GET['Authority'];
    }
    return $show;
}
Example #14
Show file File: Receipt.php Project: njmube/CSDOCSCFDI
0
 public static function ValidateWithWebServiceSAT($rfc_emisor, $rfc_receptor, $total_factura, $uuid)
 {
     $web_service = "https://consultaqr.facturaelectronica.sat.gob.mx/ConsultaCFDIService.svc?wsdl";
     $hora_envio = date("Y-m-d H:i:s");
     try {
         $client = new SoapClient($web_service);
     } catch (Exception $e) {
         echo '\\n Error de validación en WS Sat: ', $e->getMessage();
         return 0;
     }
     $cadena = "re={$rfc_emisor}&rr={$rfc_receptor}&tt={$total_factura}&id={$uuid}";
     $param = array('expresionImpresa' => $cadena);
     try {
         $respuesta = $client->Consulta($param);
     } catch (Exception $ex) {
         echo "\n Error en WebService SAT. " . $ex;
         return 0;
     }
     $hora_recepcion = date("Y-m-d H:i:s");
     if ($respuesta->ConsultaResult->Estado == 'Vigente') {
         $cadena_encriptar = $hora_envio . '│' . $rfc_emisor . '│' . $rfc_receptor . '│' . $total_factura . '│' . $uuid . '│' . $hora_recepcion;
         $md5 = md5($cadena_encriptar);
         return $xml = Receipt::CreateReceiptXml($respuesta, $rfc_emisor, $rfc_receptor, $total_factura, $uuid, $web_service, $hora_envio, $hora_recepcion, $md5);
     } else {
         return 0;
     }
 }
Example #15
Show file File: fleximport_semiro_participant_import.php Project: Krassmus/Fleximport
0
 /**
  * You can specify a custom import.
  * @return bool
  */
 public function fetchData()
 {
     $wsdl = FleximportConfig::get("SEMIRO_SOAP_PARTICIPANTS_WSDL");
     $soap = new SoapClient($wsdl, array('trace' => 1, 'exceptions' => 0, 'cache_wsdl' => $GLOBALS['CACHING_ENABLE'] || !isset($GLOBALS['CACHING_ENABLE']) ? WSDL_CACHE_BOTH : WSDL_CACHE_NONE, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS));
     $file = strtolower(substr($wsdl, strrpos($wsdl, "/") + 1));
     $soapHeaders = new SoapHeader($file, 'Header', array('pw' => FleximportConfig::get("SEMIRO_SOAP_PASSWORD")));
     $soap->__setSoapHeaders($soapHeaders);
     $result = $soap->getTeilnehmerXML(array('pw' => FleximportConfig::get("SEMIRO_SOAP_PASSWORD")));
     if (is_a($result, "SoapFault")) {
         throw new Exception("SOAP-error: " . $result->faultstring);
     }
     $fields = array();
     $doc = new DOMDocument();
     $doc->loadXML(studip_utf8decode($result->return));
     $seminar_data = array();
     foreach ($doc->getElementsByTagName("teilnehmer") as $seminar) {
         $seminar_data_row = array();
         foreach ($seminar->childNodes as $attribute) {
             if ($attribute->tagName) {
                 if (!in_array(studip_utf8decode(trim($attribute->tagName)), $fields)) {
                     $fields[] = studip_utf8decode(trim($attribute->tagName));
                 }
                 $seminar_data_row[] = studip_utf8decode(trim($attribute->nodeValue));
             }
         }
         $seminar_data[] = $seminar_data_row;
     }
     $this->table->createTable($fields, $seminar_data);
 }
Example #16
Show file File: webservice_sat.php Project: njmube/CSDOCSCFDI
0
 public function valida_cfdi($rfc_emisor, $rfc_receptor, $total_factura, $uuid)
 {
     /*
             * Mensajes de Respuesta
             Los mensajes de respuesta que arroja el servicio de consulta de CFDI´s incluyen la descripción del resultado de la operación que corresponden a la siguiente clasificación:
             Mensajes de Rechazo.
             N 601: La expresión impresa proporcionada no es válida.
             Este código de respuesta se presentará cuando la petición de validación no se haya respetado en el formato definido.
             N 602: Comprobante no encontrado.
             Este código de respuesta se presentará cuando el UUID del comprobante no se encuentre en la Base de Datos del SAT.
             Mensajes de Aceptación.
             S Comprobante obtenido satisfactoriamente.
     */
     //           printf("\n clase webservice rfce=$rfc_emisor rfcr=$rfc_receptor total=$total_factura uuid=$uuid");
     $web_service = "https://consultaqr.facturaelectronica.sat.gob.mx/ConsultaCFDIService.svc?wsdl";
     try {
         $hora_envio = date("Y-m-d H:i:s");
         $client = new SoapClient($web_service);
     } catch (Exception $e) {
         echo 'Excepción capturada: ', $e->getMessage(), "\n";
     }
     $cadena = "re={$rfc_emisor}&rr={$rfc_receptor}&tt={$total_factura}&id={$uuid}";
     $param = array('expresionImpresa' => $cadena);
     $respuesta = $client->Consulta($param);
     $hora_recepcion = date("Y-m-d H:i:s");
     $xml = 0;
     if ($respuesta->ConsultaResult->Estado == 'Vigente') {
         $cadena_encriptar = $hora_envio . '│' . $rfc_emisor . '│' . $rfc_receptor . '│' . $total_factura . '│' . $uuid . '│' . $hora_recepcion;
         $md5 = md5($cadena_encriptar);
         $xml = $this->create_xml($respuesta, $rfc_emisor, $rfc_receptor, $total_factura, $uuid, $web_service, $hora_envio, $hora_recepcion, $md5);
     }
     return $xml;
 }
Example #17
Show file File: RegisterZavodov.php Project: lidijakralj/bober
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();
     }
 }
Example #18
Show file File: phpsoap.php Project: JackCanada/moodle-hacks
0
/**
* Make a call to a SoapClient
*
* @param SoapClient $connection  The SoapClient to call
* @param string $call            Operation to be performed by client
* @param array $params           Parameters for the call
* @return mixed                  The return parameters of the operation or a SoapFault
*                                If the operation returned several parameters then these
*                                are returned as an object rather than an array
*/
function soap_call($connection, $call, $params)
{
    try {
        $return = $connection->__soapCall($call, $params);
    } catch (SoapFault $f) {
        $return = $f;
    } catch (Exception $e) {
        $return = new SoapFault('client', 'Could call the method');
    }
    // return multiple parameters using an object rather than an array
    if (is_array($return)) {
        $keys = array_keys($return);
        $assoc = true;
        foreach ($keys as $key) {
            if (!is_string($key)) {
                $assoc = false;
                break;
            }
        }
        if ($assoc) {
            $return = (object) $return;
        }
    }
    return $return;
}
Example #19
Show file File: worketc.php Project: rongandat/scalaprj
0
 public function login($email, $pass, $options = array())
 {
     // Import the supplied options.
     $this->options = array_merge($this->options, $options);
     // Debug
     $this->error("Logging in as {$email} to {$this->options['alias']}.");
     $url_header = @get_headers($this->getUrl());
     if ($url_header[0] == 'HTTP/1.1 404 Not Found' || !$url_header) {
         return false;
     }
     // Authenticating and save session key
     $authClient = new SoapClient($this->getUrl(), $this->soap_options);
     $response = $authClient->AuthenticateWebSafe(array('email' => $email, 'pass' => $pass));
     // Bad login case
     if ($response->AuthenticateWebSafeResult->Code == "Not_Found") {
         return false;
     } else {
         if ($response->AuthenticateWebSafeResult->Code == "Success") {
             // Save the session key in class and session
             $this->VeetroSession = $response->AuthenticateWebSafeResult->SessionKey;
             $this->User = $response;
             $this->session('VeetroSession', $this->VeetroSession);
             $this->session('UserID', (string) $response->AuthenticateWebSafeResult->User->EntityID);
             $this->session('User', $response->AuthenticateWebSafeResult->User);
             $this->error("Saving new session key {$this->VeetroSession}.");
             // Connect to api with VeetroHeader.
             $this->connect();
             return true;
         } else {
             $this->error("Unknown auth response code: {$response->AuthenticateWebSafeResult->Code}", self::ERROR);
             die(print_r($response, true));
         }
     }
 }
Example #20
Show file File: soap.php Project: fg-ok/codev
0
 public static function soapRequest($args)
 {
     // get SOAP function name to call
     if (!isset($args['action'])) {
         die("No action specified.");
     }
     $function_name = $args['action'];
     // remove function name from arguments
     unset($args['action']);
     // prepend username/passwords to arguments
     $args = array_merge(self::$conf, $args);
     // connect and do the SOAP call
     try {
         $client = new SoapClient(self::$mantisConnectUrl . '?wsdl');
         $result = $client->__soapCall($function_name, $args);
         echo "URL : " . self::$mantisConnectUrl . '?wsdl' . "<br>";
         echo "Method : " . $function_name . "<br>";
         echo "Args : " . "<br>";
         var_dump($args);
         echo "<br>";
     } catch (SoapFault $e) {
         self::$logger->error("Error with Mantis SOAP", $e);
         $result = array('error' => $e->faultstring);
     }
     return $result;
 }
Example #21
Show file File: eform2mailbuild.snippet.php Project: brettflorio/eform2mailbuild
0
function eForm2MailBuild(&$fields)
{
    $params = new stdclass();
    $params->ApiKey = MB_API_KEY;
    $params->ListID = MB_LIST_ID;
    $params->Name = $fields['first_name'] . ' ' . $fields['last_name'];
    $params->Email = $fields['email'];
    try {
        $client = new SoapClient("http://api.createsend.com/api/api.asmx?wsdl", array('trace' => 1));
        $result = get_object_vars($client->AddSubscriber($params));
        $resultCode = current($result)->Code;
        $resultMessage = current($result)->Message;
        // If not successful
        if ($resultCode > 0) {
            $isError = true;
        }
        // The following code produces the entire service request and response. It may be useful for debugging.
        /*
              print "<pre>\n";
        print "Request :\n".htmlspecialchars($client->__getLastRequest()) ."\n";
        print "Response:\n".htmlspecialchars($client->__getLastResponse())."\n";
        print "</pre>";
        */
    } catch (SoapFault $e) {
        // mail('admin@host.com', 'error processing form', $e->getMessage()); // Uncomment and replace email address if you want to know when something goes wrong.
        // print_r($e); die(); // Uncomment to spit out debugging information and die on error.
    }
    return true;
}
Example #22
Show file File: wsSiteController.php Project: rusli-nasir/ERP_Accounting_Indonesia
0
 public function actionTest()
 {
     $wsdlUrl = Yii::app()->request->hostInfo . $this->createUrl('user');
     $client = new SoapClient($wsdlUrl);
     echo "<pre>";
     echo "login...\n";
     $client->login('admin', '1234qwe');
     echo "fetching all contacts\n";
     //echo $client->login('admin','1234qwe');
     echo "<br/>";
     print_r($client->getUsers());
     //CVarDumper::dump($client->getUsers());
     echo "<br/>";
     echo Yii::app()->request->hostInfo . $this->createUrl('user');
     echo "<br/>";
     echo "\ninserting a new contact...";
     $model = new sUser();
     $model->username = 'Tester';
     $model->password = '1234qwe';
     $model->salt = '1234qwe';
     $model->default_group = 1;
     $model->status_id = 1;
     $model->created_date = time();
     $model->created_by = "admin";
     $client->saveUser($model);
     echo "done\n\n";
     echo "fetching all contacts\n";
     print_r($client->getUsers());
     echo "</pre>";
 }
Example #23
Show file File: Vat.php Project: kokkez/shineisp
0
 private function eu_check()
 {
     $isp = Shineisp_Registry::get('ISP');
     $VIES = new SoapClient($this->vies_soap_url);
     if ($VIES) {
         try {
             $r = $VIES->checkVat(array('countryCode' => $this->countryCode, 'vatNumber' => $this->vat));
             foreach ($r as $chiave => $valore) {
                 $this->viesOutput[$chiave] = $valore;
             }
             return $r->valid;
         } catch (SoapFault $e) {
             $ret = $e->faultstring;
             $regex = '/\\{ \'([A-Z_]*)\' \\}/';
             $n = preg_match($regex, $ret, $matches);
             $ret = !empty($matches[1]) ? $matches[1] : $ret;
             $faults = array('INVALID_INPUT' => 'The provided CountryCode is invalid or the VAT number is empty', 'SERVICE_UNAVAILABLE' => 'The SOAP service is unavailable, try again later', 'MS_UNAVAILABLE' => 'The Member State service is unavailable, try again later or with another Member State', 'TIMEOUT' => 'The Member State service could not be reached in time, try again later or with another Member State', 'SERVER_BUSY' => 'The service cannot process your request. Try again later.');
             $ret = $faults[$ret];
             // adding a log message
             Shineisp_Commons_Utilities::log("Response from VIES: " . $ret);
             $subject = 'Invalid VAT code';
             $body = "Response from VIES: " . $ret;
             Shineisp_Commons_Utilities::SendEmail($isp->email, $isp->email, null, $subject, $body);
             return false;
         }
     } else {
         $subject = 'Connect to VIES';
         $body = "Impossible to connect with VIES";
         Shineisp_Commons_Utilities::SendEmail($isp->email, $isp->email, null, $subject, $body);
         // adding a log message
         Shineisp_Commons_Utilities::log("Response from VIES: " . $ret);
         return false;
     }
     return true;
 }
Example #24
Show file File: Tx_Formhandler_Finisher_Subscribe.php Project: raimundlandig/winkel.de-DEV
0
 /**
  *
  * @return void
  */
 protected function addReceiver()
 {
     $soap = new SoapClient($this->settings['wsdlUrl']);
     $userdata = array();
     $userdata['source'] = $this->settings['source'];
     $userdata['registered'] = time();
     $attributes = array_merge($this->parseFields('fields.'), $this->parseFields('additionalfields.'));
     $userdata['email'] = $attributes['email'];
     $userdata['attributes'] = $this->convertAttributes($attributes);
     $this->utilityFuncs->debugMessage("Attributes: \"" . print_r($userdata['attributes'], true) . "\"");
     // überprüfen, ob schon im System ist
     $return = $soap->receiverGetByEmail($this->settings['apiKey'], $this->settings['listId'], $userdata['email'], 0);
     $subscriber_found = !($return->statuscode == 20);
     if (!$subscriber_found) {
         $return = $soap->receiverAdd($this->settings['apiKey'], $this->settings['listId'], $userdata);
         if ($return->status == Tx_Formhandler_Finisher_CleverReach::STATUS_SUCCESS) {
             $this->utilityFuncs->debugMessage("Subscriber \"" . $userdata['email'] . "\" accepted");
         } else {
             $this->utilityFuncs->debugMessage("A problem with the new subscriber: " . (string) $return->message);
         }
     }
     if ($this->settings['directSubscription'] == "1") {
         // sofort aktivieren
         $return = $soap->receiverSetActive($this->settings['apiKey'], $this->settings['listId'], $userdata['email']);
     } else {
         $return = $soap->formsActivationMail($this->settings['apiKey'], $this->settings['formId'], $userdata['email']);
         if ($return->status == Tx_Formhandler_Finisher_CleverReach::STATUS_SUCCESS) {
             $this->utilityFuncs->debugMessage("Activation mail sent");
         } else {
             $this->utilityFuncs->debugMessage("Activation mail error for \"" . $userdata['email'] . "\": " . $return->message);
         }
     }
 }
Example #25
Show file File: class.pmTalendFunctions.php Project: nshong/processmaker
0
/**
 * @method
 *
 * Executes a Talend Web Service..
 *
 * @name executeTalendWebservice
 * @label Executes a Talend Web Service.
 *
 * @param string | $wsdl | Talend Web Service (including ?WSDL)
 * @param array(array(n1 v1) array(n2 v2) array(nN vN)) | $params | Array of params. Pairs of param Name Value
 * @param string | $message | Message to be displayed
 * @return array | $return | Talend Array
 *
 */
function executeTalendWebservice($wsdl, $params = array(), $message)
{
    $client = new SoapClient($wsdl, array('trace' => 1));
    $params[0] = "";
    foreach ($params as $paramO) {
        $params[] = "--context_param" . $paramO[0] . "=" . $paramO[1];
    }
    $result = $client->__SoapCall('runJob', array($params));
    /*
    $params[1]="--context_param nb_line=".@=Quantity;
    
    $result = $client->__SoapCall('runJob', array($params));
    foreach ($result->item as $keyItem => $item){
    $gridRow=$keyItem+1;
    @=USERSINFO[$gridRow]['NAME']=$item->item[1];
    @=USERSINFO[$gridRow]['LASTNAME']=$item->item[2];
    @=USERSINFO[$gridRow]['DATE']=$item->item[0];
    @=USERSINFO[$gridRow]['STREET']=$item->item[3];
    @=USERSINFO[$gridRow]['CITY']=$item->item[4];
    @=USERSINFO[$gridRow]['STATE']=$item->item[5];
    @=USERSINFO[$gridRow]['STATEID']=$item->item[6];
    
    }
    */
    G::SendMessageText("<font color='blue'>Information from Talend ETL webservice</font><font color='darkgray'><br>" . $wsdl . "</font>", "INFO");
}
Example #26
Show file File: tnt_suiviColis.php Project: romfr/infostrates_tnt
0
function suivi_colis($suivi)
{
    $url = 'http://www.tnt.fr/service/tracking?wsdl';
    $username = '';
    $password = '';
    $authheader = sprintf('
						<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
						  <wsse:UsernameToken>
							<wsse:Username>%s</wsse:Username>
							<wsse:Password>%s</wsse:Password>
						 </wsse:UsernameToken>
						</wsse:Security>', htmlspecialchars($username), htmlspecialchars($password));
    $authvars = new SoapVar($authheader, XSD_ANYXML);
    $header = new SoapHeader('http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd', 'Security', $authvars);
    $soap = new SoapClient($url, array('trace' => 1));
    $soap->__setSOAPHeaders(array($header));
    try {
        $result = $soap->trackingByConsignment(array('parcelNumber' => $suivi));
        $etape = getStage($result);
        if (is_array($result->Parcel->longStatus)) {
            $statut = $result->Parcel->longStatus[0];
            $message = $result->Parcel->longStatus[1];
        } else {
            $statut = $result->Parcel->longStatus;
            $message = '';
        }
        $result = 'tntB2CSuiviColisDisplayDetail(["' . $result->Parcel->consignmentNumber . '","' . $result->Parcel->reference . '","' . $result->Parcel->receiver->city . '","","",["' . $statut . '","' . $message . '"],[],"' . $etape . '"])';
    } catch (Exception $e) {
        $result = $e->getMessage();
    }
    return $result;
}
Example #27
Show file File: tax.php Project: knigherrant/decopatio
0
 /**
  * Check if this is a valid VIES VAT
  *
  * Code credits: Nicholas from AkeebaBackup.com
  */
 public function isValidVat($country, $vat)
 {
     $vat = trim(strtoupper($vat));
     $country = trim(strtoupper($country));
     // cache
     $data = json_decode($this->app->session->get('zoocart_vat_cache'), true);
     if ($data && array_key_exists($country . $vat, $data)) {
         return $data[$country . $vat];
     }
     if (!class_exists('SoapClient')) {
         $ret = false;
     } else {
         // Using the SOAP API
         // Code credits: Angel Melguiz / KMELWEBDESIGN SLNE (www.kmelwebdesign.com)
         try {
             $sClient = new SoapClient('http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl');
             $params = array('countryCode' => $country, 'vatNumber' => $vat);
             $response = $sClient->checkVat($params);
             if ($response->valid) {
                 $ret = true;
             } else {
                 $ret = false;
             }
         } catch (SoapFault $e) {
             $ret = false;
         }
     }
     $data[$country . $vat] = $ret;
     $this->app->session->set('zoocart_vat_cache', json_encode($data));
     // Return the result
     return $ret;
 }
Example #28
Show file File: SetDeliveryModule.php Project: lopes-vincent/DpdPickup
0
 public function isModuleDpdPickup(OrderEvent $event)
 {
     $address = AddressIcirelaisQuery::create()->findPk($event->getDeliveryAddress());
     if ($this->check_module($event->getDeliveryModule())) {
         //tmp solution
         $request = $this->getRequest();
         $pr_code = $request->request->get('pr_code');
         if (!empty($pr_code)) {
             // Get details w/ SOAP
             $con = new \SoapClient(__DIR__ . "/../Config/exapaq.wsdl", array('soap_version' => SOAP_1_2));
             $response = $con->GetPudoDetails(array("pudo_id" => $pr_code));
             $xml = new \SimpleXMLElement($response->GetPudoDetailsResult->any);
             if (isset($xml->ERROR)) {
                 throw new \ErrorException("Error while choosing pick-up & go store: " . $xml->ERROR);
             }
             $customer_name = AddressQuery::create()->findPk($event->getDeliveryAddress());
             $request->getSession()->set('DpdPickupDeliveryId', $event->getDeliveryAddress());
             if ($address === null) {
                 $address = new AddressIcirelais();
                 $address->setId($event->getDeliveryAddress());
             }
             // France Métropolitaine
             $address->setCode($pr_code)->setCompany((string) $xml->PUDO_ITEMS->PUDO_ITEM->NAME)->setAddress1((string) $xml->PUDO_ITEMS->PUDO_ITEM->ADDRESS1)->setAddress2((string) $xml->PUDO_ITEMS->PUDO_ITEM->ADDRESS2)->setAddress3((string) $xml->PUDO_ITEMS->PUDO_ITEM->ADDRESS3)->setZipcode((string) $xml->PUDO_ITEMS->PUDO_ITEM->ZIPCODE)->setCity((string) $xml->PUDO_ITEMS->PUDO_ITEM->CITY)->setFirstname($customer_name->getFirstname())->setLastname($customer_name->getLastname())->setTitleId($customer_name->getTitleId())->setCountryId($customer_name->getCountryId())->save();
         } else {
             throw new \ErrorException("No pick-up & go store chosen for DpdPickup delivery module");
         }
     } elseif (null !== $address) {
         $address->delete();
     }
 }
Example #29
Show file File: NewsletterController.php Project: woehrlag/new.woehrl.de
0
 /**
  * action unsubscribe
  * @param \WOEHRL\WoehrlNewsletterabmelden\Domain\Model\Newsletter $Newsletter
  * @return void
  */
 public function unsubscribeAction(\WOEHRL\WoehrlNewsletterabmelden\Domain\Model\Newsletter $Newsletter = NULL)
 {
     //$extbaseFrameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
     // \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( $Newsletter, 'result');
     if ($Newsletter) {
         $wsdl = 'https://websvc-custdata.woehrl.de/newsletter_mssql.wsdl';
         $client = new \SoapClient($wsdl, array("trace" => 0, 'exceptions' => 0));
         $resalt = $client->nlUnsubscribe($Newsletter->getEmail());
         switch ($resalt) {
             case 2:
                 /* $daten = array(
                        'frequenz_zu_hoch' => $this->piVars['frequenz_zu_hoch'],
                        'inhalte_zu_wenig' => $this->piVars['inhalte_zu_wenig'],
                        'inhalte_nicht_interessant' => $this->piVars['inhalte_nicht_interessant'],
                        'abmeldung_voruebergehend' => $this->piVars['abmeldung_voruebergehend'],
                        'abmeldung_freifeld' => trim(htmlspecialchars($this->piVars['abmeldung_freifeld'])),
                        'email' => $email
                    );
                    $this->mailsenden($email);
                    $this->CreateAbmeldungUmfrage($daten);
                    */
                 $Newsletter->setMeldung('2');
                 $this->sendMail($Newsletter->getEmail());
                 break;
             case -1:
                 $this->addFlashMessage($messageBody = "<div class='alert alert-danger' role='alert'>\n                        Die E-Mailadresse <b>" . $Newsletter->getEmail() . "</b> ist in unserer Datenbank nicht vorhanden!</div>", $messageTitle = "", $severity = \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR, $storeInSession = FALSE);
                 break;
             default:
                 if ($Newsletter->setMeldung('default')) {
                     $this->sendMail($Newsletter->getEmail());
                 }
         }
     }
     $this->view->assign('Newsletter', $Newsletter);
 }
Example #30
Show file File: EmsClient.php Project: owenliang/webservice
0
 /**
  * 获取客户端, 会设置一些header
  * @param unknown $clazz
  * @param unknown $method
  * @param unknown $beanId
  * @return SoapClient
  */
 private function getSoapClient($clazz, $method, $beanId, $userId = '')
 {
     $soapClient = new SoapClient(null, array('uri' => SOAP_URI, 'location' => SOAP_LOCATION, 'soap_version' => SOAP_1_2, 'style' => SOAP_RPC, 'trace' => true));
     $header = new SoapHeader(SOAP_NAMESPACE, 'field', (object) array(new SoapVar($beanId, XSD_STRING, null, null, 'beanId', SOAP_NAMESPACE), new SoapVar($clazz, XSD_STRING, null, null, 'clazz', SOAP_NAMESPACE), new SoapVar($method, XSD_STRING, null, null, 'methodName', SOAP_NAMESPACE), new SoapVar($userId, XSD_STRING, null, null, 'userId', SOAP_NAMESPACE), new SoapVar('testing', XSD_STRING, null, null, 'token', SOAP_NAMESPACE)));
     $soapClient->__setSoapHeaders($header);
     return $soapClient;
 }
Frequently Used Methods