While exposing apex class as SOAP web service, we declare the class as global and include a method with keyword Webservice and static. However in few scenarios I have seen few instance variable as are too declared with keyword WebService. What are the extra advantages to such variables?

  • 1
    Can you edit your question and define what you mean by the phrases "instance variable" and "string variable as argument". The answer below by @Moshe is correct but we can probably clarify the response by knowing more detail. Even better, if you can add some code to demonstrate which variables you are referring to, that would help very much. – Mark Pond Jun 24 '15 at 20:50

According to the docs : You must use the webService keyword with any member variables that you want to expose as part of a Web service.

You can read more over here : https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_web_services_methods_considerations.htm

  • I went to that doc before posting this question, but I still have a doubt. In one of my Webservice I take String variable as argument and is not defined with WebService keyword, but that is still working. Hence i wanted to know what does " expose as part of Web Service means". – Deep Singhal Jun 24 '15 at 20:34

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.