You need to sign in to do that
Don't have an account?
frasuyet
Session ID to execute Apex Class
Using a C# receiver we currently are executing an Apex class using a user name and password. This is working as planned and the login code segment is below:
Instead of using user credentials, we'd like to execute the same Apex class with the Session id that is being passed in the outbound message. When we make the change to the code segment we are finding that the Apex class does not execute. The login code segment is below:
Are there any omissions in the sesson id code segment (above) that would prevent us from executing the Apex class? Welcome the thoughts and comments.
Code:
SForce.SforceService sfdc = new SForce.SforceService(); SForce.LoginResult lr = sfdc.login("un@acme.com", "passwordU6RQC66T6hpZTuaY960FX3QvS");
Instead of using user credentials, we'd like to execute the same Apex class with the Session id that is being passed in the outbound message. When we make the change to the code segment we are finding that the Apex class does not execute. The login code segment is below:
Code:
String strSessionID = notifications1.SessionId; SForce.LoginResult lr = new LoginResult(); lr.sessionId = strSessionID; lr.serverUrl = https://cs2.salesforce.com/home/home.jsp;
Are there any omissions in the sesson id code segment (above) that would prevent us from executing the Apex class? Welcome the thoughts and comments.
string userid = Session["Usrid"].ToString();
string password = Session["Uspasswd"].ToString();
LoginResult lr = sfdc.login(userid,password);
not getting error when its hardcoded
LoginResult lr = sfdc.login("zzz@zzzz.net", "zzzzzzzzzzzzzzzzzzzzz");
getting error:
UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService
how to fix this.
Message Edited by RajeevKumar on 12-10-2008 10:07 AM
string user = Session["Usrid"].ToString();
string pass = Session["Uspasswd"].ToString();
LoginResult lr = sfdc.login(user.TrimEnd().TrimStart(), pass.TrimEnd().TrimStart());
Hi SimonF,
I did tried what you mentioned "just setting the sessionHeader on the apex stub, and not changing the URL at all."; but it did not work and my try/catch get no exceptions. Any working "HelloWorld" sample?
(I did my .NET Outbound receiver, strightly following the "OM Sample" [upon receiving a message, call an APEX class]; it works fine with using name/pws to log in, but not working swap to use SessionID.)
Thanks,
StanleyH