You need to sign in to do that
Don't have an account?
Session and SessionHeaderValue ASP.Net
public SforceService binding = new SforceService();
void function1()
{
//execute the login placing the results
//in a LoginResult object
sforce.LoginResult loginResult = binding.login(userName,password);
//set the session id header for subsequent calls
binding.SessionHeaderValue = new sforce.SessionHeader();
binding.SessionHeaderValue.sessionId = loginResult.sessionId;
//reset the endpoint url to that returned from login
binding.Url = loginResult.serverUrl;
}
void function2()
{
if I want to do an API call here, it will through an NullRef Exception. Its because the SessionHeaderValue is empty or something to do with the Session Header. But I have already logged in to the system. For every API call do I have to write the SessionHeader ?
}
I think you can store that information in Session variables in .net and just reference it when you need to. If you are going from page to page, you would have to enable sessionstate to keep those variables. If you are doing everything within one page, it should be keeping the values automatically.
zero1578,
Thank you for the post!
I have been tasked with integrating our ERP system with SFDC. Details are found in this post.
Your code has made me think that there is something I don't understand and I am hoping that you can help me with it.
How does your code example acquire the SessionID from SFDC? Did you create a web-service to receive the response which contains the SessionID? or will just using the WSDL as a web-reference (in Visual Studio) enable this communication?
Thanks!
So by using the WSDL the API calls to SF return values, without a seperate Web-Service to handle the responses from SF. That's fantastic!
I wish that were documented somewhere, although I expect that if I were more of a programmer I would have understood that already.
I'll post a follow-up if I have any problems and update my other posts, thank you for the assistance!
Synchronous—Once the API call is invoked, your client application waits until it receives a response from the service. Asynchronous calls are not supported.
That statement is in the Call Basics section. Is there a way around that prohibition?