User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the RSS, Web Services and SOAP section within the Web Development category of DaniWeb, a massive community of 429,743 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,080 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our RSS, Web Services and SOAP advertiser: Programming Forums
Views: 1971 | Replies: 0
Reply
Join Date: Mar 2008
Posts: 3
Reputation: arch1 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
arch1 arch1 is offline Offline
Newbie Poster

Could not authenticate SOAP request

  #1  
May 30th, 2008
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


  1. <?
  2. require_once "nusoap/nusoap.php";
  3. /**
  4. * @file
  5. * Example code to access the Omniture Web Services for Administration Console
  6. * and retrieve the current token count.
  7. *
  8. * @author Omniture <clientcare@omniture.com>
  9. * @copyright 2006 Omniture, Inc. All Rights Reserved
  10. */
  11. // reference the downloaded WSDL
  12. define('WSDL_DOCUMENT', "./Omniture_wsdl.xml");
  13.  
  14. // seed random
  15. list($usec, $sec) = explode(' ', microtime());
  16. srand((float) $sec + ((float) $usec * 100000));
  17.  
  18. // SOAP login credentials
  19. $username = "provided";
  20.  
  21.  
  22. $secret = '*provided;
  23.  
  24. function get_header($username, $secret)
  25. {
  26. // Create a unique identifier, a.k.a. nonce.
  27. // This example is used for simplicity in demonstration. A method
  28. // that guarantees uniqueness should be used in a production environment.
  29.  
  30. $nonce = md5(rand());
  31. $created = date("Y-m-d H:i:s");
  32. $combo_string = $nonce . $created . $secret;
  33.  
  34. $sha1_string = sha1($combo_string);
  35.  
  36.  
  37. $password = base64_encode($sha1_string);
  38.  
  39. $headers = '<wsse:Security SOAP-ENV:mustUnderstand="1">
  40.  
  41. <wsse:UsernameToken wsu:Id="User">
  42. <wsse:Username>'.$username.'</wsse:Username>
  43. <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-
  44. 200401-wss-username-token-profile-1.0#PasswordDigest">'.$password.'</
  45. wsse:Password>
  46. <wsse:Nonce>'.$nonce.'</wsse:Nonce>
  47. <wsu:Created>'.$created.'</wsu:Created>
  48. </wsse:UsernameToken>
  49. </wsse:Security>';
  50.  
  51. return $headers;
  52.  
  53. }
  54.  
  55. // Create nuSOAP client
  56. $client = new soapclient(WSDL_DOCUMENT, TRUE);
  57.  
  58. // handle client setup error
  59. if($err = $client->getError()) {
  60. echo "ERROR:".$err."\n";
  61. exit();
  62. }
  63. // call Omniture Web services function
  64. $result = $client->call('Company.GetTokenCount', // function name
  65. array('auth_key' => $username), // parameters
  66. 'http://omniture.com', // namespace
  67. '', // SOAP Action
  68.  
  69. get_header($username, $secret)); // security header
  70. // Display results
  71. echo "RESULTS:\n";
  72. print_r($result);
  73. echo "\n";
  74.  
  75. ?>
Last edited by peter_budo : May 31st, 2008 at 6:37 am. Reason: Keep It Organized - please use [code] tags
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb RSS, Web Services and SOAP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the RSS, Web Services and SOAP Forum

All times are GMT -4. The time now is 3:09 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC