Restful service in .NET with WADL instead of WSDL

2019-04-07 01:15发布

I used WCF to create a restful web service in .NET, by means of a .svc file. The web application automatically produces a WSDL file. AFAIK, the WADL is more natural for a restful web service.

How could I create a restful service in .NET (preferably with wcf) that produces a WADL description?

Note An answer like "RTFM" is accepted, as long as you indicate a suitable manual/tutorial.

3条回答
We Are One
2楼-- · 2019-04-07 02:07

This is an old question but having consumed restful services with WADLs they do offer some value. You can import them straight into SOAPUI and it will build a test suite for you automatically. Secondly they tend to contains all the required XSDs for XML based services and are useful for automatically building serialisable classes that your endpoints accept and receive.

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-04-07 02:09

Forgive me for answering a question with a question, but do you really want to do REST? REST really has no need for things like WADL.


Update:

The "hypermedia constraint" (aka HATEOAS) dictates that the user agent discovers content based on links embedded in previously retrieved content. It really is unnecessary to have a separate document that describes all the available content.

Imagine using a web browser to go to a site and instead of going to the home page and navigating from there, you are presented with a page which is a list of all the URLs on the site. You must then looks through the list of available urls, choose the one you are interested in and copy it into the address bar.
WADL is effectively you list of site urls. You just don't need it if your main content is linked together.

Linking content instead of using a WADL "site map" has other advantages. The available links can be dynamic based on particular data values in the content. This capability can vastly reduce the complexity of clients, because the client no longer needs to host the logic to decide when it is allowed to follow a link.

查看更多
贼婆χ
4楼-- · 2019-04-07 02:10

Looks like REST Describe & Compile should do the trick.

On the WADL developer site Marc Hadley maintains a command line tool named WADL2Java. The ambitious goal of REST Describe & Compile is to provide sort of WADL2Anything. So what REST Describe & Compile does is that it:

  • Generates new WADL files in a completely interactive way.
  • Lets you upload and edit existing WADL files.
  • Allows you to compile WADL files to source code in various programming languages.
查看更多
登录 后发表回答