• j4jamshaid
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 6
    Replies
Apex Crypto class have "generateDigest()" method which converts the given String to the Digest according to the given algorithm(MD5 etc). It does not implement the Http Digest Authentication cycle. Different languages provides native support fro Http Digest Authentication, which implements RFC2617. Does Apex have native support for the HTTP Digest Authentication? Or any other alternate to use Http Digest Authentication in Apex code?

--Jamshaid..
Hi All,
         I am getting problems while getting authenticated from a restfull webService. See this link for details  and guide me for its solution.

http://community.salesforce.com/sforce/board/message?board.id=apex&message.id=8508&jump=true#M8508 
http://community.salesforce.com/sforce/board/message?board.id=apex&message.id=8508&jump=true#M8508



thanks
--Jamshaid..



Message Edited by j4jamshaid on 10-08-2008 06:02 AM
HI,
   i am acessing an external webservice using apex class. My external webserices is restful webservice and it uses Digest access authentication. I am acessing it in java and its working fine. I need to access it using apex code. Here is my apex code...


HttpRequest req = new HttpRequest();
req.setEndpoint(serviceEndPoint);
req.setMethod('POST');

req.setBody(xmlFeed);

String myDeveloperAPIKey = 'xxxx';
String username = myDeveloperAPIKey + '%xxxxxuserName';
String password = 'xxxPassword';


Blob headerValue = Crypto.generateDigest('MD5', Blob.valueOf('username:password'));

String authorizationHeader = EncodingUtil.convertToHex(headerValue );

req.setHeader('Authorization',authorizationHeader );
req.setHeader('charset', 'UTF-8');     
req.setHeader('Content-Type', 'application/atom+xml');

Http http = new Http();
HTTPResponse res = http.send(req);

return 'status=' + res.getStatus();



It is returning Status="unAuthorized", where as userName/Pasword/key are all correct. can anybody figure out whats wrong here? or what is missing?...

HI,
       i need to list all campaigns in my salesforce account with their member details. I can do that using Api webserivce in a java desktop client. But i need to build it as an AppExchange application. How do i integrated it into sales force? Or my direction is wrong? Please Guide.

@Jamshaid...
HI,
   i am acessing an external webservice using apex class. My external webserices is restful webservice and it uses Digest access authentication. I am acessing it in java and its working fine. I need to access it using apex code. Here is my apex code...


HttpRequest req = new HttpRequest();
req.setEndpoint(serviceEndPoint);
req.setMethod('POST');

req.setBody(xmlFeed);

String myDeveloperAPIKey = 'xxxx';
String username = myDeveloperAPIKey + '%xxxxxuserName';
String password = 'xxxPassword';


Blob headerValue = Crypto.generateDigest('MD5', Blob.valueOf('username:password'));

String authorizationHeader = EncodingUtil.convertToHex(headerValue );

req.setHeader('Authorization',authorizationHeader );
req.setHeader('charset', 'UTF-8');     
req.setHeader('Content-Type', 'application/atom+xml');

Http http = new Http();
HTTPResponse res = http.send(req);

return 'status=' + res.getStatus();



It is returning Status="unAuthorized", where as userName/Pasword/key are all correct. can anybody figure out whats wrong here? or what is missing?...