I have a scientific model that is typically run by providing it a complex text-based input file. I would like to provide a service endpoint to allow users to instantiate the underlying model. The simplest thing I could do would be to create a RESTful service that lets a user POST the text-based input file to the service. However, if I wanted to hide that input file format from the end user and design an API instead, would it be better to use REST or SOAP? To make this question more concrete, allow me to provide an example of the type of complexity I'm talking about with the input file.
- For a given model run, the user needs to provide one or more "sensors".
- Each "sensor" could be treated as a data type that requires a latitude (float), longitude(float), sensor type (enum).
Using SOAP, I can define an XSD schema that defines:
- a "sensor" type as requiring a latitude (float), longitude (float), and sensor type.
- a "sensor_type" data type that is an ENUM with the appropriate strings as options.
- a "sensor_list" type that mandates 1 or more "sensor" types be provided.
In my eyes, this schema represents a nice way of defining this complexity and guiding the user on how to make a successful request using the subsequent WSDL.
On the other hand, while I am no RESTful web service design expert, it seems like it may be more difficult to properly express this level of complexity. Am I wrong? SOAP services have certainly fallen out of mainstream usage in favor of RESTful services, but I'm wondering whether a SOAP service still makes more sense for use cases like the one I have laid out, or whether I am mistaken and need to learn more about the possibilities with RESTful API design.