Hi,
I am new to SOAP and getting this error
" RESULTS: Array ( [faultcode] => Client [faultactor] => [faultstring] => Could not authenticate SOAP request: Could not retrieve authentication credentials from SOAP header [detail] => )"
The cURL PHP extension is required for NuSOAP to make a connection over SSL
<?
require_once "nusoap/nusoap.php";
/**
* @file
* Example code to access the Omniture Web Services for Administration Console
* and retrieve the current token count.
*
* @author Omniture <clientcare@omniture.com>
* @copyright 2006 Omniture, Inc. All Rights Reserved
*/
// reference the downloaded WSDL
define('WSDL_DOCUMENT', "./Omniture_wsdl.xml");
// seed random
list($usec, $sec) = explode(' ', microtime());
srand((float) $sec + ((float) $usec * 100000));
// SOAP login credentials
$username = "provided";
$secret = '*provided;
function get_header($username, $secret)
{
// Create a unique identifier, a.k.a. nonce.
// This example is used for simplicity in demonstration. A method
// that guarantees uniqueness should be used in a production environment.
$nonce = md5(rand());
$created = date("Y-m-d H:i:s");
$combo_string = $nonce . $created . $secret;
$sha1_string = sha1($combo_string);
$password = base64_encode($sha1_string);
$headers = '<wsse:Security SOAP-ENV:mustUnderstand="1">
<wsse:UsernameToken wsu:Id="User">
<wsse:Username>'.$username.'</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-
200401-wss-username-token-profile-1.0#PasswordDigest">'.$password.'</
wsse:Password>
<wsse:Nonce>'.$nonce.'</wsse:Nonce>
<wsu:Created>'.$created.'</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>';
return $headers;
}
// Create nuSOAP client
$client = new soapclient(WSDL_DOCUMENT, TRUE);
// handle client setup error
if($err = $client->getError()) {
echo "ERROR:".$err."\n";
exit();
}
// call Omniture Web services function
$result = $client->call('Company.GetTokenCount', // function name
array('auth_key' => $username), // parameters
'http://omniture.com', // namespace
'', // SOAP Action
get_header($username, $secret)); // security header
// Display results
echo "RESULTS:\n";
print_r($result);
echo "\n";
?>