this.restService = restService;
}
public XmlObject generateWadl() {
ApplicationDocument applicationDocument = ApplicationDocument.Factory.newInstance();
Application application = applicationDocument.addNewApplication();
createDoc(application.addNewDoc(), restService);
Resources resources = application.addNewResources();
// use first endpoint for now -> this should be configurable
String basePath = restService.getBasePath();
String[] endpoints = restService.getEndpoints();
if (endpoints.length > 0) {
basePath = endpoints[0] + basePath;
}
resources.setBase(basePath);
for (int c = 0; c < restService.getOperationCount(); c++) {
resources.addNewResource().set(generateWadlResource(restService.getOperationAt(c)));
}
String[] namespaces = InferredSchemaManager.getInferredSchema(restService).getNamespaces();
if (namespaces.length > 0) {
Grammars grammars = application.addNewGrammars();
for (String namespace : namespaces) {
grammars.addNewInclude().setHref(InferredSchemaManager.filenameForNamespace(namespace));
}
}