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
Dinesh KhandelwalDinesh Khandelwal 

How to access SOAP header in my webservice class

Hi,

I want to create and host a webservice on salesforce and same will be used by one of our back end system. Basically this is done and working fine also. But now we have a new requirement where back end system will send a security key in header of SOAP msg and I want to access that. Can some one tell me is it feasible? Can we do that?

Dinesh
logontokartiklogontokartik
I dont think you can. When you create a Webservice in Salesforce and generate a SOAP WSDL for the client, it auto generates the Security headers for you. Since Salesforce takes care of Authentication, you would not be able to change it, all you can do is maybe create another additional layer of security in your Webservice Class to accept key as a variable that you can validate. 

Hope this helps.

https://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#CSHID=apex_web_services.htm|StartTopic=Content%2Fapex_web_services.htm|SkinName=webhelp