function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

login() method trouble



I created a webservice in apex, then created wsdl and then created stub classes in apex.

Now i m creating a class in which a method with @future annotation is defined.From in this method i m trying to invoke

webservice method, but i got exception.


exception: Callout failed: unsupported sessionId.................................


Then i realised that i m not doing login in salesforce.Now the problem is how to use login() method in apex.

However i searched many example of login(),but in those examples login() method used in java not in apex.


I would appriciate, if anyone can help me .




Sorry if I've misunderstood this but what I think you are saying is:


You have a WebService on your SFDC org


You are then trying to call that webservice from within the same org?


Can you confirm my understand of the problem is correct?


Additionally there is also a very good reason that you can't find any apex implementation of the login method because if you are running apex, you are already logged in!




Thanks for reply, you are right,i am trying to call webservice from within the same org.

But when i invoke this method, i get some callout failed:...... exception.Some one told me that i have to ligin first.





Why would you want to go through a web service to call apex code in the same org? just call the apex code directly.