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
_LSDsl__LSDsl_ 

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? 

 

 

 

 

 

 

Message Edited by _LSDsl_ on 05-15-2009 07:58 AM
Ron HessRon Hess

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