• asgirisoft
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 5
    Replies

Hi all,

   This one puzzles me..plain and simple, the code works but I'm getting null for UserInfo.getSessionId(). Someone tell me why?! :robotmad: Thanks. 

public class AccountUpdater {

//Future annotation to mark the method as async.
@Future(callout=true)
public static void updateAccount(String id, String name) {

//construct an HTTP request
HttpRequest req = new HttpRequest();
User currentUser = [select ServerURL__c from User where id = :UserInfo.getUserId()];
req.setEndpoint('https://example.com/dbaccess/connect.php?sessionid=' + UserInfo.getSessionId() +
'&serverurl=' + currentUser.ServerURL__c + '&module=test&id=' + id);
req.setMethod('GET');

//send the request
Http http = new Http();
HttpResponse res = http.send(req);

//check the response
if (res.getStatusCode() == 200) {
//update account
Account acc = new Account(Id=id);
acc.Description = res.getBody();
update acc;
} else {
System.debug('Callout failed: ' + res);
}
}
}

 

 

Hi,

 

I've seen that the topic of sites authentication has been discussed at some length in another thread in this forum.  Can someone confirm for me, however, that if I wanted to implement authentication aside from customer portal, I'd have to roll it more or less (or completely?) from scratch myself?

 

If so, are there any 3rd party libraries/AppExchange apps/Apex classes that facilitate that?  For example, session management (for sites), password hashing, checking for authentication bypass, etc...

 

Any insights are most welcome...

 

Thanks  in advance,

 

Alex

 

Is there a way to invoke Apex Class Web Service from workflow message action (SOAP)?

We built a simple APEX class and we would like to call that class from workflow message action passing URL Endpoint and Sessiond ID.
We receive this error from the message queue: "INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session"

Apex class is very simple for testing purpose:

global class HelloWorld2 {
 WebService static void sayHelloWorld(String arg)
{
Lead lead;
lead = new Lead();
lead.firstname = 'Name name';
lead.lastname = 'Surname';

insert lead;
}

}

Endpoint for workflow message action setup is:
https://na4-api.salesforce.com/services/Soap/class/HelloWorld2

Any help about that?

Folks,

Anyone know why I would be getting an Invalid Session error when I try to call a javascript function from an onclick event in the my Visualforce page.  The javascript function has a data call using the sforce.connection.query syntax.  Everytime I test fire my onclick event, I get a popup error on my VF page stating that the Invalid session...Illegal session and some other text....

Any help is greatly appreciated...

Thanks
At Dreamforce, I thought I saw an example in which a SOQL dataset was instantiated directly from within the value="..." element of an apex: container such as apex:dataTable, ie

Code:
<apex:pageBlockList var="myItem" value="!{[Select ID, Name From...]}">

but now that I'm searching for it I can't find anything like this. Is it possible? Is there some functionality like it that I may be confusing it with?

Thanks,
Lindsay