Describing ORDS RESTful Services using a WADL
Recently I got this question (or better specification) from a customer:
"For exchanging data, we either want a SOAP webservice or a REST service offering a WADL".
WADL?
What's a WADL? I know WSDLs as descriptive endpoints for SOAP webservices, but WADL?! It occurs, that WADL's are intended to do just that, but in a more generic way. WADL stand for Web Application Description Language. The World Wide Web Consortium (W3C) currently has no plans to implement WADL as a standard. Oracle's ORDS is going the swagger/openapi route which is partially implemented in the 17.3 release.
With no existing functionality to provide a WADL for Oracle RESTful services, I had to come up with my own solution, using the APEX repository views to generate a WADL endpoint. I came up with a small procedure for this and add an additional URI Template to my service, called "wadl" with a single GET Resource Handler calling this procedure.
WADL endpoint in APEX RESTful definition |
Import a WADL in SoapUI |
Give it a go. You can reach it here: https://apex.oracle.com/pls/apex/fifapex/hr/wadl/
RESTful Module oracle.example.hr in SoapUI from imported with generated WADL |
Naughty APEX RESTful service definitions
I tested the generated WADL with SoapUI, and the program does show all the handlers defined including all parameters. Unfortunately, a WADL is somewhat stricter then an APEX RESTful service definition when it comes to case-sensitivity. Parameters have to case-match the resource path definition, which wasn't the case in the oracle.example.hr RESTful example. The 5.1 example has one definition per resource/URI template. In earlier version, I have seen multiple definitions with the same URI resource path (for example employees/{id}), and in the APEX RESTful repository, parameters are always stored as child records of a resource handler (PUT, GET, …), while parameters can either be on resource template level or on handler level. Makes sense, as the {param} part of the path belongs to the resource, but you might want to pass some HTTP header parameters with the PUT request for a resource only, while the GET just needs the resource parameter. Not all parameters from the resource paths were defined as parameters in the resource handlers, so I had to add those. I provided an export of the "corrected" example RESTful service on the GitHub project of my WADL generator procedure.
Contribute
Well, I have a reasonably well working WADL generator for Oracle ORDS/APEX RESTful services now. It sure needs improvement for other cases, I bet. So, if you need to provide a WADL for your RESTful service in APEX, get the code from my GitHub project. If you have enhancements, please contribute to the code.
Comments
Post a Comment