本文整理汇总了PHP中SoapClient::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP SoapClient::__construct方法的具体用法?PHP SoapClient::__construct怎么用?PHP SoapClient::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoapClient
的用法示例。
在下文中一共展示了SoapClient::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($wdsl, $options)
{
$this->login = $options['login'];
$this->password = $options['password'];
if (isset($options['wdsl_local_copy']) && $options['wdsl_local_copy'] && isset($options['cache_dir']) && isset($options['cache_url']) && isset($options['login']) && isset($options['password'])) {
$this->cache_dir = $options['cache_dir'] . '/\\/';
$this->cache_url = $options['cache_url'];
unset($options['wdsl_local_copy'], $options['cache_dir'], $options['cache_url']);
$file = md5(uniqid()) . '.xml';
if (($fp = fopen($this->cache_dir . $file, "w")) == false) {
throw new \Exception('Could not create local WDSL file (' . $this->cache_dir . $file . ')');
}
$ch = curl_init();
$credit = $options['login'] . ':' . $options['password'];
curl_setopt($ch, CURLOPT_URL, $wdsl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, $credit);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_FILE, $fp);
if (($xml = curl_exec($ch)) === false) {
//curl_close($ch);
fclose($fp);
unlink($this->cache_dir . $file);
throw new Exception(curl_error($ch));
}
curl_close($ch);
fclose($fp);
$wdsl = $this->cache_url . $file;
}
parent::__construct($wdsl, $options);
unlink($this->cache_dir . $file);
}
示例2: urlencode
/**
* Constructor WebSitePhpSoapClient
* @param mixed $wsdl
*/
function __construct($wsdl)
{
$wsdl = urlencode($wsdl);
parent::__construct($wsdl);
$this->session = $this->getSessionId();
$this->__setCookie('WSP_WS_SESSION', $this->session);
}
示例3: array
function __construct($wsdl, $options = array())
{
$this->login = $options['login'];
$this->password = $options['password'];
$this->connection_timeout = $options['connection_timeout'];
parent::__construct($wsdl, $options);
}
示例4: __construct
/**
* @param mixed $wsdl
* @param array $options
* @param \Psr\Log\LoggerInterface $logger
*/
public function __construct($wsdl, $options, LoggerInterface $logger)
{
$defaultOptions = array('soap_version' => SOAP_1_1, 'trace' => true, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, 'classmap' => array('GEN_Response' => 'YellowCube\\GEN_Response', 'Article' => 'YellowCube\\BAR\\Article', 'QuantityUOM' => 'YellowCube\\BAR\\QuantityUOM', 'GoodsIssue' => 'YellowCube\\WAR\\GoodsIssue\\GoodsIssue', 'GoodsIssueHeader' => 'YellowCube\\WAR\\GoodsIssue\\GoodsIssueHeader', 'CustomerOrderHeader' => 'YellowCube\\WAR\\GoodsIssue\\CustomerOrderHeader', 'CustomerOrderDetail' => 'YellowCube\\WAR\\GoodsIssue\\CustomerOrderDetail'));
$this->options = array_merge($defaultOptions, $options);
parent::__construct($wsdl, $this->options);
$this->logger = $logger;
}
示例5: __construct
/**
* Creates and returns a new SoapClient
* with empty inbound and outbound pipelines.
*
* @param string|null $wsdl
* @param array $options
*/
public function __construct($wsdl, array $options = array())
{
parent::__construct($wsdl, $options);
// initialize in and outbound pipelines
$this->inboundPipeline = new Pipeline();
$this->outboundPipeline = new Pipeline();
}
示例6: __construct
/**
* Grab the timeout from the SOAP options
*/
public function __construct($wsdl, $options = array())
{
$exception = null;
$oldTimeout = null;
if (is_array($options)) {
$this->timeoutConnection = $this->getOptionInteger($options, 'connection_timeout');
$this->timeoutSocket = $this->getOptionInteger($options, 'socket_timeout');
$this->timeoutWsdl = $this->getOptionInteger($options, 'wsdl_timeout', $this->timeoutSocket);
$this->closeConnection = $this->getOptionBoolean($options, 'connection_close', false);
$this->sslAllowSelfSigned = $this->getOptionBoolean($options, 'allow_self_signed', false);
$this->sslCaFile = $this->getOptionString($options, 'cafile');
$this->sslCaPath = $this->getOptionString($options, 'capath');
$this->sslLocalCert = $this->getOptionString($options, 'local_cert');
}
if ($this->timeoutWsdl) {
$oldTimeout = ini_set('default_socket_timeout', $this->timeoutWsdl);
}
try {
parent::__construct($wsdl, $options);
} catch (Exception $e) {
$exception = $e;
}
if ($this->timeoutWsdl) {
ini_set('default_socket_timeout', $oldTimeout);
}
if (!is_null($exception)) {
throw $exception;
}
}
示例7: __construct
/**
* GUS Client constructor.
* @param mixed $userKey - GUS API key
* @param array $deathByCaptchaUser - DeathByCaptcha login
* @param $deathByCaptchaPassword - DeathByCaptcha password
* @param string $mode - possible values: TEST, PRODUCTION
* @param bool $debugMode
* @param array $soapOptions http://php.net/manual/en/soapclient.soapclient.php
*/
public function __construct($userKey, $deathByCaptchaUser, $deathByCaptchaPassword, $mode = 'TEST', $soapOptions = array(), $debugMode = false)
{
$this->_userKey = $userKey;
$this->_mode = $mode;
$this->debugMode = $debugMode;
if (!is_array($soapOptions)) {
$soapOptions = array();
}
if (empty($soapOptions['stream_context'])) {
$soapOptions['stream_context'] = stream_context_create();
}
$this->_streamContext = $soapOptions['stream_context'];
$soapOptions['soap_version'] = SOAP_1_2;
$soapOptions['cache_wsdl'] = WSDL_CACHE_NONE;
// $soapOptions['encoding'] = 'UTF-8';
// $soapOptions['verifypeer'] = false;
// $soapOptions['verifyhost'] = false;
// $soapOptions['trace'] = 1;
// $soapOptions['exceptions'] = 1;
$soapOptions['location'] = $this->_getServiceUrl();
parent::__construct($this->_getWsdlUrl(), $soapOptions);
$this->dbcUser = $deathByCaptchaUser;
$this->dbcPass = $deathByCaptchaPassword;
$this->_prepareSession();
}
示例8: __construct
/**
* @param string $wsdl
* @param string $account
* @param string $password
*/
public function __construct($wsdl, $account, $passowrd)
{
$this->_credential = new WildWest_Reseller_Credential();
$this->_credential->Account = $account;
$this->_credential->Password = $passowrd;
parent::__construct($wsdl, array('soap_version' => SOAP_1_2));
}
示例9: __construct
public function __construct($wsdl, $options = array('trace' => true, 'exceptions' => true), $ticket = null)
{
// Store the current ticket
$this->ticket = $ticket;
// Call the base class
parent::__construct($wsdl, $options);
}
示例10: __construct
/**
* {@inheritdoc}
*
* @param null|string $wsdl
* @param array $options
*/
public function __construct($wsdl = null, array $options = array())
{
$wsdl = is_null($wsdl) ? 'https://test.processing.kz/CNPMerchantWebServices/CNPMerchantWebService.wsdl' : $wsdl;
$options = array_merge(array('connection_timeout' => 60, 'cache_wsdl' => WSDL_CACHE_MEMORY, 'trace' => 1, 'soap_version' => SOAP_1_2, 'encoding' => 'UTF-8', 'exceptions' => true, 'location' => 'https://test.processing.kz/CNPMerchantWebServices/services/CNPMerchantWebService'), $options);
$options['classmap'] = $this->getClassMap();
parent::__construct($wsdl, $options);
}
示例11: __construct
/**
* Constructor.
*
* @param string $wsdl WSDL file
* @param array(string=>mixed) $options Options array
*/
public function __construct($wsdl, array $options = array())
{
if (!isset($options['classmap'])) {
$options['classmap'] = $this->getClassMap();
}
return parent::__construct($wsdl, $options);
}
示例12: __construct
public function __construct($apiKey, $wsdl = '', $options = array())
{
if (!$apiKey) {
throw new \Exception('An API Key must be specified');
}
$this->apiKey = $apiKey;
if (!$wsdl) {
$wsdl = 'https://secure.clearbooks.co.uk/api/accounting/wsdl/';
}
if (!is_array($options)) {
$options = array();
}
if (!array_key_exists('trace', $options)) {
$options['trace'] = 1;
}
foreach (self::$classMap as $key => $value) {
if (!isset($options['classmap'][$key])) {
$options['classmap'][$key] = $value;
}
}
parent::__construct($wsdl, $options);
$this->namespace = str_replace('wsdl', 'soap', $wsdl);
$header = new SoapHeader($this->namespace, 'authenticate', array('apiKey' => $this->apiKey));
$this->__setSoapHeaders(array($header));
}
示例13: __construct
/**
* Overridden constructor
* @param string Email address of soap api user
* @param string Password
* @param string Account name (if not provided, the first account will be used)
* @param string URL of the application
* @param string The charset that is used by the user of this class (this class takes care of converting it to utf-8 before it is sent to the api)
*/
public function __construct($email, $password, $account = null, $url = 'http://soap.copernica.com/', $charset = 'iso-8859-1')
{
// Store the data
$this->login = $email;
$this->account = $account;
$this->password = $password;
// store charset
$this->charset = strtolower($charset);
// Check the php version to determine the http to use
if (version_compare(phpversion(), '5.3.0') >= 0) {
$version = 1.1;
} else {
$version = 1.0;
}
// create default http context (required for decoding chunks). Since version 5.3 php supports chunked encoding.
// The http version is set depending on the php version
$context = stream_context_create(array('http' => array('protocol_version' => $version)));
// parameters for the SOAP connection
$params = array('soap_version' => SOAP_1_1, 'trace' => true, 'stream_context' => $context, 'cache_wsdl' => WSDL_CACHE_NONE);
// Add compression if we're use http version 1.1
if ($version == 1.1) {
$params['compression'] = SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP;
}
// url of the wsdl
$this->url = $url . "?SOAPAPI=WSDL";
// create connection
parent::__construct($this->url, $params);
// Handle the session cookie
$this->handleCookie();
}
示例14: __construct
public function __construct($options = array())
{
if (!isset($options['exceptions'])) {
$options['exceptions'] = false;
}
parent::__construct(static::$DELL_ADDR, $options);
}
示例15: array
function __construct($options = array(), $properties, $nvp = false)
{
$required = array('merchant_id', 'transaction_key');
if (!$properties) {
throw new Exception('Unable to read cybs.ini.');
}
if ($nvp === true) {
array_push($required, 'nvp_wsdl');
$wsdl = $properties['nvp_wsdl'];
} else {
array_push($required, 'wsdl');
$wsdl = $properties['wsdl'];
}
foreach ($required as $req) {
if (empty($properties[$req])) {
throw new Exception($req . ' not found in cybs.ini.');
}
}
parent::__construct($wsdl, $options);
$this->merchantId = $properties['merchant_id'];
$this->transactionKey = $properties['transaction_key'];
$nameSpace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
$soapUsername = new SoapVar($this->merchantId, XSD_STRING, NULL, $nameSpace, NULL, $nameSpace);
$soapPassword = new SoapVar($this->transactionKey, XSD_STRING, NULL, $nameSpace, NULL, $nameSpace);
$auth = new stdClass();
$auth->Username = $soapUsername;
$auth->Password = $soapPassword;
$soapAuth = new SoapVar($auth, SOAP_ENC_OBJECT, NULL, $nameSpace, 'UsernameToken', $nameSpace);
$token = new stdClass();
$token->UsernameToken = $soapAuth;
$soapToken = new SoapVar($token, SOAP_ENC_OBJECT, NULL, $nameSpace, 'UsernameToken', $nameSpace);
$security = new SoapVar($soapToken, SOAP_ENC_OBJECT, NULL, $nameSpace, 'Security', $nameSpace);
$header = new SoapHeader($nameSpace, 'Security', $security, true);
$this->__setSoapHeaders(array($header));
}