You need to sign in to do that
Don't have an account?
clouddev@surashri
Apex Methods as SOAP Web Services
Hi,
I am currently reading on "Apex Methods as SOAP Web Services". After reading apex documents and material on net. I could manage to gather logical steps given below to use apex method as SOAP web service.
- Write a public class and a static webservice(keyword) method. This will be exposed as web service method because of webservice keyword.
- Generate a WSDL file for above class.
- Also generate Enterprise WSDL file(??) I am not sure the exact use of this file.
- Consume both files in any of the languages like C#, .NET, PHP etc.
- This will generate appropriate code in one of these languages.
- Write a code with username,password authentication to call webservice method written in step 1.(??) Are there a standard steps available to call this method (Similar to SQL cursor)?
- Run Test to check correct results.
Can someone please correct me if I am wrong in putting above steps? Also explain why we need this enterprise WSDL and query asked in Step 6?
If some one can send a working example to try, It will help a lot.
Thanks,
clouddev
Thanks to all for your valuable contribution.
clouddev
All Answers
For authentication we use login operation which is present in enterprise wsdl.
We know that WSDL consists of <portType> element which will have all the operations you can perform.
Hi Cherrlin,
Could you please confirm the steps I mentioned are logical? Also reply to my other questions.
Thanks for your reply,
clouddev.
In regards to step 3, you have to use sforce.login() to actually log in to salesforce before you can consume a web service function. This is why you need the Enterprise WSDL file. In any given language, the steps will look something like this:
Note that I'm not including any specific error handling or so on, as this is only to illustrate the general steps. In the example above, Sforce is the class introduced by the Enterprise WSDL, and MyWebService is the class introduced by your Apex Code's WSDL. You will need to refer to your development environment's specific resources (e.g. the Solution or Project tree) to see which functions are available to you, and the proper names to use for the client functions.
Thanks to all for your valuable contribution.
clouddev