本文整理汇总了PHP中SoapClient::__setLocation方法的典型用法代码示例。如果您正苦于以下问题:PHP SoapClient::__setLocation方法的具体用法?PHP SoapClient::__setLocation怎么用?PHP SoapClient::__setLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoapClient
的用法示例。
在下文中一共展示了SoapClient::__setLocation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
示例2: getSoapClientByFunction
public static function getSoapClientByFunction($functionName)
{
error_log('LOOK starting getSoapClientByFunction for function=[' . $functionName . ']');
$uri = NULL;
if ($functionName === "ddrLister") {
$uri = QUERYSERVICE_URL;
} elseif ($functionName === "ddrGetsEntry") {
$uri = QUERYSERVICE_URL;
} elseif ($functionName === "getVariableValue") {
$uri = QUERYSERVICE_URL;
} else {
$uri = EMRSERVICE_URL;
}
error_log('LOOK finishing getSoapClientByFunction for function=[' . $functionName . ']>>>uri=[' . $uri . ']');
$oTheClient = null;
// new \SoapClient($uri, array("trace" => 1, "exceptions" => 0));
if ($uri == EMRSERVICE_URL) {
$oTheClient = new \SoapClient(EMRSERVICE_LOCAL_FILE, array("trace" => 1, "exceptions" => 0));
$oTheClient->__setLocation(EMRSERVICE_URL);
} else {
if ($uri == QUERYSERVICE_URL) {
$oTheClient = new \SoapClient(QUERYSERVICE_LOCAL_FILE, array("trace" => 1, "exceptions" => 0));
$oTheClient->__setLocation(QUERYSERVICE_URL);
}
}
//error_log('LOOK result of getSoapClientByFunction for function=['.$functionName.']>>>uri=['.$uri.']');
return $oTheClient;
}
示例3: getRate
public function getRate($PostalCode, $dest_zip, $dest_country_code, $service, $weight, $length = 0, $width = 0, $height = 0)
{
$setting = new Cart66Setting();
$home_country = explode('~', Cart66Setting::getValue('home_country'));
$countryCode = array_shift($home_country);
$pickupCode = Cart66Setting::getValue('fedex_pickup_code') ? Cart66Setting::getValue('fedex_pickup_code') : "REGULAR_PICKUP";
$residential = Cart66Setting::getValue('fedex_only_ship_commercial') ? "0" : "1";
$locationType = Cart66Setting::getValue('fedex_location_type') == 'commercial' ? "0" : "1";
if ($this->credentials != 1) {
print 'Please set your credentials with the setCredentials function';
die;
}
$path_to_wsdl = CART66_PATH . "/pro/models/RateService_v14.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->developerKey, 'Password' => $this->password));
$request['ClientDetail'] = array('AccountNumber' => $this->accountNumber, 'MeterNumber' => $this->meterNumber);
$request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Available Services Request v14 using PHP ***');
$request['Version'] = array('ServiceId' => 'crs', 'Major' => '14', 'Intermediate' => '0', 'Minor' => '0');
$request['ReturnTransitAndCommit'] = true;
$request['RequestedShipment']['DropoffType'] = $pickupCode;
// valid values REGULAR_PICKUP, REQUEST_COURIER, ...
$request['RequestedShipment']['ShipTimestamp'] = date('c');
// Service Type and Packaging Type are not passed in the request
$request['RequestedShipment']['Shipper'] = array('Address' => array('PostalCode' => $this->fromZip, 'CountryCode' => $countryCode, 'Residential' => $locationType));
$request['RequestedShipment']['Recipient'] = array('Address' => array('PostalCode' => $dest_zip, 'CountryCode' => $dest_country_code, 'Residential' => $residential));
$request['RequestedShipment']['ShippingChargesPayment'] = array('PaymentType' => 'SENDER', 'Payor' => array('ResponsibleParty' => array('AccountNumber' => $this->accountNumber, 'Contact' => null, 'Address' => array('CountryCode' => $countryCode))));
$request['RequestedShipment']['RateRequestTypes'] = 'ACCOUNT';
$request['RequestedShipment']['RateRequestTypes'] = 'LIST';
$request['RequestedShipment']['PackageCount'] = $this->getPackageCount();
$request['RequestedShipment']['RequestedPackageLineItems'] = $this->getRequestedPackageLineItems($weight);
try {
$client->__setLocation('https://gateway.fedex.com:443/web-services');
$response = $client->getRates($request);
if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR') {
$rate = array();
if (is_array($response->RateReplyDetails)) {
foreach ($response->RateReplyDetails as $rateReply) {
$serviceType = $rateReply->ServiceType;
$amount = $rateReply->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount;
$rate[] = array('name' => $serviceType, 'rate' => $amount);
}
} else {
$serviceType = $response->RateReplyDetails->ServiceType;
$amount = $response->RateReplyDetails->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount;
$rate[] = array('name' => $serviceType, 'rate' => $amount);
}
} else {
$rate = false;
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Error: " . print_r($response->Notifications, true));
}
} catch (SoapFault $exception) {
$this->printFault($exception, $client);
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] FedEx Error|| Code: " . $exception->faultcode . " Message: " . $exception->faultstring);
Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Client Details: " . print_r($client, true));
$rate = false;
}
return $rate;
}
示例4: array
function __construct($getWSDL = false, $debug = false, $params = null)
{
$tenantTokens = array();
$config = @(include 'config.php');
if ($config) {
$this->wsdlLoc = $config['defaultwsdl'];
$this->clientId = $config['clientid'];
$this->clientSecret = $config['clientsecret'];
$this->appsignature = $config['appsignature'];
} else {
if ($params && array_key_exists('defaultwsdl', $params)) {
$this->wsdlLoc = $params['defaultwsdl'];
} else {
$this->wsdlLoc = "https://webservice.exacttarget.com/etframework.wsdl";
}
if ($params && array_key_exists('clientid', $params)) {
$this->clientId = $params['clientid'];
}
if ($params && array_key_exists('clientsecret', $params)) {
$this->clientSecret = $params['clientsecret'];
}
if ($params && array_key_exists('appsignature', $params)) {
$this->appsignature = $params['appsignature'];
}
}
$this->debugSOAP = $debug;
if (!property_exists($this, 'clientId') || is_null($this->clientId) || !property_exists($this, 'clientSecret') || is_null($this->clientSecret)) {
throw new Exception('clientid or clientsecret is null: Must be provided in config file or passed when instantiating ET_Client');
}
if ($getWSDL) {
$this->CreateWSDL($this->wsdlLoc);
}
if ($params && array_key_exists('jwt', $params)) {
if (!property_exists($this, 'appsignature') || is_null($this->appsignature)) {
throw new Exception('Unable to utilize JWT for SSO without appsignature: Must be provided in config file or passed when instantiating ET_Client');
}
$decodedJWT = JWT::decode($params['jwt'], $this->appsignature);
$dv = new DateInterval('PT' . $decodedJWT->request->user->expiresIn . 'S');
$newexpTime = new DateTime();
$this->setAuthToken($this->tenantKey, $decodedJWT->request->user->oauthToken, $newexpTime->add($dv));
$this->setInternalAuthToken($this->tenantKey, $decodedJWT->request->user->internalOauthToken);
$this->setRefreshToken($this->tenantKey, $decodedJWT->request->user->refreshToken);
$this->packageName = $decodedJWT->request->application->package;
}
$this->refreshToken();
try {
$url = "https://www.exacttargetapis.com/platform/v1/endpoints/soap?access_token=" . $this->getAuthToken($this->tenantKey);
$endpointResponse = restGet($url);
$endpointObject = json_decode($endpointResponse->body);
if ($endpointResponse && property_exists($endpointObject, "url")) {
$this->endpoint = $endpointObject->url;
} else {
throw new Exception('Unable to determine stack using /platform/v1/endpoints/:' . $endpointResponse->body);
}
} catch (Exception $e) {
throw new Exception('Unable to determine stack using /platform/v1/endpoints/: ' . $e->getMessage());
}
parent::__construct($this->LocalWsdlPath(), array('trace' => 1, 'exceptions' => 0));
parent::__setLocation($this->endpoint);
}
示例5: testSoap
public function testSoap()
{
$request = new YardiPingRequest();
$request->setURL('https://www.iyardiasp.com/9925seniorhousing/WebServices/GuestCardSenior.asmx?wsdl')->setUsername('yardiuser')->setPassword('yardi123')->setServer('aspdb02')->setDatabase('adwgyos_conv');
$client = new \SoapClient($request->getURL(), array('trace' => 1));
$client->__setLocation($request->getURL());
$params = $request->build();
$response = $client->__soapCall($request->getFunction(), array('parameters' => $params), array('soapAction' => 'YSI.Portal.SeniorHousing.WebServices/' . $request->getFunction()));
$r = new YardiPingResponse($response);
$this->assertNotEmpty($r->resultStatus);
}
示例6: 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']);
}
示例7: getSOAPClient
/**
*
* @ WHMCS FULL DECODED & NULLED
*
* @ Version : 5.2.15
* @ Author : MTIMER
* @ Release on : 2013-12-24
* @ Website : http://www.mtimer.cn
*
* */
function getSOAPClient($username, $password, $proxyHost, $proxyPort)
{
$location = "https://theconsole.netregistry.com.au/external/services/ResellerAPIService/";
$WSDL = $location . "?wsdl";
if (isset($proxyHost) && isset($proxyPort) && $proxyHost != "" && $proxyPort != "") {
$client = new SoapClient($WSDL, array("login" => $username, "password" => $password, "proxy_host" => $proxyHost, "proxy_port" => $proxyPort));
} else {
$client = new SoapClient($WSDL, array("login" => $username, "password" => $password));
}
$client->__setLocation($location);
return $client;
}
示例8: _getQuotes
protected function _getQuotes()
{
$r = $this->_request;
$request = array('WebAuthenticationDetail' => array('UserCredential' => array('Key' => $r->key, 'Password' => $r->password)), 'ClientDetail' => array('AccountNumber' => $r->accountNumber, 'MeterNumber' => $r->meterNumber), 'Version' => array('ServiceId' => 'crs', 'Major' => '10', 'Intermediate' => '0', 'Minor' => '0'), 'RequestedShipment' => array('DropoffType' => $r->dropoffType, 'ShipTimestamp' => date('c'), 'PackagingType' => $r->packaging, 'TotalInsuredValue' => array('Ammount' => $r->value, 'Currency' => $r->currencyCode), 'Shipper' => array('Address' => array('PostalCode' => $r->originPostalCode, 'CountryCode' => $r->originCountryCode)), 'Recipient' => array('Address' => array('PostalCode' => $r->destPostalCode, 'CountryCode' => $r->destCountryCode, 'Residential' => (bool) $this->_config->residenceDelivery)), 'ShippingChargesPayment' => array('PaymentType' => 'SENDER', 'Payor' => array('AccountNumber' => $r->accountNumber, 'CountryCode' => $r->originCountryCode)), 'RateRequestTypes' => 'LIST', 'PackageCount' => '1', 'PackageDetail' => 'INDIVIDUAL_PACKAGES', 'RequestedPackageLineItems' => array(array('GroupPackageCount' => 1, 'Weight' => array('Value' => $r->weight, 'Units' => 'LB')))));
$pathToWsdl = Axis::config('system/path') . "/app/code/Axis/ShippingFedex/etc/RateService_v10.wsdl";
$client = new SoapClient($pathToWsdl);
// production : https://gateway.fedex.com:443/GatewayDC
// test : https://wsbeta.fedex.com:443/web-services
$client->__setLocation($this->_config->gateway);
$response = $client->getRates($request);
return $this->_parseResponse($response);
}
示例9: getSoapClient
/**
* @return SoapClient
*/
public function getSoapClient()
{
if ($this->apiWSDL === null) {
throw new Sms_Backend_Exception('Missing WSDL.');
}
if ($this->soap === null) {
$this->soap = new SoapClient($this->apiWSDL, $this->soapClientOptions);
if ($this->apiLocation) {
$this->soap->__setLocation($this->apiLocation);
}
}
return $this->soap;
}
示例10: quote
function quote($data, $config)
{
if ($config["test_mode"] == 'true') {
$wsdl = PATH_THIRD . "brilliant_retail/core/shipping/assets/fedex/wsdl/RateService_v13_test.wsdl";
} else {
$wsdl = PATH_THIRD . "brilliant_retail/core/shipping/assets/fedex/wsdl/RateService_v13.wsdl";
}
$client = new SoapClient($wsdl, array('trace' => 1));
// Refer to http://us3.php.net/manual/en/ref.soap.php for more information
// Need at least 1 for the weight
if ($data["weight"] < 1) {
$data["weight"] = 1;
}
$request['WebAuthenticationDetail'] = array('UserCredential' => array('Key' => $config["fedex_key"], 'Password' => $config["fedex_password"]));
$request['ClientDetail'] = array('AccountNumber' => $config["fedex_account"], 'MeterNumber' => $config["fedex_meter"]);
$request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request v13 using BrilliantRetail ***');
$request['Version'] = array('ServiceId' => 'crs', 'Major' => '13', 'Intermediate' => '0', 'Minor' => '0');
$request['ReturnTransitAndCommit'] = true;
$request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP';
$request['RequestedShipment']['ShipTimestamp'] = date('c');
$request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING';
$request['RequestedShipment']['TotalInsuredValue'] = array('Ammount' => $data["total"], 'Currency' => 'USD');
// Shipper Info
$request['RequestedShipment']['Shipper'] = array('Contact' => array('PersonName' => '', 'CompanyName' => '', 'PhoneNumber' => ''), 'Address' => array('StreetLines' => array(''), 'City' => '', 'StateOrProvinceCode' => $config["from_state"], 'PostalCode' => $config["from_zip"], 'CountryCode' => $config["from_country"]));
// Recipient Info
$request['RequestedShipment']['Recipient'] = array('Contact' => array('PersonName' => '', 'CompanyName' => '', 'PhoneNumber' => ''), 'Address' => array('StreetLines' => array(), 'City' => '', 'StateOrProvinceCode' => substr($data["to_state"], 0, 2), 'PostalCode' => $data["to_zip"], 'CountryCode' => $data["to_country"], 'Residential' => true));
$request['RequestedShipment']['RateRequestTypes'] = 'LIST';
$request['RequestedShipment']['PackageCount'] = '1';
$request['RequestedShipment']['RequestedPackageLineItems'] = $packageLineItem = array('SequenceNumber' => 1, 'GroupPackageCount' => 1, 'Weight' => array('Value' => $data["weight"], 'Units' => strtoupper($config["weight_unit"])), 'Dimensions' => array('Length' => (int) $config["size_length"], 'Width' => (int) $config["size_width"], 'Height' => (int) $config["size_height"], 'Units' => 'IN'));
$code = unserialize($config["code"]);
$this->rates = array();
foreach ($code as $c) {
$request['RequestedShipment']['ServiceType'] = $c;
try {
if (setEndpoint('changeEndpoint')) {
$newLocation = $client->__setLocation(setEndpoint('endpoint'));
}
$response = $client->getRates($request);
if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR') {
$rateReply = $response->RateReplyDetails;
$this->rates[$c] = array('code' => $c, 'rate' => number_format($rateReply->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount, 2), 'label' => ucwords(strtolower(str_replace("_", " ", $rateReply->ServiceType))));
}
} catch (SoapFault $exception) {
printFault($exception, $client);
}
}
if (count($this->rates) > 1) {
usort($this->rates, array($this, '_rate_sort'));
}
return $this->rates;
}
示例11: getSoapClient
/**
* @param bool $authenticate
* @return SoapClient
*/
public function getSoapClient($authenticate = true)
{
if ($this->_soapClient == null) {
$this->_connected = false;
$soapClientClass = $this->getOption('soap_client', 'Bronto_SoapClient');
$this->_soapClient = new $soapClientClass(self::BASE_WSDL, array('soap_version' => $this->_options['soap_version'], 'compression' => $this->_options['compression'], 'encoding' => $this->_options['encoding'], 'trace' => $this->_options['trace'], 'exceptions' => $this->_options['exceptions'], 'cache_wsdl' => $this->_options['cache_wsdl'], 'user_agent' => $this->_options['user_agent'], 'features' => $this->_options['features']));
$this->_soapClient->__setLocation(self::BASE_LOCATION);
$this->_connected = true;
if ($authenticate && !$this->_authenticated && $this->getToken()) {
$this->login();
}
}
return $this->_soapClient;
}
示例12: getClientForServer
/**
* Get a \SoapClient of a specific server endpoint.
*
* @param string $server
* The name of the server. eg 'user' or 'productorservice'.
*
* @return \SoapClient
*/
protected function getClientForServer($server)
{
if (!isset($this->clients[$server])) {
if (!in_array($server, $this->availableServers)) {
throw new \InvalidArgumentException('Server is either disabled or doesnt exist');
}
$url = $this->dolibarUrl . '/webservices/server_' . $server . '.php?wsdl';
$client = new \SoapClient($url);
// Dolibarr webservice api is bugged when used under https.
$client->__setLocation($url);
$this->clients[$server] = $client;
}
return $this->clients[$server];
}
示例13: create
/**
* Create a PHP SOAP client and configure it
*
* @return PiSoapClientManager
*/
public function create()
{
if (empty($this->wsdl)) {
throw new \InvalidArgumentException('The wsdl is not defined');
}
// we create the client SOAP
$this->soapClient = new \SoapClient($this->wsdl, $this->options);
// we add headers
if (count($this->headers) >= 1) {
$this->soapClient->__setSoapHeaders($this->headers);
}
if (!empty($this->url)) {
$this->soapClient->__setLocation($this->url);
}
return $this;
}
示例14: connectUnivz
/**
* Get data from UniVz
*
* @param array $searchTerms
* @param string $database
* @param string $xslFile Filename of the xsl file
* @return array T3X data
*/
public static function connectUnivz(array $searchTerms, $database, $xslFile = '')
{
$client = new \SoapClient(self::wsdlUrl . '?wsdl');
$client->__setLocation(self::wsdlUrl);
$request = ['general' => ['object' => $database], 'condition' => $searchTerms];
$soapXml = GeneralUtility::array2xml($request, '', 0, 'SOAPDataService');
$soapXml = self::addDotToString($soapXml, $request);
$result = null;
if ($xslFile !== '') {
$xsl = GeneralUtility::getUrl(ExtensionManagementUtility::extPath('substaff') . 'Resources/Private/Xsl/' . $xslFile . '.xsl');
$result = self::transform($client->getDataXML($soapXml), $xsl);
} else {
$result = $client->getDataXML($soapXml);
}
return $result;
}
示例15: preparerequest
private function preparerequest()
{
//PASSWORD DIGEST
$time = gmdate('Y-m-d\\TH:i:s');
$created = gmdate('Y-m-d\\TH:i:s\\Z');
$nonce = mt_rand();
$nonce_date_pwd = pack("A*", $nonce) . pack("A*", $created) . pack("H*", sha1($this->api_password));
$passwordDigest = base64_encode(pack('H*', sha1($nonce_date_pwd)));
$ENCODEDNONCE = base64_encode($nonce);
//SET CONNECTION DETAILS
$soapclient_options = array();
$soapclient_options['cache_wsdl'] = 'WSDL_CACHE_NONE';
$soapclient_options['stream_context'] = stream_context_create(array('http' => array('protocol_version' => '1.0', 'header' => 'Connection: Close')));
$soapclient_options['local_cert'] = dirname(__FILE__) . "/certificate.pem";
$soapclient_options['passphrase'] = $this->api_certificate_passphrase;
$soapclient_options['trace'] = true;
$soapclient_options['ssl_method'] = 'SOAP_SSL_METHOD_SSLv3';
$soapclient_options['location'] = $this->locationforrequest;
$soapclient_options['soap_version'] = 'SOAP_1_1';
//launch soap client
//$client = new SoapClient(dirname(__FILE__) . "/SAPI/ShippingAPI_V2_0_8.wsdl", $soapclient_options);
$client = new SoapClient(dirname(__FILE__) . "/reference/ShippingAPI_V2_0_8.wsdl", $soapclient_options);
$client->__setLocation($soapclient_options['location']);
//headers needed for royal mail//D8D094FC22716E3EDE14258880881317
$HeaderObjectXML = '<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-D8D094FC22716E3EDE14258880881317">
<wsse:Username>' . $this->api_username . '</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">' . $passwordDigest . '</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">' . $ENCODEDNONCE . '</wsse:Nonce>
<wsu:Created>' . $created . '</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>';
//push the header into soap
$HeaderObject = new SoapVar($HeaderObjectXML, XSD_ANYXML);
//push soap header
$header = new SoapHeader('http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd', 'Security', $HeaderObject);
$client->__setSoapHeaders($header);
return $client;
}