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); } }
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; }
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; }
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); }
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); }
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' => '*****@*****.**', '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' => '*****@*****.**', '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' => '*****@*****.**', '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']); }
/** * * @ 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; }
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); }
/** * @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; }
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; }
/** * @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; }
/** * 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]; }
/** * 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; }
/** * 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; }
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; }
function attach_file_protocol($subject, $sender, $usage_code, $files, $document, $print_full_result = false) { $client = new SoapClient(PROTOCOL_URL, array('trace' => 1, 'exceptions' => 1, 'cache_wsdl' => 0)); // set trace = 1 for debugging $client->__setLocation(PROTOCOL_URL); $return = array(); foreach ($files as $file) { try { $protocol_args = array('userName' => PROTOCOL_USER, 'password' => PROTOCOL_PASS, 'document' => $document->return, 'fileData' => $file['file'], 'fileName' => $file['name'], 'fileDescription' => $file['description'], 'inOutBoth' => 1); $result = $client->attachFileToDocument($protocol_args); $return[] = array('name' => $file['name'], 'description' => $file['description'], 'protocol_attach' => $result->return); } catch (SoapFault $fault) { if (DEBUG) { $return[] = array('lastest_request' => $client->__getLastRequest(), 'fault' => $fault->getMessage()); } } } //TEMP ------------------- echo '<br /><hr /> attachFileToDocument call results: <br /><br />'; print_r($return); //------------------------ return $return; }
/** * Create soap client with selected wsdl * * @param string $wsdl * @param bool|int $trace * @return \SoapClient */ protected function _createSoapClient($wsdl, $trace = false) { $client = new \SoapClient($wsdl, ['trace' => $trace]); $client->__setLocation($this->getConfigFlag('sandbox_mode') ? $this->getConfigData('sandbox_webservices_url') : $this->getConfigData('production_webservices_url')); return $client; }
/** * @param string $function Name of the function which should be called * @param array $params Requestparameters 'ParameterName' => 'ParameterValue' * * @return array The response as an array with stdClass objects */ protected function performSoapRequest($function, $params) { $soapClient = new SoapClient($this->webserviceWsdl, array('exceptions' => 1)); $soapClient->__setLocation(str_replace('%%COUNTRY%%', $this->responseConfig['country'], $this->webserviceEndpoint)); $soapClient->__setSoapHeaders($this->buildSoapHeader($function)); //var_dump('<pre>',$soapClient->__soapCall($function, array($params)),'</pre>'); die; return $soapClient->__soapCall($function, array($params)); }
public function updateorderstatus() { //$from = 'Robin'; // sender //$subject = 'ABCD'; $message = 'Cron Job Running123456'; // message lines should not exceed 70 characters (PHP rule), so wrap it //$message = wordwrap($message, 70); // send mail $from = 'Arun'; // sender $subject = 'ABCD12345'; $wsdlUrl = Mage::getStoreConfig('unicom_options/unigroup/uniurl'); $wsdllUrl = Mage::getStoreConfig('unicom_options/unigroup/unilurl'); $username = Mage::getStoreConfig('unicom_options/unigroup/uniusername'); $password = Mage::getStoreConfig('unicom_options/unigroup/unipass'); /*$wsdlUrl = "https://demo.unicommerce.com/services/soap/uniware15.wsdl"; $wsdllUrl = "http://demo.unicommerce.com/services/soap/?version=1.5&facility=01"; $username = "******"; $password = "******"; */ $soapClient = new SoapClient($wsdlUrl, array('trace' => 1, 'exception' => 0)); $soapClient->__setLocation($wsdllUrl); $strWSSENS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"; $objSoapVarUser = new SoapVar($username, XSD_STRING, NULL, $strWSSENS, "UserName", $strWSSENS); $objSoapVarPass = new SoapVar($password, XSD_STRING, NULL, $strWSSENS, "Password", $strWSSENS); $objWSSEAuth = new clsWSSEAuth($objSoapVarUser, $objSoapVarPass); $objSoapVarWSSEAuth = new SoapVar($objWSSEAuth, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'UsernameToken', $strWSSENS); $objWSSEToken = new clsWSSEToken($objSoapVarWSSEAuth); $objSoapVarWSSEToken = new SoapVar($objWSSEToken, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'UsernameToken', $strWSSENS); $objSoapVarHeaderVal = new SoapVar($objSoapVarWSSEToken, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'Security', $strWSSENS); $objSoapVarWSSEHeader = new SoapHeader($strWSSENS, 'Security', $objSoapVarHeaderVal, true); $soapClient->__setSoapHeaders(array($objSoapVarWSSEHeader)); //Mage::app('default'); $model = Mage::getModel('rcredit/rcredit'); $order = new Mage_Sales_Model_Order(); $order_details = $model->orderids(); //print_r($order_details); $i = 0; $check = array(); $msg = array(); foreach ($order_details as $details) { $msg[] = $details[order_id]; $shipping = $soapClient->GetSaleOrder(array('SaleOrder' => array('Code' => $details[order_id]))); //echo '<pre>'; //print_r($shipping); $delivcnt = count($shipping->SaleOrder->ShippingPackages->ShippingPackage); foreach ($shipping->SaleOrder->ShippingPackages as $v) { $order->loadByIncrementId($details[order_id]); $payment = $order->getPayment()->getMethodInstance()->getCode(); $customer_status = $model->customerstatus($order->getCustomerEmail()); if ($delivcnt > 1) { $deliverDate = $v[$delivcnt - 1]->DeliveredOn; $vstatus = $v[$delivcnt - 1]->StatusCode; } else { $deliverDate = $v->DeliveredOn; $vstatus = $v->StatusCode; } if ($vstatus == 'DELIVERED') { $day = explode('T', $deliverDate); if ($day[0] >= $customer_status['credit_start_date']) { //echo 'In Second Cycle'.$details[cycle].'-->'.$details[order_id].'-->'.$details[order_value].'-->'.$order->getCustomerEmail().'-->'.$customer_status[credit_cycle].'-->'.$customer_status[utlized_amt]; //echo '<br/>'; $model->updateordercycle($details[order_id], $customer_status[credit_cycle]); } $model->updateorderdate($details[order_id], $day[0]); } $i++; } //mail("*****@*****.**",$subject,$details[order_id],"From: $from\n"); $order = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('increment_id', $details[order_id])->getFirstItem(); if ($order->getStatus() == 'Canceled' || $order->getStatus() == 'canceled') { $order->loadByIncrementId($details[order_id]); $payment = $order->getPayment()->getMethodInstance()->getCode(); if ($payment == 'rcredit') { $payment_status = 'Refund'; $order_cycle_value = $model->ordercyclehistory($details[order_id]); //Getting the cycle using the order_id. $cycle = $order_cycle_value['cycle']; $customer_email = $order->getCustomerEmail(); $grandtotal = round($details[order_value], 2); $customer_status = $model->customerstatus($customer_email); // Getting the customer status from the Shopper Credit Module $customer_credit_limit = $customer_status['credit_limit']; // Getting customer's credit limit. $customer_current_bal = $customer_status['bal_amt']; // Getting customer's current balance $balance_amount = $customer_status['bal_amt'] + $grandtotal; // Calculating the updated balance after sucessful purchase. $utlized_amt = $customer_status['utlized_amt']; // Getting customer's current balance $total_used_amt = $utlized_amt - $grandtotal; // Getting the total utlized amt. $pay_interval = $customer_status['pay_interval']; // Getting customer's payinterval date $expiry_date = $customer_status['enddate']; // Getting expiry date for the customer $action = 'Refund due to cancellation'; $todate = date("Y-m-d"); $order_status = "Cancel"; if ($order_cycle_value['action'] != 'Cancel') { $model->cancelledorderdetails($details[order_id], $total_used_amt, $balance_amount, $action, $order_status); $model->updateoncancel($grandtotal, $customer_email, $cycle); } } } } }
/** * @param string $function Name of the function which should be called * @param array $params Requestparameters 'ParameterName' => 'ParameterValue' * * @return array The response as an array with stdClass objects */ protected function performSoapRequest($function, $params) { if (true === $this->requestConfig['requestDelay']) { sleep(1); } $soapClient = new SoapClient($this->webserviceWsdl, array('exceptions' => 1)); $soapClient->__setLocation(str_replace('%%COUNTRY%%', $this->responseConfig['country'], $this->webserviceEndpoint)); $soapClient->__setSoapHeaders($this->buildSoapHeader($function)); return $soapClient->__soapCall($function, array($params)); }
function CSAuth($username, $password) { $wsdl = 'https://internal.auth.com/Service.asmx?wsdl'; $dest = 'https://interal.auth.com/Service.asmx'; $single_md5_pass = md5($password); try { $client = new SoapClient($wsdl, array('trace' => 1)); $client->__setLocation($dest); $loginparams = array('username' => $username, 'password' => $password); $result = $client->AuthCS($loginparams); switch ($result->AuthCSResult) { case 'SUCCESS': $this->cleanConvertData($single_md5_pass); $this->return_code = $result->AuthCSResult; return TRUE; case 'WRONG_AUTH': $this->return_code = $result->AuthCSResult; return FALSE; default: $this->return_code = 'FAIL'; return FALSE; } } catch (Exception $ex) { //handle error $this->return_code = 'FAIL'; return FALSE; } }
public function approvedOrderPush() { $wsdlUrl = "https://zoffio.unicommerce.com/services/soap/uniware16.wsdl"; $wsdllUrl = "http://zoffio.unicommerce.com/services/soap/?version=1.6&facility=01"; $username = "******"; $password = "******"; $soapClient = new SoapClient($wsdlUrl, array('trace' => 1, 'exception' => 0)); $soapClient->__setLocation($wsdllUrl); $strWSSENS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"; $objSoapVarUser = new SoapVar($username, XSD_STRING, NULL, $strWSSENS, "UserName", $strWSSENS); $objSoapVarPass = new SoapVar($password, XSD_STRING, NULL, $strWSSENS, "Password", $strWSSENS); $objWSSEAuth = new clsWSSEAuth($objSoapVarUser, $objSoapVarPass); $objSoapVarWSSEAuth = new SoapVar($objWSSEAuth, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'UsernameToken', $strWSSENS); $objWSSEToken = new clsWSSEToken($objSoapVarWSSEAuth); $objSoapVarWSSEToken = new SoapVar($objWSSEToken, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'UsernameToken', $strWSSENS); $objSoapVarHeaderVal = new SoapVar($objSoapVarWSSEToken, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'Security', $strWSSENS); $objSoapVarWSSEHeader = new SoapHeader($strWSSENS, 'Security', $objSoapVarHeaderVal, true); $soapClient->__setSoapHeaders(array($objSoapVarWSSEHeader)); $aorders = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('status', 'approved')->addAttributeToSelect('increment_id'); foreach ($aorders as $aorder) { $address = array(); $saleorder = array(); $items = array(); $order = Mage::getModel('sales/order')->loadByIncrementId($aorder->getIncrementId()); $incrementId = $order->getIncrementId(); $customer_id = $order->getCustomerId(); $collection = Mage::getModel("customer/customer")->load($customer_id); $allitems = $order->getAllItems(); $totalqtyordered = $order->getTotalQtyOrdered(); $shippingAmount = $order->getShippingAmount(); $itemshipamt = $shippingAmount / $totalqtyordered; $payment_method_code = $order->getPayment()->getMethodInstance()->getCode(); $payment_title = "Payment Method: " . $order->getPayment()->getMethodInstance()->getTitle(); $payment_method_title = $order->getPayment()->getMethodInstance()->getTitle(); if ($payment_method_code == 'checkmo') { $shipmethodcode = "CHQ"; } else { $shipmethodcode = "STD"; } foreach ($allitems as $item) { $itemQty = (int) $item->getQtyOrdered(); if ($item->getPriceInclTax() > 0) { for ($i = 0; $i < $itemQty; $i++) { $icode = $item->getItemId() . $i; $icode = (int) $icode; $itemSku = $item->getSku(); $discountAmt = $item->getDiscountAmount() / $itemQty; $itemTPrice = $item->getPriceInclTax() + $itemshipamt - $discountAmt; $itemSPrice = $item->getPriceInclTax() - $discountAmt; $items[] = array('Code' => $icode, 'ItemSKU' => $itemSku, 'ShippingMethodCode' => $shipmethodcode, 'TotalPrice' => $itemTPrice, 'SellingPrice' => $itemSPrice, 'ShippingCharges' => $itemshipamt, 'Discount' => $discountAmt, 'PacketNumber' => '1'); } } } $verifypayment = 0; if ($payment_method_code == 'cashondelivery' || $payment_method_code == 'checkmo') { $chpmcode = 1; } else { $chpmcode = 0; } $email = $order->getCustomerEmail(); $billing_address = $order->getBillingAddress(); $billing_name = $billing_address->getName(); $billing_street = $billing_address->getStreet(); $billing_company = $billing_address->getCompany() . "."; $billing_str = $billing_street[0] . " " . $billing_street[1]; $billing_city = $billing_address->getCity(); $billingregion = Mage::getModel('directory/region')->load($billing_address->getRegionId()); $billing_state = explode("-", $billingregion->getCode()); $billing_Country = $billing_address->getCountryId(); $billing_postcode = $billing_address->getPostcode(); $billing_phone = $billing_address->getTelephone(); $address[] = array('Name' => $billing_name, 'AddressLine1' => $billing_company, 'AddressLine2' => $billing_str, 'City' => $billing_city, 'State' => $billing_state[1], 'Country' => $billing_Country, 'Pincode' => $billing_postcode, 'Phone' => $billing_phone, 'id' => '1'); $shipping_address = $order->getShippingAddress(); $shipping_name = $shipping_address->getName(); $shipping_street = $shipping_address->getStreet(); $shipping_company = $shipping_address->getCompany() . "."; $shipping_str = $shipping_street[0] . " " . $shipping_street[1]; $shipping_city = $shipping_address->getCity(); $shippingregion = Mage::getModel('directory/region')->load($shipping_address->getRegionId()); $shipping_state = explode("-", $shippingregion->getCode()); $shipping_Country = $shipping_address->getCountryId(); $shipping_postcode = $shipping_address->getPostcode(); $shipping_phone = $shipping_address->getTelephone(); $address[] = array('Name' => $shipping_name, 'AddressLine1' => $shipping_company, 'AddressLine2' => $shipping_str, 'City' => $shipping_city, 'State' => $shipping_state[1], 'Country' => $shipping_Country, 'Pincode' => $shipping_postcode, 'Phone' => $shipping_phone, 'id' => '2'); $saleorder = array('SaleOrder' => array('Code' => $incrementId, 'DisplayOrderCode' => $incrementId, 'CashOnDelivery' => $chpmcode, 'NotificationEmail' => $email, 'NotificationMobile' => $shipping_phone, 'AdditionalInfo' => $payment_title, 'Addresses' => array('Address' => $address), 'VerificationRequired' => $verifypayment, 'BillingAddress' => array('ref' => '1'), 'ShippingAddress' => array('ref' => '2'), 'SaleOrderItems' => array('SaleOrderItem' => $items), 'CustomFields' => array('CustomField' => array(array('name' => 'customerId', 'value' => $customer_id), array('name' => 'zoffioPaymentMethod', 'value' => $payment_method_code))))); $soapClient->CreateSaleOrder($saleorder); } }
public function getTimeInTransit($_zip, $_product, $_method = null) { if (!empty($this->_cacheTurnover) && array_key_exists($_method, $this->_cacheTurnover)) { return $this->_cacheTurnover[$_method]; } /*Varien_Profiler::start('ups_get_time_in_transit');*/ if ($_zip == '' || !Mage::getStoreConfig(self::RSHIPPING_STORE_POST_CODE)) { return 0; } /** * Get Store GeoData for ups * */ $_storeGeoData = $this->getGeoData(Mage::getStoreConfig(self::RSHIPPING_STORE_POST_CODE)); if (!$_storeGeoData) { return 0; } $pWeight = $_product->getWeight(); /** * Get Customer GeoData for ups * */ $_customerGeoData = $this->getGeoData($_zip); if (!$_customerGeoData) { return 0; } /** * UPS API Transit Time * */ $_accessKey = Mage::helper('core')->decrypt(Mage::getStoreConfig(self::RSHIPPING_UPS_ACCESS_KEY)); $_userId = Mage::getStoreConfig(self::RSHIPPING_UPS_USERNAME); $_pass = Mage::helper('core')->decrypt(Mage::getStoreConfig(self::RSHIPPING_UPS_PASSWORD)); $_wsdl = Mage::getModuleDir('etc', 'ITwebexperts_Rshipping') . DS . "upsApi" . DS . "tntws.wsdl"; $_operation = "ProcessTimeInTransit"; $_endPointUrl = Mage::helper('rshipping/config')->isLiveUpsMode(Mage::app()->getStore()->getId()) ? self::RSHIPPING_UPS_ENDPOINT_URL_LIVE : self::RSHIPPING_UPS_ENDPOINT_URL_TEST; try { /* Initialize soap client*/ $_client = new SoapClient($_wsdl, array('soap_version' => 'SOAP_1_1', 'trace' => 1)); $_client->__setLocation($_endPointUrl); /* Create soap header*/ $_upss = array('UsernameToken' => array('Username' => $_userId, 'Password' => $_pass), 'ServiceAccessToken' => array('AccessLicenseNumber' => $_accessKey)); $_header = new SoapHeader('http://www.ups.com/XMLSchema/XOLTWS/UPSS/v1.0', 'UPSSecurity', $_upss); $_client->__setSoapHeaders($_header); /** * TODO: get weight code from product * Max UPS weight = 31kg (70lbs) * Create soap request */ $_request = array('Request' => array('RequestOption' => 'TNT'), 'ShipFrom' => $_storeGeoData, 'ShipTo' => $_customerGeoData, 'Pickup' => array('Date' => Mage::getModel('core/date')->date('Ymd')), 'ShipmentWeight' => array('Weight' => $pWeight && (int) $pWeight < 75 ? $pWeight : 75, 'UnitOfMeasurement' => array('Code' => 'KGS', 'Description' => 'Kilograms')), 'TotalPackagesInShipment' => '1', 'InvoiceLineTotal' => array('CurrencyCode' => Mage::app()->getStore()->getCurrentCurrencyCode(), 'MonetaryValue' => '1'), 'MaximumListSize' => '1'); $_response = $_client->__soapCall($_operation, array($_request)); /*Varien_Profiler::stop('ups_get_time_in_transit'); $_timers = Varien_Profiler::getTimers();*/ /** * Check selected method in response * */ if ($_response->Response->ResponseStatus->Code != 1) { Mage::log($_response->Response->ResponseStatus->Description, null, 'rshipping.log'); $this->_cacheTurnover[$_method] = 0; return $this->_cacheTurnover[$_method]; } $_serviceSummaryAr = $_response->TransitResponse->ServiceSummary; if (!is_array($_serviceSummaryAr)) { Mage::log('Error in response parsing', null, 'rshipping.log'); $this->_cacheTurnover[$_method] = 0; return $this->_cacheTurnover[$_method]; } foreach ($_serviceSummaryAr as $_serviceSummary) { if (mb_stripos($_method, $_serviceSummary->Service->Code) !== false) { $this->_cacheTurnover[$_method] = (int) $_serviceSummary->EstimatedArrival->BusinessDaysInTransit; return $this->_cacheTurnover[$_method]; } } } catch (Exception $_e) { Mage::log($_e->getMessage(), null, 'rshipping.log'); $this->_cacheTurnover[$_method] = 0; return $this->_cacheTurnover[$_method]; } $this->_cacheTurnover[$_method] = 0; return $this->_cacheTurnover[$_method]; }
function initAWS($source_id) { global $search_index, $url; global $opac_curl_proxy; $this->parse_profile(); $params = $this->get_source_params($source_id); $this->fetch_global_properties(); if ($params["PARAMETERS"]) { //Affichage du formulaire avec $params["PARAMETERS"] $vars = unserialize($params["PARAMETERS"]); foreach ($vars as $key => $val) { global ${$key}; ${$key} = $val; } } $arraySoapOptions = array(); $arraySoapOptions["exceptions"] = true; $arraySoapOptions["connection_timeout"] = $params["TIMEOUT"]; if ($opac_curl_proxy != '') { $param_proxy = explode(',', $opac_curl_proxy); $arraySoapOptions["proxy_host"] = $param_proxy[0]; $arraySoapOptions["proxy_port"] = $param_proxy[1]; $arraySoapOptions["proxy_login"] = $param_proxy[2]; $arraySoapOptions["proxy_password"] = $param_proxy[3]; } try { $client = new SoapClient("http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl", $arraySoapOptions); $client->__setLocation($this->profile["SITES"][0]["SITE"][$this->current_site]["ADDRESS"][0]["URL"]); } catch (Exception $e) { $this->error = true; $this->error_message = $e->getMessage(); } return $client; }
public function getSpeedyAccountFullResponse($nospeedy) { $url = "http://" . $this->ip_addr2 . "/TelkomSystem/Radius/Services/ProxyService/getSpeedyAccount?wsdl"; $client = new SoapClient($url, array('trace' => 1)); $client->__setLocation($url); $param2 = array("in0" => $nospeedy, "in1" => 'telkom.net', "in2" => $nospeedy); $result = $client->__call("getSpeedyAccountFull", array('parameters' => $param2)); $tmp = $client->__getLastResponse(); $a = xmlstr_to_array($tmp); $out = $a['soap:Body']['ns1:getSpeedyAccountFullResponse']['ns1:out']; if ($_REQUEST['debug'] == 'api') { var_dump($a, $result, $tmp, $client, $out, $out['status']); } return $out; }
function send() { if ($this->isValid()) { /* * if SOAP is installed, try to perform a SOAP request * else, try to use cURL * else, throw an error message that neither of those are installed */ if (class_exists("SoapClienttt")) { #if(false){ $client = new SoapClient('https://www.mPAY24.com/soap/etp/1.4/ETP.wsdl', array('login' => 'u' . $this->merchantid, 'password' => 'password', 'exceptions' => FALSE)); // if we are on test system, override the Location set within the WSDL if ($this->etp_url == "https://test.mPAY24.com/app/bin/etpv5") { $client->__setLocation('https://test.mPAY24.com/app/bin/etpproxy_v14'); } // perform the request $this->response = $client->SelectPayment(array('mdxi' => $this->xmlfile, 'merchantID' => $this->merchantid, 'getDataURL' => '', 'tid' => '')); } elseif (function_exists("curl_init")) { #}if(false){ // build Request $this->buildRequest(); // send request; $ch = curl_init($this->etp_url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $this->request); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // TODO: Move proxy information to a more secure area, // e.g. a configuration file outside the web servers // document root. #curl_setopt($ch, CURLOPT_PROXY, 'aaa.bbb.ccc.ddd:port'); #... // NOT FOR PRODUCTION USE #curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); // uncomment the following line in case you experience trouble regarding cURL SSL certificate errors // Plese download cacert.pem from http://curl.haxx.se/docs/caextract.html #curl_setopt($ch, CURLOPT_CAINFO, "./cacert.pem"); // get response $this->response = curl_exec($ch); // catch errors $ch_error = curl_error($ch); if (empty($this->response) || !empty($ch_error)) { $this->response = "STATUS=ERROR&RETURNCODE=cURL+-+" . urlencode(curl_error($ch)); } curl_close($ch); } else { $this->response = "STATUS=ERROR&RETURNCODE=Your+PHP+installation+does+not+meet+either+of+the+following+requirements%3A%3Cul%3E%3Cli%3E%3Ca+href%3D%27http%3A%2F%2Fwww.php.net%2FcURL%27%3EcURL%3C%2Fa%3E+or%3C%2Fli%3E%3Cli%3E%3Ca+href%3D%27http%3A%2F%2Fwww.php.net%2FSOAP%27%3ESOAP%3C%2Fa%3E%3C%2Fli%3E%3C%2Ful%3E"; } } }
protected function _createSoapClient($wsdl, $trace = false, $type = self::RATE) { $client = new SoapClient($wsdl, array('trace' => $trace)); switch ($type) { case self::RATE: $client->__setLocation($this->getConfigFlag('sandbox_mode') ? self::DEV_RATE_LABEL_URL : self::PROD_RATE_LABEL_URL); break; case self::TRACK: $client->__setLocation($this->getConfigFlag('sandbox_mode') ? self::DEV_TRACK_URL : self::PROD_TRACK_URL); break; case self::LABEL: $client->__setLocation($this->getConfigFlag('sandbox_mode') ? self::DEV_RATE_LABEL_URL : self::PROD_RATE_LABEL_URL); break; default: $client->__setLocation($this->getConfigFlag('sandbox_mode') ? self::DEV_RATE_LABEL_URL : self::PROD_RATE_LABEL_URL); break; } return $client; }
'Minor' => '0' ); $request['SelectionDetails'] = array( 'PackageIdentifier' => array( 'Type' => 'CUSTOMER_REFERENCE', 'Value' => getProperty('customerreference') // Replace with a valid customer reference ), 'ShipmentAccountNumber' => getProperty('trackaccount') // Replace with account used for shipment ); try { if(setEndpoint('changeEndpoint')){ $newLocation = $client->__setLocation(setEndpoint('endpoint')); } $response = $client ->track($request); if ($response -> HighestSeverity != 'FAILURE' && $response -> HighestSeverity != 'ERROR'){ if($response->HighestSeverity != 'SUCCESS'){ echo '<table border="1">'; echo '<tr><th>Track Reply</th><th> </th></tr>'; trackDetails($response->Notifications, ''); echo '</table>'; }else{ if ($response->CompletedTrackDetails->HighestSeverity != 'SUCCESS'){ echo '<table border="1">'; echo '<tr><th>Shipment Level Tracking Details</th><th> </th></tr>'; trackDetails($response->CompletedTrackDetails, '');
/** * Create soap client with selected wsdl * * @param string $wsdl * @param bool|int $trace * @return SoapClient */ protected function _createSoapClient($wsdl, $trace = false) { $client = new SoapClient($wsdl, array('trace' => $trace)); $client->__setLocation($this->getConfigFlag('sandbox_mode') ? 'https://wsbeta.fedex.com:443/web-services ' : 'https://ws.fedex.com:443/web-services'); return $client; }
umask(0); Mage::app("default"); //$date = $_REQUEST['date']; $resource = Mage::getSingleton('core/resource'); $read = $resource->getConnection('core_read'); $write = $resource->getConnection('core_write'); $fromdate = Mage::getModel('core/date')->date('Y-m-d', strtotime('-1 day')); $fromdate = $fromdate . "T00:00:00"; $todate = Mage::getModel('core/date')->date('Y-m-d'); $todate = $todate . "T00:00:00"; $wsdlUrl = "https://zoffio.unicommerce.com/services/soap/uniware17.wsdl"; $wsdllUrl = "http://zoffio.unicommerce.com/services/soap/?version=1.7&facility=01"; $username = "******"; $password = "******"; $soapClient = new SoapClient($wsdlUrl, array('trace' => 1, 'exception' => 0)); $soapClient->__setLocation($wsdllUrl); $strWSSENS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"; $objSoapVarUser = new SoapVar($username, XSD_STRING, NULL, $strWSSENS, "UserName", $strWSSENS); $objSoapVarPass = new SoapVar($password, XSD_STRING, NULL, $strWSSENS, "Password", $strWSSENS); $objWSSEAuth = new clsWSSEAuth($objSoapVarUser, $objSoapVarPass); $objSoapVarWSSEAuth = new SoapVar($objWSSEAuth, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'UsernameToken', $strWSSENS); $objWSSEToken = new clsWSSEToken($objSoapVarWSSEAuth); $objSoapVarWSSEToken = new SoapVar($objWSSEToken, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'UsernameToken', $strWSSENS); $objSoapVarHeaderVal = new SoapVar($objSoapVarWSSEToken, SOAP_ENC_OBJECT, NULL, $strWSSENS, 'Security', $strWSSENS); $objSoapVarWSSEHeader = new SoapHeader($strWSSENS, 'Security', $objSoapVarHeaderVal, true); $soapClient->__setSoapHeaders(array($objSoapVarWSSEHeader)); $manifest = $soapClient->CreateExportJob(array('ExportJobTypeName' => 'Shipping Manifest', 'ExportColumns' => array('ExportColumn' => array('manifestCode', 'manifestStatus')), 'ExportFilters' => array('ExportFilter' => array('DateRange' => array('Start' => $fromdate, 'End' => $todate), 'id' => 'dateRange')), 'Frequency' => 'ONETIME')); $write->query("truncate `manifestdata`"); $export = $soapClient->GetExportJobStatus(array('JobCode' => $manifest->JobCode)); if ($export->Status == "COMPLETE") { $csvfile = $export->FilePath;