While writing javascript code it is the most fundamental question. Both ways are capable of CRUD operations, so what is the difference?
Recently I’ve written some code to retrieve only one flag from opportunity entity at JS. Beside that JS entity had registered plugin at PreRetrieve.
Of course in plugin code I was checking if DEPTH > 1 and do nothing then. While debugging plugin execution I was so frustrated because plugin was fired at accidental moments.
It occurred that SAOP retrieve query also fires plugin execution.
SOAP:
- uses LogicalName
- synchronous operations
- invokes plugin and workflow with depth = 1
- big XML structure
- slow
REST:
- use DataSets and SchemaName
- synchronous and asynchronous operations
- no interaction with plugin or workflow
- quick
Private conclusion: If you want quick, also asynchronous operations, and no interaction with plugins or workflows is needed use REST operations.