本文整理汇总了PHP中SoapClient::__setSoapHeaders方法的典型用法代码示例。如果您正苦于以下问题:PHP SoapClient::__setSoapHeaders方法的具体用法?PHP SoapClient::__setSoapHeaders怎么用?PHP SoapClient::__setSoapHeaders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoapClient
的用法示例。
在下文中一共展示了SoapClient::__setSoapHeaders方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _setWSSEHeaders
private function _setWSSEHeaders()
{
$user = new \SoapVar($this->_config->merchantID, XSD_STRING, null, $this->_config->wsseNS, null, $this->_config->wsseNS);
$pass = new \SoapVar($this->_config->apiKey, XSD_STRING, null, $this->_config->typeNS, null, $this->_config->wsseNS);
$username_token = new \stdClass();
$username_token->Username = $user;
$username_token->Password = $pass;
$username_token = new \SoapVar($username_token, SOAP_ENC_OBJECT, null, $this->_config->wsseNS, 'UsernameToken', $this->_config->wsseNS);
$security = new \stdClass();
$security->UsernameToken = $username_token;
$security = new \SoapVar($security, SOAP_ENC_OBJECT, null, $this->_config->wsseNS, 'Security', $this->_config->wsseNS);
$header = new \SoapHeader($this->_config->wsseNS, 'Security', $security, true);
$this->_soapClient->__setSoapHeaders($header);
}
示例2: getSoapClient
/**
* 获取客户端, 会设置一些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;
}
示例3: 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;
}
示例4: 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);
}
示例5: getSoapClient
private function getSoapClient()
{
ini_set('max_execution_time', 3600);
date_default_timezone_set("CET");
$settings = SoapSetting::getDefaultSetting($this->ID);
$this->ID = $settings->ID;
if ($version) {
$settings->version = $version;
}
$soapClient = new \SoapClient($settings->connection_uri . "version" . $settings->version . "/?xml", array('trace' => 1));
$soapHeader = $settings->soap_header;
$lastToken = $settings->last_token;
if (!$soapHeader || date("z", $lastToken) != date("z", time())) {
$authentification = $soapClient->GetAuthentificationToken(array('Username' => $settings->username, 'Userpass' => $settings->password));
if (isset($authentification->Token)) {
$headerbody = new \stdClass();
$headerbody->UserID = $authentification->UserID;
$headerbody->Token = $authentification->Token;
$headerbody->Username = $settings->username;
$serializedHeader = serialize($headerbody);
$settings->soap_header = $serializedHeader;
$settings->last_token = time();
$settings->save();
}
}
$soapHeader = $settings->soap_header;
$headerbody = unserialize($soapHeader);
$header = new \SOAPHeader('Authentification', 'verifyingToken', $headerbody, false);
$this->instance = $soapClient->__setSoapHeaders($header);
}
示例6: soapClient
public function soapClient($method, $callParams, $scOptions = array())
{
$wsdl = $this->_getWsdl($method);
$result = null;
if (!isset($scOptions['soap_version'])) {
$scOptions['soap_version'] = SOAP_1_2;
}
if (!isset($scOptions['trace'])) {
$scOptions['trace'] = 1;
}
if (!isset($scOptions['exceptions'])) {
$scOptions['exceptions'] = 0;
}
try {
$soapClient = new SoapClient($wsdl, $scOptions);
if ($actionHeader = $this->_getSoapHeader($method)) {
$soapClient->__setSoapHeaders($actionHeader);
}
$result = $this->_soapClientCall($method, $soapClient, $callParams);
if ($result instanceof SoapFault) {
$this->log($result->faultstring);
$result = '[soapfault]';
}
} catch (SoapFault $sf) {
$this->log($sf->faultstring);
$result = '[soapfault]';
}
return $result;
}
示例7: getClient
/**
* Get the SOAP client
* @return \SoapClient
*/
private function getClient()
{
if (!isset($this->client)) {
$this->client = new \SoapClient($this->wsdl['rates'], ['trace' => 1]);
$this->client->__setSoapHeaders($this->requestHeader);
}
return $this->client;
}
示例8: __construct
/**
* @param Zend_Config $xml
*/
public function __construct(Zend_Config $xml)
{
// init
$this->environment = $xml->mode == 'sandbox' ? 'sandbox' : '';
$credentials = $xml->config->{$xml->mode};
// create paypal interface
$wsdl = sprintf('https://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl', $this->environment);
$location = sprintf('https://api-3t.sandbox.paypal.com/2.0', $this->environment);
$this->client = new SoapClient($wsdl, array('location' => $location));
// auth
$auth = new stdClass();
$auth->Credentials = new stdClass();
$auth->Credentials->Username = $credentials->api_username;
$auth->Credentials->Password = $credentials->api_password;
$auth->Credentials->Signature = $credentials->api_signature;
$header = new SoapHeader('urn:ebay:api:PayPalAPI', 'RequesterCredentials', $auth);
$this->client->__setSoapHeaders($header);
}
示例9: getClient
public function getClient()
{
$params = Yii::app()->params['dorogiMos'];
$username = $params['login'];
$password = $params['password'];
$wsse_header = new WsseAuthHeader($username, $password);
$client = new SoapClient($params['server']);
$client->__setSoapHeaders(array($wsse_header));
return $client;
}
示例10: cvm_get_client
function cvm_get_client()
{
global $cvm;
$client = new SoapClient($cvm['wsdl'], array("trace" => true, "exceptions" => true, "cache_wsdl" => false));
if (isset($cvm['token'])) {
$header = new SoapHeader($cvm['ns'], 'sessaoIdHeader', $cvm['token']);
$client->__setSoapHeaders($header);
}
return $client;
}
示例11: _temandoConnect
private function _temandoConnect($connect_url, $username, $password)
{
ini_set("soap.wsdl_cache_enabled", "1");
$wsse_url = 'wsse:http://schemas.xmlsoap.org/ws/2002/04/secext';
$soap_client = new \SoapClient($connect_url, array('soap_version' => SOAP_1_2));
$headerSecurityStr = '<Security><UsernameToken><Username>' . $username . '</Username><Password>' . $password . '</Password></UsernameToken></Security>';
$headerSecurityVar = new \SoapVar($headerSecurityStr, XSD_ANYXML);
$soapHeader = new \SoapHeader($wsse_url, 'soapenv:Header', $headerSecurityVar);
$soap_client->__setSoapHeaders(array($soapHeader));
return $soap_client;
}
示例12: initializeClient
/**
* @throws Exception\ConnectionException
*/
protected function initializeClient()
{
try {
$this->client = $this->factory->create($this->url, $this->options);
if ($this->headers) {
$this->client->__setSoapHeaders($this->headers);
}
} catch (\SoapFault $soapFault) {
throw new ConnectionException('Client failed to connect', 0, $soapFault);
}
}
示例13: register
public function register(Application $app)
{
$app['database_connection'] = $app->share(function ($app) {
$config = new Configuration();
$connectionParams = ['dbname' => 'app', 'user' => 'some_user', 'password' => 'some_password', 'host' => 'some_host', 'charset' => 'utf8'];
return DriverManager::getConnection($connectionParams, $config);
});
$app['entity_manager'] = $app->share(function ($app) {
return EntityManager::create($app['database_connection'], Setup::createAnnotationMetadataConfiguration([__DIR__ . '/Entity/']));
});
$app['billing_service_client'] = $app->share(function ($app) {
$soapClient = new \SoapClient(__DIR__ . "/../../config/billing-service.wsdl", ['features' => SOAP_SINGLE_ELEMENT_ARRAYS, 'classmap' => $app['soap_classmap']]);
$soapClient->__setLocation('http://192.168.99.100:81/api/64.0');
$result = $soapClient->login(['username' => 'zuora-api-client@jimdo.com', 'password' => 'vA71jAPgJFG83a7v']);
$sessionKey = $result->result->Session;
$sessionHeader = new SoapHeader('http://api.zuora.com/', 'SessionHeader', ['session' => $sessionKey]);
$soapClient->__setSoapHeaders($sessionHeader);
return $soapClient;
});
$app['zuora_client'] = $app->share(function ($app) {
$soapClient = new \SoapClient(__DIR__ . "/../../config/billing-service.wsdl", ['features' => SOAP_SINGLE_ELEMENT_ARRAYS, 'classmap' => $app['soap_classmap']]);
$soapClient->__setLocation('https://apisandbox.zuora.com/apps/services/a/64.0');
$result = $soapClient->login(['username' => 'zuora-api-client@jimdo.com', 'password' => 'vA71jAPgJFG83a7v']);
$sessionKey = $result->result->Session;
$sessionHeader = new SoapHeader('http://api.zuora.com/', 'SessionHeader', ['session' => $sessionKey]);
$soapClient->__setSoapHeaders($sessionHeader);
return $soapClient;
});
$app['zuora_production_client'] = $app->share(function ($app) {
$soapClient = new \SoapClient(__DIR__ . "/../../config/billing-service-read-only.wsdl", ['features' => SOAP_SINGLE_ELEMENT_ARRAYS, 'classmap' => $app['soap_classmap']]);
$soapClient->__setLocation('https://www.zuora.com/apps/services/a/64.0');
$result = $soapClient->login(['username' => 'zuora-api-client@jimdo.com', 'password' => 'rFBDQfJvPsDoN5r7']);
$sessionKey = $result->result->Session;
$sessionHeader = new SoapHeader('http://api.zuora.com/', 'SessionHeader', ['session' => $sessionKey]);
$soapClient->__setSoapHeaders($sessionHeader);
return $soapClient;
});
$app['account_finder'] = $app->share(function ($app) {
return new AccountFinder($app['zuora_client'], $app['entity_manager']);
});
$app['replay'] = $app->share(function ($app) {
return new Replay($app['entity_manager']->getRepository('\\Jimdo\\Payment\\Billing\\ReplayAndCompare\\Entity\\Log'), $app['zuora_client'], new IdFinder(new ZObjectRepository($app['zuora_production_client']), new ZObjectRepository($app['zuora_client'])));
});
$app['compare'] = $app->share(function ($app) {
return new Compare(new ObjectTree($app['zuora_production_client']), new ObjectTree($app['zuora_client']), new Differ(new Comparator([])));
});
$app['some_account'] = $app->share(function ($app) {
return new SomeAccount($app['database_connection']);
});
$app['product_catalog'] = $app->share(function ($app) {
return new ProductCatalog($app['zuora_client']);
});
$app->register(new MonologServiceProvider(), ['monolog.logfile' => 'php://stderr']);
}
示例14: getSoapClient
/**
* Creates a SOAP client and initializes the headers etc
*
* @return \SoapClient|SoapClient
*/
protected function getSoapClient()
{
if ($this->soap === null) {
// Refactor to somewhere
$options = array('trace' => 1, 'exceptions' => true, 'cache_wsdl' => WSDL_CACHE_NONE, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS);
$this->soap = new \SoapClient($this->provider->getBaseURL() . '/' . $this->service->getServiceURI(), $options);
if ($this->needsAuthentication) {
$this->soap->__setSoapHeaders(array($this->provider->getAuthentication()->getHeader()));
}
}
return $this->soap;
}
示例15: array
/**
* Constructor
*/
function __construct($storeId = NULL)
{
$this->setStoreId($storeId);
$this->_config = $config = Mage::getModel('mailup/config');
/* @var $config MailUp_MailUpSync_Model_Config */
$urlConsole = Mage::getStoreConfig('mailup_newsletter/mailup/url_console', $this->storeId);
$WSDLUrl = 'http://' . $urlConsole . '/services/WSMailUpImport.asmx?WSDL';
$user = Mage::getStoreConfig('mailup_newsletter/mailup/username_ws', $this->storeId);
$password = Mage::getStoreConfig('mailup_newsletter/mailup/password_ws', $this->storeId);
$headers = array('User' => $user, 'Password' => $password);
$this->header = new SOAPHeader($this->ns, 'Authentication', $headers);
if ($this->_config()->isLogEnabled($this->storeId)) {
Mage::log("Connecting to {$urlConsole} as {$user}");
}
try {
$this->soapClient = new SoapClient($WSDLUrl, array('trace' => 1, 'exceptions' => 1, 'connection_timeout' => 10));
$this->soapClient->__setSoapHeaders($this->header);
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError(Mage::helper("mailup")->__("Unable to connect to MailUp console"));
}
}