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
srcasmsrcasm 

Getting my feet wet with web services

So, I'm just getting my feet wet with web services and there is one thing that I can't seem to figure out. I get how to accept data to my web service as XML but what if I just wanted a string of variables posted? I.e. my web service currently looks like this:

global class TestWebServ {
webService static string getInfo(String info) {
Account a = new Account(name = 'Test Information', description = info);
insert a;
return 'Completed!';
}
}

I would like to send data to this service by simply posting to:

https://address_to_web/service?something=part1&somethingelse=part2&onemorething=part3

Is this possible? Any help would be greatly appreciated.
aalbertaalbert
Check out the Apex HTTP classes: http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_classes_restful_http.htm


srcasmsrcasm
aalbert,
Thank you for the info. I think that I'm looking for the exact opposite functionality. I would like to make a call (from an external app to Salesforce) in that HTTP format. So an outside app would call:

https://na6-api.salesforce.com/services/Soap/class/TestWebService?variable1=test1&variable2=test2

with a request. And SF would take those variables and do something with them.
aalbertaalbert
Sorry, you are correct.

Enabling an Apex Web Service, as your sample does, will enable a SOAP-based web service. Not a RESTful web service.


-Andrew
srcasmsrcasm
Thanks for getting back to me so quick. Are there any methods of doing RESTful web services in SF? If not, have you seen any workarounds for this? I was thinking of maybe using an email service instead.