Auto-generates OpenAPI 3.0.1 specifications from deployed Axis2 services and serves Swagger UI at /swagger-ui.
| URL | Description |
|---|---|
/openapi.json |
OpenAPI 3.0.1 spec (JSON) |
/openapi.yaml |
OpenAPI 3.0.1 spec (YAML) |
/swagger-ui |
Interactive Swagger UI |
Add to WEB-INF/conf/axis2.xml:
<module ref="openapi"/>Copy axis2-openapi-<version>.jar to WEB-INF/modules/openapi-<version>.mar.
Configuration is loaded in this order (later sources win):
module.xmlparametersopenapi.propertieson the classpath (or the path set bypropertiesFilemodule param)- Known locations:
META-INF/openapi.properties,WEB-INF/openapi.properties,openapi-config.properties - System properties (same key names)
- Programmatic
OpenApiConfigurationAPI (highest precedence)
| Property key | Default | Description |
|---|---|---|
openapi.title |
Apache Axis2 REST API |
Spec info.title |
openapi.description |
(auto) | Spec info.description |
openapi.version |
1.0.0 |
Spec info.version |
openapi.contact.name |
Apache Axis2 |
Contact name |
openapi.contact.url |
(Apache URL) | Contact URL |
openapi.contact.email |
— | Contact e-mail |
openapi.license.name |
Apache License 2.0 |
License name |
openapi.license.url |
(Apache URL) | License URL |
openapi.termsOfServiceUrl |
— | Terms of service URL |
| Property key | Default | Description |
|---|---|---|
openapi.prettyPrint |
true |
Indent JSON/YAML output |
openapi.readAllResources |
true |
Include all services unless filtered |
openapi.swaggerUi.enabled |
true |
Serve Swagger UI |
openapi.swaggerUi.version |
4.15.5 |
CDN version of Swagger UI bundle |
openapi.resourcePackages |
— | Comma-separated Java packages; only services whose ServiceClass is in these packages are included (requires readAllResources=false) |
Three independent mechanisms control what appears in the generated spec. All are evaluated before inclusion rules — an excluded entity never appears even if it would otherwise match readAllResources or resourcePackages.
Matches against AxisService.getName() (exact, case-sensitive).
Properties file:
# Comma-separated list of service names to exclude
openapi.ignoredServices=InternalService, DebugService, AdminServiceJava API:
OpenApiConfiguration config = new OpenApiConfiguration();
config.addIgnoredService("InternalService");
config.addIgnoredService("DebugService");Each entry is one of:
| Format | Effect |
|---|---|
ServiceName/operationName |
Excludes that operation on that service only |
operationName |
Excludes that operation name on every service |
Properties file:
# Targeted: remove one op from one service
# Global: remove an op name from all services
openapi.ignoredOperations=AdminService/nukeDatabase, internalStatus, debugPingJava API:
config.addIgnoredOperation("AdminService/nukeDatabase"); // targeted
config.addIgnoredOperation("internalStatus"); // global (all services)Matches against the generated path string (e.g. /services/MyService/myOp).
Each entry is tested as a Java regex (String.matches()) or a substring (String.contains()).
openapi.ignoredRoutes=/services/internal/.*, /services/legacy/.*Java API:
config.addIgnoredRoute("/services/internal/.*");Prefer
ignoredServicesandignoredOperationsoverignoredRoutes— they match on logical names rather than generated path strings and are unaffected by future path format changes.
isSystemService() (hardcoded: Version, AdminService, __)
→ ignoredServices
→ readAllResources / resourceClasses / resourcePackages
→ shouldIncludeOperation() / ignoredOperations
→ isIgnoredRoute() / ignoredRoutes
→ (path added to spec)
Place on the classpath as openapi.properties (or META-INF/openapi.properties):
# API identity
openapi.title=My Financial API
openapi.version=2.1.0
openapi.description=Internal portfolio management services
# Contact / license
openapi.contact.name=Platform Team
openapi.contact.email=platform@example.com
openapi.license.name=Proprietary
# Service filtering
openapi.ignoredServices=LegacySOAPService, InternalHealthCheck
openapi.ignoredOperations=AdminService/resetDatabase, debugEcho
# UI
openapi.prettyPrint=true
openapi.swaggerUi.enabled=true
openapi.swaggerUi.version=4.15.5OpenApiConfiguration config = new OpenApiConfiguration();
// API info
config.setTitle("My API");
config.setVersion("2.0.0");
// Exclude services
config.addIgnoredService("InternalService");
// Exclude operations
config.addIgnoredOperation("AdminService/nukeDatabase"); // this service only
config.addIgnoredOperation("debugPing"); // all services
// Pass to the generator
OpenApiSpecGenerator generator = new OpenApiSpecGenerator(configContext, config);
String json = generator.generateOpenApiJson(httpRequest);
String yaml = generator.generateOpenApiYaml(httpRequest);- Request body schema — all operations are typed as
objectbecause Axis2 JSON-RPC services useJsonRpcMessageReceiverand have no annotation-level parameter metadata. Schema details must be added viaOpenApiCustomizeror by serving a static schema file. - GET operations — all operations are mapped to
POST; override viaOpenApiCustomizerif GET endpoints are needed. - YAML format — delegates to
io.swagger.v3.core.util.Yaml, which usesjackson-dataformat-yamlinternally; no additional dependency required.