text: First time here? Check out the FAQ!
  Hi all
  Now i'm using Axon ivy 6.3. In my project, i have created an Restful API following the OpenAPI Specification
  Now i want to use Swagger to generate YAML file from those API (follow this guideline and this post).
  Here is my web.xml
  and this is my Servlet:
  public class ApiScanner extends HttpServlet {
  private static final long serialVersionUID = -4192689550210212169L;
  @Override
  public void init(ServletConfig config) throws ServletException {
  super.init(config);
  BeanConfig beanConfig = new BeanConfig();
  beanConfig.setVersion("1.0.0");
  beanConfig.setSchemes(new String[]{"http"});
  beanConfig.setHost("localhost:8081");
  beanConfig.setBasePath("/ivy/api/designer");
  beanConfig.setResourcePackage("ch.axonivy.fintech.mybank.website.dossier.api");
  beanConfig.setScan(true);
  }
  }
  But nothing happen after i restart ivy.
  Has anybody tried it before?
  Thanks
  asked
  01.09 at 07:02
  trungdv
  300●30●56●62
  accept rate:
  52%
  edited
  05.09 at 05:48
  I think approaches that rely on classpath scanning will never work out of the box with ivyProjects. As the class hierarchy is not accessible as in standard webApplication-contexts.
  But I think you could reach your goal if you generate the swagger resources with the maven plugin:
  An alternative approach to document REST services, that work out of the box with Axon.ivy, is the WADL descriptor. Every resource can send an XML similiar to WSDL if you fire an 'OPTIONS' request against it. Here is a sample from our ConnectivityDemos:
  Maybe you could convert the WADL automatically into a Swagger2 descriptor:
  hi @Reguel Werme... ♦♦
  I've tried with maven plugon but it does not work. still got no clue.
  May by i'll try with WSDL.
  Thanks a lot
  With second way, can i get WADL from webservice by URL (not use postman)? I've tried some example but it can work with ivy rest api.
  thanks
  The trick is to send the correct accept media type. Postman implicitly sends accept(*) so that WADL is accepted as response. You can explicitly do that like this: Ivy.rest().client("myService").request().accept("application/vnd.sun.wadl+xml").options();
  Ivy.rest().client("myService").request().accept("application/vnd.sun.wadl+xml").options();
  hi @Reguel Werme... ♦♦
  Thanks for your support, i can use WADL but somehow the specification from there it's not very in detail like Swagger can do. It just give me the overview of API but lack of data type for complex object, description of field,...Like in your example, i don't see how many field in object person. but swagger i can see it. Or i miss something?
  yep that is the current state. there are no details available how a complex payload (like the person) looks like. and I agree that a swagger service descriptor would be much more state of the art. but WADL is what we have now by default without any effort.
  But I'm pretty certain that it would be possible to configure the swagger maven plugin to do the job.
  hi @Reguel Werme... ♦♦
  yes i can make it work within ivy now. It's because after ivy compile, all *.java will be put to <project>/classes, instead of <project>/target/classes. So what i have to do is copy it to rightplace and plugin can run. But somehow it's can't resolve dependency of icy modals.
  yes the ivy artifacts are not available with plain maven. because they are p2 bundles and there is no public maven repository that contains them. There are various workaround for it. You could for instance add them manually as POM.xml dependencies with scope 'system'. But that only could if you require just a few bundles - and not the whole engine.
  If your setup works, even if just partly, I'd really love to see you sharing a complete example project.
  It would also give us in the core team an idea how we could better support or demonstrate the use of swagger out of the box.
  hi @Reguel Werme... ♦♦
  yes, i'm gonna share this. i will send you link later. it work on my project now
  Once you sign in you will be able to subscribe for any updates here
  Answers
  Answers and Comments
  Markdown Basics
  learn more about Markdown
  rest ×12
  openapi ×1
  swagger ×1
  Asked: 01.09 at 07:02
  Seen: 52 times
  Last updated: 08.09 at 07:25
  Can I expose api as REST service?
  REST service security
  Is it possible to access Ivy's RESTful API from an HtmlDialog or within the same session?
  Ajax call from HTML Dialog to consume Web Service and REST Service
  Axon ivy mobile experience
  How can I analyze the root cause of my failing REST webservice call?
  Calling REST Webservice (HTTP GET)
  Parse complex JSON response from REST call
  JAX-RS method returns StreamingOutput fails with "Access to ivy environment outside a process request thread is not possible"
  Is WADL as description of REST services supported?