home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (uc_cybersource.soap.inc)

This example Drupal source code file (uc_cybersource.soap.inc) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

action, extends, function, location, new, node, options, php, request, soapheader, version, wsdl, wsse:password

The uc_cybersource.soap.inc Drupal example source code

// $Id: uc_cybersource.soap.inc,v 2010/07/12 01:57:43 tr Exp $

 * @file
 * Defines a class used for communicating with CyberSource via SOAP.
 * Provided by Acquia, Commercially supported Drupal - http://acquia.com

class CyberSourceSoapClient extends SoapClient {
  function __construct($wsdl, $options = NULL) {
    parent::__construct($wsdl, $options);

  // This section inserts the UsernameToken information in the outgoing request.
  function __doRequest($request, $location, $action, $version) {
    $login = _uc_cybersource_soap_login_data();

    $soapHeader = '<SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:Security SOAP-ENV:mustUnderstand="1"><wsse:UsernameToken><wsse:Username>'. $login['merchant_id'] .'</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">'. $login['transaction_key'] .'</wsse:Password></wsse:UsernameToken></wsse:Security></SOAP-ENV:Header>';

    $requestDOM = new DOMDocument('1.0');
    $soapHeaderDOM = new DOMDocument('1.0');

    try {
      $node = $requestDOM->importNode($soapHeaderDOM->firstChild, TRUE);
      $requestDOM->firstChild->insertBefore($node, $requestDOM->firstChild->firstChild);
      $request = $requestDOM->saveXML();
    catch (DOMException $e) {
      die('Error adding UsernameToken: '. $e->code);

    return parent::__doRequest($request, $location, $action, $version);

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal uc_cybersource.soap.inc source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.