function __doRequest($request, $location, $saction, $version, $one_way = null)
 {
     include_once 'WSSESoap.php';
     include_once 'WSASoap.php';
     $dom = new DOMDocument('1.0');
     $dom->loadXML($request);
     $objWSA = new WSASoap($dom);
     $objWSA->addAction($saction);
     $objWSA->addTo($location);
     $objWSA->addMessageID();
     $objWSA->addReplyTo();
     $dom = $objWSA->getDoc();
     $objWSSE = new WSSESoap($dom);
     if (isset($this->_username) && isset($this->_password)) {
         $objWSSE->addUserToken($this->_username, $this->_password);
     }
     /* Sign all headers to include signing the WS-Addressing headers */
     $objWSSE->signAllHeaders = TRUE;
     $objWSSE->addTimestamp(300);
     // if you need to do binary certificate signing you can uncomment this (and provide the path to the cert)
     /* create new XMLSec Key using RSA SHA-1 and type is private key */
     // $objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type'=>'private'));
     /* load the private key from file - last arg is bool if key in file (TRUE) or is string (FALSE) */
     /* Sign the message - also signs appropraite WS-Security items */
     // $objWSSE->signSoapDoc($objKey);
     /* Add certificate (BinarySecurityToken) to the message and attach pointer to Signature */
     // $token = $objWSSE->addBinaryToken(file_get_contents(CERT_FILE));
     // $objWSSE->attachTokentoSig($token);
     $request = $objWSSE->saveXML();
     $this->_lastRequest = $request;
     return parent::__doRequest($request, $location, $saction, $version);
 }
	function __doRequest($request, $location, $saction, $version) {
		$doc = new DOMDocument();
		$doc->loadXML($request);
		$objWSSE = new WSSESoap($doc);
		$objWSSE->addUserToken($this->username, $this->password, FALSE);
		return parent::__doRequest($objWSSE->saveXML(), $location, $saction, $version);
   }
Example #3
0
 function __doRequest($request, $location, $action, $version, $one_way = 0)
 {
     global $username, $password;
     $doc = new DOMDocument('1.0');
     $doc->loadXML($request);
     $objWSSE = new WSSESoap($doc);
     $objWSSE->addUserToken($username, $password);
     $objWSSE->addTimestamp();
     return parent::__doRequest($objWSSE->saveXML(), $location, $action, $version, $one_way);
 }
 /**
  * @param bool $retryAttempt Is this call a repeated attempt to send data. Needs to be available for warning
  * handler that decides whether to requeue request.
  */
 function __doRequest($request, $location, $saction, $version, $one_way = 0, $retryAttempt = false)
 {
     $doc = new DOMDocument();
     $doc->loadXML($request);
     $objWSSE = new WSSESoap($doc);
     $objWSSE->addUserToken($this->username, $this->password, FALSE);
     set_error_handler('\\Wikia\\ExactTarget\\ExactTargetSoapErrorHandler::requeueConnectionResetWarning', E_USER_WARNING);
     $response = parent::__doRequest($objWSSE->saveXML(), $location, $saction, $version);
     restore_error_handler();
     return $response;
 }
 public function __doRequest($request, $location, $saction, $version)
 {
     $doc = new DOMDocument('1.0');
     $doc->loadXML($request);
     $objWSSE = new WSSESoap($doc);
     /* add Timestamp with no expiration timestamp */
     //$objWSSE->addTimestamp();
     $objWSSE->addUserToken($this->_username, $this->_password, true);
     //Zend_Debug::dump($objWSSE->saveXML());
     return parent::__doRequest($objWSSE->saveXML(), $location, $saction, $version);
 }
 function __doRequest($request, $location, $saction, $version, $one_way = null)
 {
     $doc = new DOMDocument();
     $doc->loadXML($request);
     $objWSSE = new WSSESoap($doc);
     $objWSSE->addUserToken($this->username, $this->password, FALSE);
     //        echo "<pre> ";
     //        echo $objWSSE->saveXML();
     //        echo "</pre> ";
     //        print "\n \n";
     //file_put_contents('debug.xml', $objWSSE->saveXML());
     return parent::__doRequest($objWSSE->saveXML(), $location, $saction, $version, $one_way);
 }
Example #7
0
 public function __doRequest($request, $location, $saction, $version, $one_way = 0)
 {
     $doc = new DOMDocument('1.0');
     $doc->loadXML($request);
     $objWSSE = new WSSESoap($doc);
     /* Sign all headers to include signing the WS-Addressing headers */
     $objWSSE->signAllHeaders = true;
     $objWSSE->addTimestamp();
     $objWSSE->addUserToken($this->_username, $this->_password, $this->_digest);
     /* create new XMLSec Key using RSA SHA-1 and type is private key */
     $objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type' => 'private'));
     /* load the private key from file - last arg is bool if key in file (true) or is string (FALSE) */
     $objKey->loadKey(PRIVATE_KEY, true);
     /* Sign the message - also signs appropraite WS-Security items */
     $objWSSE->signSoapDoc($objKey);
     /* Add certificate (BinarySecurityToken) to the message and attach pointer to Signature */
     $token = $objWSSE->addBinaryToken(file_get_contents(CERT_FILE));
     $objWSSE->attachTokentoSig($token);
     $request = $objWSSE->saveXML();
     return parent::__doRequest($request, $location, $saction, $version);
 }
Example #8
0
 function __doRequest($request, $location, $saction, $version, $one_way = null)
 {
     $doc = new DOMDocument();
     $doc->loadXML($request);
     $objWSSE = new WSSESoap($doc);
     $objWSSE->addUserToken("*", "*", FALSE);
     $objWSSE->addOAuth($this->getInternalAuthToken($this->tenantKey));
     $content = utf8_encode($objWSSE->saveXML());
     $content_length = strlen($content);
     if ($this->debugSOAP) {
         error_log('FuelSDK SOAP Request: ');
         error_log(str_replace($this->getInternalAuthToken($this->tenantKey), "REMOVED", $content));
     }
     $headers = array("Content-Type: text/xml", "SOAPAction: " . $saction, "User-Agent: " . getSDKVersion());
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $location);
     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_USERAGENT, "FuelSDK-PHP-v0.9");
     $output = curl_exec($ch);
     $this->lastHTTPCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
     curl_close($ch);
     return $output;
 }