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
Sapthagiri ReddySapthagiri Reddy 

Salesforce Web Service Execution

Hi,

There is a requirement wherein, I need to have a connection established between Salesforce and AS400. The AS400 developers will be providing us with web services and similarly, I need to provide web services (RESTful) to them to have the connection built.

Me being new to web service, I am little confused about where to start in order to execute Salesforce web services (RESTful).

Could anyone help me in this regard.
Prafull G.Prafull G.
When AS400 team provide web service wsdl file to you, you have to create stub in salesforce using "Generate From WSDL" button on classes page. This will create class that you have to use when making a call to AS400 services.

On other hand, You have to create REST web service that you will expose to AS400 team. Please read the following link
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_rest.htm

Let me know if this make sense!
Sapthagiri ReddySapthagiri Reddy
Well, like I said earlier, I am not that familier with web services. At the moment, I would like to implement a test web serivce which can bring out some data from Salesforce objects and display them as json format. And moreover, how do I execute this service, like what parameters do I need to pass (username, password, any token key, etc) and in which manner to pass. 
Prafull G.Prafull G.
The URL in above post does not have example code so you can have a look at
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_rest_code_sample_basic.htm
Sapthagiri ReddySapthagiri Reddy
In the following URL (http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_rest_code_sample_basic.htm) that you have provided, there are few parameters like SssionId, ServiceURL. What need to be passed in them. How do I get these Id prior to the web service call.
harsha__charsha__c
Web services are pretty simple and no need to worry about the REST concepts.

Web service in APEX(to connect salesforce from other applications):
It is a normal apex class with the global access specifier and webserice keyword. This webserice keyword makes our apex class visible/accessible globally from any application(with the help of WSDL generated from it)

Web service in external applications(to connect salesforce with other applications):
Here we get an WSDL from the third party application and we get apex classes generated from it by the help of "Generate from WSDL" button and the respective classes get generated in salesforce by that. Now again same procedure, just call the methods of the classes, those generated from WSDL by passing required parameters.


Just treat them as normal apex classes and nothing complex from them.

Regards,
- Harsha.


Sapthagiri ReddySapthagiri Reddy

Let me make myself more clear.

The other party had sent me a url link, which when pasted in a browser url (by passing the parameters), it returns an output in JSON format. For example: the url would be like : " https://www.test.com/services/test.php?username=xxxx&password=**** ".

Similarly, if I needed to give the other party a url to the salesforce service, how could I be doing that. I could execute a service using cURL command line. curl -H "Authorization: Bearer sessionId" "https://instance.salesforce.com/services/apexrest/Account/accountId"

And I can't be sending this cURL for the other party, rather I am supposed to send  a URL link. So, how can I generate that url?

Sapthagiri ReddySapthagiri Reddy
Like what would I need to provide the other party to run/call the web service. I have got the idea on creating web service class but unable to guide to external application developer on this.