You need to sign in to do that
Don't have an account?
INVALID_SESSION_ID
I try to call apex web service from Visualforce page and get this error (INVALID_SESSION_ID)
apex class :
global class AjaxServices {
WebService static void sendEmail(id attId, String email){
String[] toAddresses = new String[] {email};
Attachment att=[select id, name, Body from Attachment where id=:attId];
Blob ioPdf = att.Body;
Utils.sendEmail('Quote', 'Your quote', ioPdf, 'Quote.pdf', toAddresses, null);
}}
and Ajax call from VF page:
sforce.apex.execute("AjaxServices","sendEmail",{attId:id, email:email});
in debuf window I see:
Request: server- /services/Soap/package/AjaxServices
<se:Envelope xmlns:se="http://schemas.xmlsoap.org/soap/envelope/"><se:Header xmlns:sfns="http://soap.sforce.com/schemas/package/AjaxServices"/><se:Body><sendEmail xmlns="http://soap.sforce.com/schemas/package/AjaxServices"><attId>00PR0000000NlhjMAC</attId><email>sss@sss.sss</email></sendEmail></se:Body></se:Envelope>
Response : status - 500
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="http://soap.sforce.com/schemas/package/AjaxServices"><soapenv:Body><soapenv:Fault><faultcode>sf:INVALID_SESSION_ID</faultcode><faultstring>INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session</faultstring></soapenv:Fault></soapenv:Body></soapenv:Envelope>
Where is problem?
you are probably missing the session id that is required by the ajax toolkit.
see this thread
http://community.salesforce.com/sforce/board/message?board.id=Visualforce&message.id=12349&query.id=178299#M12349