0

I am new in REST world, an in most of CXF examples that I saw there is an configuration to expose WADL in REST services when published.

Something like

Available RESTful services:
Endpoint address: http://localhost:8080/ouat-servicesImpl/api
WADL : http://localhost:8080/ouat-servicesImpl/api?_wadl

Then, when clicked

<application>
  <grammars/>
  <resources base="http://localhost:8080/ouat-servicesImpl/api">
    <resource path="/topics">
      <method name="POST">
        <request>
          <representation mediaType="application/json"/>
        </request>
        <response>
          <representation mediaType="application/json"/>
        </response>
      </method>
    </resource>
  </resources>
</application>

I was learning RAML and its benefits in contract creation. Is there any way to expose RAML contract in this CXF "home" service page? Or am I mixing the concepts/ purpose of RAML and WADL? Actually I think both are ways to expose services contract, however in my opinion RAML is more complete

arthurfnsc
  • 915
  • 3
  • 13
  • 30
  • 2
    Both describes the contract. But RAML is getting popular these days. WADL was a failure as I know. – Manmay Jun 05 '15 at 14:30
  • Yes, this is exactly what I am hearing. Do you know if there is some way to expose this RAML contract when the service is expose with CXF? – arthurfnsc Jun 05 '15 at 14:34
  • You can expose your RAML file with an URL, just like WSDL. You can also take a look at at swagger, which also supports RAML. Swagger provides a UI to discover, document and test your REST endpoints. – Manmay Jun 08 '15 at 08:03
  • I will take a look at Swagger... thanks @Manmay – arthurfnsc Jun 09 '15 at 15:19
  • "however in my opinion RAML is more complete" Actually, RAML is less complete *BY DESIGN*. RAML was intentionally created to specify "practically" RESTful designs because in reality almost nobody who is doing "REST" is actually doing REST. If RAML could only specify actually RESTful services, nobody would be able to adopt it for existing projects. This isn't meant to be a dig at RAML, the authors explain all this in the documentation. It was a carefully considered design decision. – Steven Byks Apr 06 '16 at 17:11

1 Answers1

2

Assuming you package your CXF service as a WAR, here is how you can achieve your goal, based on a real project I'm working on:

Bonus point for:

David Dossot
  • 33,403
  • 4
  • 38
  • 72