1

I am new to web services in Java.

In SOAP web services, we have wsdl that tells us about the services like the operations etc. but in REST, we don't get wsdl.

So, my question is if someone wants to know the service details, then how that can be found in case of REST web services.

2 Answers 2

2

SOAP introduced WSDL to describe services, which can automatically be discovered and integrated with a mechanisms like UDDI. In reality SOAP is used just as hardcoded RPCs. If you use REST, many details like exceptionhandling, operation types, idempotency are handled using well known HTTP mechanisms. The only thing you need to know is the payload encoding. If you use XML, you may use XSDs to describe the services, if you use JSON you need to handle this on your own (its a lot simpler). The structure of your URLs should be designed so its intuitive enough, to be described in a one paged readme file. To cut a long answer short: WebServices were so complicated you need a lot of boilerplating, REST services should be so simple, that a developr does not have to redefine and redocument the basics.

2

With REST there is no single established way to achieve this yet, however there are couple of options emerging:

5
  • 1
    Technically you are right on the spot - I upped your answer - I am convinced that there are justified use cases for this. But from a philosophical stand-point these frameworks are reintroducing concepts, which the designers tried to keep out of REST.
    – Stefan
    Dec 10, 2012 at 8:32
  • For me the use case is developer documentation. A REST api, no matter how intuitive, needs documentation to be useful and these frameworks provide a standard to document your REST apis.
    – theon
    Dec 10, 2012 at 9:05
  • 1
    Of course you do. But this can be a table with URL structure and one line description. Another idea would be to parse the REST Server Classes Source which contain the Jersey Annotations and generate a documentation out of this. Would be a nifty little Open Source Project for a maven module. Want to tackle it?
    – Stefan
    Dec 10, 2012 at 9:11
  • 1
    +1 I agree - why write this documentation by hand - it should be automated. That's what Swagger does :) It parses source code for a number of web frameworks JAX-RS, Spring, Play2 and generates the end user documentation. It is just good to have a standard format to have this documentation in and this is what the above projects are trying to achieve. If you just want a description and uri as you documentation, swagger will parse two annotations in your source code and turn that into some end user html based documentation.
    – theon
    Dec 10, 2012 at 11:23
  • +1 excuse my ignorance. I thought swagger was like JSON Home and WADL rendering machine readable service descriptions. Its a matter of weeks until I will sue Swagger now - thanks!
    – Stefan
    Dec 10, 2012 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.