+ Start a Discussion

webservice login issues

I created an apex class and I downloaded the wsdl for that class. I also have downloaded the wsdl for the sandbox. I try to access this class in c# and I am getting an invalid login session error. I am guessing this is beause I am loging into the sandbox instead of the webservice class, but I dont see that I can login using the webservice class?? Is there a way to add loggin ability to the webservice class? Does this make sense?


So basically I dont really need to login into the sandbox, I just need to login into this webservice class I created in the sandbox but there doesnt seem to be a way?




Apex class 

global class CorePattern

WebService static string GetPattern(string penSerNbr, string shelfSize)
return '';
 System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapHeaderException: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

You use the regular partner or enterprise APIs to do login.
I think that is what I am trying to do when I get the error.. There are 2 different webservices, one for the sandbox which I log into and one for the webservice class I made. The class isnt exposed in the sandbox which I think is why I get the session error. It logs into the sandbox fine, but when I try to access the webservice for the class it errors..

We developed a webservice call that has been working without issue for months.  Yesterday, we refreshed our sandbox and the server changed from cs3 to cs12.  Now we are getting an invalid session ID error between the user logon and the webservice call.


It appears that the Guest User is maintaining a relationship to the old sandbox server.


SalesforceProxy.ServiceApi.Url: https://cs12-api.salesforce.com/services/Soap/c/25.0/00DV00000051oGh/0DFQ00000004DxE


SalesforceProxy.AuthenticateCscUser.Url: https://cs3-api.salesforce.com/services/Soap/class/LoginHandler


Any suggestions?


The custom apex web service has a hard coded reference to the instance when the WSDL was generated. you'll need to either get a new WSDL, or update your code to dynamically set the host name from the loginResult details.