Can anyone give sample usecases that best suits for integration using SOAP and REST APIs? Because i am bit confused over selecting SOAP or REST for the integration between SFDC and SAP. Any Expert advice would be much helpful.
At this point, I believe the SOAP and Rest api's are pretty much at parity -- there are few things that are only available to one or the other.
That said then, I think the best "use case" question for one over the other has less to do with the intended use case, and more to do with two other factors:
- Development language used to build the integration
- Developer familiarity / comfort level.
In other words, if you're a long time c# dev with lots of experience with auto-generated code created by Visual Studio when you hand it a WSDL, then by all means use the SOAP api. On the other hand, if you're a longtime Ruby dev, who's experience lies with REST apis, then you should use the Rest api. The one exception to that is this: if you're developing an integration with a well maintained, high-functioning integration library readily available for your chosen language, use that library. For instance, Php has the PHPToolkit(Soap Based); Ruby has RestForce/MetaForce(Rest based); and there's a new C# toolkit(Uh, no idea what it's based on) by Wade Wegner @salesforce. If you're using a language that has such a toolkit -- default to using that. The Rest api is "Rest-like" but not fully Restful (ie: there's a separate query resource outside of the individual object resources) and these wrappers will provide you a consistent, developer friendly experience for either Api.
: I believe there are still one or two things the soap API can do that the REST api cannot, such as manipulate permission sets, but please keep in mind that I've not extensively researched the state of the two api's today just to answer this question. I'm working off of knowledge from the last time I had to use SOAP. I generally use REST.
Depending on your number of API callouts as well I would recommend possibly using the Streaming API. To determine if this is the best approach I would look at the amount of calls you'll be using back and forth. Also with the Streaming API, you'll have the best chance of getting as close as possible real time data without having to do polling requests / pushing from triggers. There are some issues with Salesforce in the order of execution when making callouts. Of course callouts come with their limitations which can include length of time it takes to process records since it will need to wait for a response, and having to do a async method to make your callouts which are limited as well. This is the remaining list of callout limitations