Almost all service development must now be accompanied by its mobile version (more than 1 billion people own a smartphone today).
The concept of REST services with is now widespread, based on HTTP protocol and supports two message formats: XML and JSON.
JSON has a major advantage for mobility: its lightness.
Indeed, this format is certainly less human readable as XML but this is much less « polluted » (by tags that could be described as superficial). Generally, to transfer the same data, JSON is on average 30% lighter than XML.
Moreover, if you have a NoSQL database in your back-end, using JSON can be more natural because most databases use JSON store, including Oracle NoSQL Database with Avro Schemas.
This is a format all-in-fact suitable for mobility because it preserves the maximum bandwidth (valuable in poorly covered areas at the network level), and thus guarantees an optimal speed for data transfer.
Here are the steps to expose a service as REST service:
- In your composite, right click on your service and choose « Expose As REST »:
- Then customize your REST binding:
- You can customize your operations by choosing among the four basic REST HTTP operations (GET, PUT, POST, DELETE):
- If you need only a part of the parameters, you can select useless parameters et then click on « Delete »:
- Now you only have your chosen parameters:
- Go to the « Response » tab, you can allow both XML and/or JSON possible message formats:
- Concerning the payload format, for both message format you can even check if the payload looks like what you expect (if it is in line with the XSD of your service):
- Finally you can validate the REST binding creation:
- SOA engine will generate the REST proxy:
It’s done!
Your service is now exposed as a REST service. Your customers can enjoy it 🙂