You need to sign in to do that
Don't have an account?
Webservice callout error: Invalid Session ID found in SessionHeader
Hi All,
I am a newbie to webservice. So just tried to create my first webservice.
I created the helloworld webservice class in one salesforce instance. I generated wsdl file from that.
I parsed this wsdl file to generate an apex class in another salesforce instance. I wrote a trigger and called an apex class
In the apex class I called the stub class of the parsed apex class. But I am getting the following error:
System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session faultcode=sf:INVALID_SESSION_ID faultactor=
Following is the code of my apex class:
public class testwebser{ @future(callout=true) public static void webmethod(Id aa){ String strAuthorizationHeader, strUserName,strPassword; Blob blbHeaderValue; soapSforceComSchemasClassHelloworld.HelloWorldWebService hwb = new soapSforceComSchemasClassHelloworld.HelloWorldWebService(); soapSforceComSchemasClassHelloworld.SessionHeader_element objSession = new soapSforceComSchemasClassHelloworld.SessionHeader_element(); strUserName = 'arvind.rao1@wipro.com.dev'; strPassword = 'hijacker56UF0IfKl12C9S1Jj9KY5uPMp'; blbHeaderValue = Blob.valueOf(strUserName + ':' + strPassword); strAuthorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(blbHeaderValue); hwb.inputHttpHeaders_x = new Map<String,String>(); system.debug('header'+strAuthorizationHeader); hwb.inputHttpHeaders_x.put('Authorization', strAuthorizationHeader); hwb.inputHttpHeaders_x.put('myHeader','myValue'); hwb.SessionHeader =new soapSforceComSchemasClassHelloworld.SessionHeader_element(); String x=hwb.sayHello('hhhh'); System.debug('testing'+x); } }
I am not able to understand what am I missing here.
Any suggestion will be of a great help.
Thanks
Arvind
Hi,
I am also facing the same problem...please help me out. how to set the session id for session header.
Thanks