本文整理汇总了PHP中SoapClient类的典型用法代码示例。如果您正苦于以下问题:PHP SoapClient类的具体用法?PHP SoapClient怎么用?PHP SoapClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SoapClient类的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: findReservation
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);
}
示例3: create_iDeal_box
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;
}
示例4: check_vat
/**
* 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;
}
示例5: registerUser
/**
* 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);
}
}
示例6: track
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);
}
}
示例7: createRatesClient
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;
}
示例8: send
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;
}
示例9: creaFormularioProductos
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>";
}
}
}
}
示例10: detail
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(" ", "", strip_tags($data['InfoContent']));
$arr['click_times'] = $data['ClickTimes'];
//点击次数
//hg_pre($arr);exit();
return $arr;
}
示例11: back_from_bank
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;
}
示例12: ValidateWithWebServiceSAT
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;
}
}
示例13: fetchData
/**
* 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);
}
示例14: valida_cfdi
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;
}
示例15: GetRegZavod
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();
}
}