You need to sign in to do that
Don't have an account?

How to make soap call properly
I have 2 org ad I want to provide making calls from one 1 org to another
I have allredy generated wsdl file for my soap webservice
Original class simply looks like
global class SoapTest { webservice static String getGreeting() { return 'Hi, pal!'; } }
My external call now loooks like:
soapTestParse.SoapTest sp = new soapTestParse.SoapTest(); String output = sp.getGreeting(); System.debug(output);
as a result I'mI getting
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=
I have been reading bunch of posts with the same problem but I still don't know the proper way to solve it
I saw such snippets of code
in developer guide:
stub.inputHttpHeaders_x.put('Authorization', 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==');
but How can I dynamically get this token? Even if I hard code session id of target org, error remains the same.
In another poste
partnerSoapSforceCom.LoginResult partnerLoginResult = myPartnerSoap.login('karnashiva@cognizant.com.dev', 'Password123'); soapSforceComSchemasClassAccountins.SessionHeader_element webserviceSessionHeader = new soapSforceComSchemasClassAccountins.SessionHeader_element(); webserviceSessionHeader.sessionId = partnerLoginResult.sessionId;
I don't have neither login method no loginresult class in my generated from wsdl apex class
In another poste
ws.inputHttpHeaders_x = new Map <String, String>(); String b64_string = EncodingUtil.base64Encode(Blob.valueOf('<user_name>:<password>')); ws.inputHttpHeaders_x.put('Authorization', 'Basic ' + b64_string);it still doesn't work
Can someone help, or give some tips or proper examples of soap callouts?
So you would likely make the same login call from the first two lines against the Partner API and they create the same SessionHeader_element for your soapTestParse.SoapTest instance.
All Answers
Any time that you are connecting from one SFDC org to another, you have to authenticate first. OAuth is easiest to implement. See https://help.salesforce.com/HTViewHelpDoc?id=remoteaccess_authenticate.htm for help on OAuth. OAuth will send back an access_token that you can use for subsequent calls into the connected org in the http header.
Hope that helps.
So you would likely make the same login call from the first two lines against the Partner API and they create the same SessionHeader_element for your soapTestParse.SoapTest instance.
Apex Generation Failed
Unsupported schema type: {http://www.w3.org/2001/XMLSchema}anyType
Another alternative is to just make the requried API calls directly with an HTTP Post.