I am getting SessionID invalid after taking session id from visualforce page using {!$Api.Session_ID}

I am getting the below response from workbench Element {https://soap.sforce.com/schemas/class/SoapWebservice_BookPlanner}SessionID invalid at this location

enter image description here

enter image description here

  • 1
    That appears to be a SOAP error, not an indication that the Session ID itself is invalid. Could you please share more context and/or code? – David Reed Dec 31 '18 at 17:50
  • My request <?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope xmlns:soapenv="schemas.xmlsoap.org/soap/envelope" xmlns:amit="soap.sforce.com/schemas/class/SoapWebservice_BookPlanner"> <soapenv:Header> <amit:SessionHeader> <amit:SessionID>...Session ID...</amit:SessionID> </amit:SessionHeader> </soapenv:Header> <soapenv:Body> <amit:createBook> <amit:BookName>SoapBook1</amit:BookName> </amit:createBook> </soapenv:Body> </soapenv:Envelope> – L2018 Dec 31 '18 at 17:51
  • 1
    Please edit your question rather than posting code in comments. – David Reed Dec 31 '18 at 17:52
  • check screenshot.Anything else you need let me know @David Reed – L2018 Dec 31 '18 at 18:09
  • 2
    I don't personally know the answer to this question. We generally encourage you to post code and verbatim error messages in the body of your question. Screenshots are harder to use to interpret code issues. – David Reed Dec 31 '18 at 18:13

It appears that the element needs to be sessionId, not SessionID as you've written here. Pay attention when working with raw XML, as everything is case sensitive.

See this question for an example SOAP message.

  • Now sessionId isssue has gone.But I am getting the below issue in response <faultstring>No operation available for request {soap.sforce.com/schemas/class/SoapWebservice_BookPlanner}createBook</faultstring> – L2018 Jan 1 '19 at 6:27
  • @L2018 Try using SoapUI or another tool to generate a correct request. You would save yourself a lot of trouble. I suspect you may need a <amit:data> element to wrap your parameter. If you try SoapUI and still get stuck, please post a new question instead of editing an existing question. Also, next time, please use plain text code instead of a picture. It makes it a lot more challenging to work with. – sfdcfox Jan 1 '19 at 7:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.