Example #1
0
 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);
 }
 /**
  * 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);
 }
 function __construct($wsdl, $options = array())
 {
     $this->login = $options['login'];
     $this->password = $options['password'];
     $this->connection_timeout = $options['connection_timeout'];
     parent::__construct($wsdl, $options);
 }
 /**
  * @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;
 }
Example #5
0
 /**
  * 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();
 }
 /**
  * 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;
     }
 }
Example #7
0
 /**
  * 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();
 }
Example #8
0
 /**
  * @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));
 }
 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);
 }
Example #10
0
 /**
  * {@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);
 }
Example #11
0
 /**
  * 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);
 }
 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));
 }
Example #13
0
 /**
  *  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();
 }
Example #14
0
 public function __construct($options = array())
 {
     if (!isset($options['exceptions'])) {
         $options['exceptions'] = false;
     }
     parent::__construct(static::$DELL_ADDR, $options);
 }
 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));
 }
 public function __construct($connProviderWsdlUri, $nsaProvider, $nsaRequester, $callBackServerUri = null, LocalCertificate $certificate = null)
 {
     if ($nsaProvider == null || $nsaRequester == null) {
         throw new \Exception('NSA provider and NSA requester must be informed');
     }
     $this->nsaProvider = $nsaProvider;
     $this->nsaRequester = $nsaRequester;
     if ($certificate != null && !$certificate instanceof LocalCertificate) {
         throw new \Exception('Certificate must be informed like a LocalCertificate object');
     }
     $this->localCert = $certificate;
     $this->connProviderWsdlUri = $connProviderWsdlUri;
     $this->callbackServerUri = $callBackServerUri;
     $isSsl = $this->localCert == null ? false : true;
     $streamContextOptions = ['ssl' => ['verify_peer' => $isSsl, 'allow_self_signed' => true], 'https' => ['curl_verify_ssl_peer' => $isSsl, 'curl_verify_ssl_host' => $isSsl]];
     if (!$isSsl) {
         $streamContextOptions['ssl']['ciphers'] = 'SHA1';
     }
     $context = stream_context_create($streamContextOptions);
     $soapOptions = ['cache_wsdl' => WSDL_CACHE_NONE, 'stream_context' => $context, 'trace' => 1];
     if ($isSsl) {
         $soapOptions['local_cert'] = $this->localCert->getCertPath();
         $soapOptions['passphrase'] = $this->localCert->getCertPassphrase();
     }
     parent::__construct($this->connProviderWsdlUri, $soapOptions);
 }
Example #17
0
 /**
  * Constructor.
  *
  * @param string                   $wsdl       URI of the WSDL file
  * @param EventDispatcherInterface $dispatcher The event dispatcher
  * @param User                     $user       The profile
  * @param array                    $options    The options
  */
 public function __construct($wsdl, EventDispatcherInterface $dispatcher, User $user, array $options = array())
 {
     $defaults = array('soap_version' => SOAP_1_1, 'encoding' => 'UTF-8', 'trace' => true, 'exception' => true, 'cache_wsdl' => WSDL_CACHE_BOTH, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS);
     parent::__construct($wsdl, $options + $user->getSoapOptions() + $defaults);
     $this->dispatcher = $dispatcher;
     $this->user = $user;
 }
Example #18
0
 /**
  * @inheritdoc
  */
 public function __construct($wsdl, $location, array $options = null)
 {
     $this->setLocation($location);
     $this->context = $this->createContext();
     $options['stream_context'] = $this->context;
     parent::__construct($wsdl, $options);
 }
 /**
  * Constructor initializing the client with given soap options.
  *
  * @param array $options An array of soap options
  */
 public function __construct($options = array())
 {
     $wsdl = sfConfig::get('app_ck_web_service_plugin_wsdl');
     $this->browser = new sfBrowser();
     $this->namespace = $this->getNamespaceFromWsdl($wsdl);
     parent::__construct($wsdl, $this->getOptions($options));
 }
Example #20
0
 function __construct($wsdl, array $options, array $curlOptions, Logger $logger, $headers = [])
 {
     $this->logger = $logger;
     $this->curlOptions = $curlOptions;
     $this->headers = $headers;
     $this->logger->debug($wsdl, array('options' => $options, 'curl Options' => $curlOptions));
     parent::__construct($wsdl, $options);
 }
Example #21
0
 function __construct($service, $options)
 {
     $url = variable_get('cbisimport_api_url', '');
     $this->service = $service;
     $this->apiKey = variable_get('cbisimport_api_key', '');
     $wsdl = sprintf('%s/%s.asmx?WSDL', $url, $service);
     parent::__construct($wsdl, $options);
 }
Example #22
0
 /**
  * 
  * @param string $service
  * @param string $key
  * @param string $cert
  * @param boolean $trace
  */
 public function __construct($service, $key, $cert, $trace = FALSE)
 {
     $this->connectionStartTime = microtime(TRUE);
     parent::__construct($service, ['exceptions' => TRUE, 'trace' => $trace]);
     $this->key = $key;
     $this->cert = $cert;
     $this->traceRequired = $trace;
 }
Example #23
0
 function __construct($a, $b)
 {
     if (!isset($b['stream_context'])) {
         $b['stream_context'] = stream_context_create(array('ssl' => array('verify_peer' => false, 'allow_self_signed' => true)));
     }
     parent::__construct($a, $b);
     return $this;
 }
Example #24
0
 /**
  * Construct a new SoapClient
  *
  * @param string $wsdl Location of WSDL file
  * @param array $options initialisation options
  * @param Log\LoggerInterface|null $logger Error logging object
  */
 public function __construct($wsdl, $options, Log\LoggerInterface $logger = null)
 {
     if (!$logger instanceof Log\LoggerInterface) {
         $logger = new Log\NullLogger();
     }
     $this->setLogger($logger);
     parent::__construct($wsdl, $options);
 }
 function __construct($wsdl = NULL, $config = [])
 {
     $this->config = $config;
     parent::__construct($wsdl, array_merge(['trace' => 1], @$config['soap_client_options'] ?: []));
     if (isset($config['username'])) {
         $this->addWSSecurityHeader($config);
     }
 }
Example #26
0
 /**
  * @param string $wsdl
  * @param array $options
  */
 public function __construct($wsdl, $options)
 {
     $url = parse_url($wsdl);
     if ($url['port']) {
         $this->_port = $url['port'];
     }
     return parent::__construct($wsdl, $options);
 }
 /**
  * 
  * @param array $options A array of config values
  * @param string $wsdl The wsdl file to use
  * @access public
  */
 public function __construct(array $options = array(), $wsdl = 'AdvStepGeocoder.wsdl')
 {
     foreach (self::$classmap as $key => $value) {
         if (!isset($options['classmap'][$key])) {
             $options['classmap'][$key] = $value;
         }
     }
     parent::__construct($wsdl, $options);
 }
Example #28
0
 /**
  * 
  * @param array $options A array of config values
  * @param string $wsdl The wsdl file to use
  * @access public
  */
 public function __construct(array $options = array(), $wsdl = 'wsdl/ReportService2005.wsdl')
 {
     foreach (self::$classmap as $key => $value) {
         if (!isset($options['classmap'][$key])) {
             $options['classmap'][$key] = $value;
         }
     }
     parent::__construct($wsdl, $options);
 }
Example #29
0
 /**
  * @param array $options A array of config values
  * @param string $wsdl The wsdl file to use
  * @access public
  */
 public function __construct(array $options = array())
 {
     foreach (self::$classmap as $key => $value) {
         if (!isset($options['classmap'][$key])) {
             $options['classmap'][$key] = $value;
         }
     }
     parent::__construct(self::$local_wsdl, $options);
 }
Example #30
0
 /**
  * @param array $options A array of config values
  * @param string $wsdl The wsdl file to use
  * @access public
  */
 public function __construct(array $options = array(), $wsdl = 'http://soadev.dephub.go.id:7800/SimponiBRI_Service?wsdl')
 {
     foreach (self::$classmap as $key => $value) {
         if (!isset($options['classmap'][$key])) {
             $options['classmap'][$key] = $value;
         }
     }
     parent::__construct($wsdl, $options);
 }