SOAP and REST endpoints in the same application
Sometimes SOAP and and other HTTP endpoints, such as REST endpoints, may have to co-exist in the same application. Then the paths of SOAP endpoints must be different from the other HTTP endpoints in order to avoid request handling conflicts.
Let us offer some practical tips how to avoid such conflicts.
quarkus.cxf.path
First, there is quarkus.cxf.path,
the default base path for all CXF service endpoints.
Its default value is /services and you can override it in your application.properties:
quarkus.cxf.path=/soap
With the above in place, a Hello service having
quarkus.cxf.endpoint."/hello".implementor=org.acme.cxf.HelloServiceImpl
will be accessible on http://localhost:8080/soap/hello.
Given the above, you should take care that your other HTTP endpoints, including REST endpoints,
do not attempt to handle paths starting with /soap.
Do one or more of the following:
-
Set
quarkus.rest.path(if you use Quarkus REST) orquarkus.resteasy.path(if you use Quarkus RESTEasy Classic)# For Quarkus REST quarkus.rest.path = /rest # Or for RESTEasy Classic # quarkus.resteasy.path = /rest -
If you cannot set the above, then
-
Inspect
@jakarta.ws.rs.Pathannotations on your REST resource classes and make sure they do not start with your value ofquarkus.cxf.path. -
If you have REST resources without class-level
@jakarta.ws.rs.Pathannotation, then you also need to check@jakarta.ws.rs.Pathannotations on their methods. Make sure that their values not only do not start with a literal matching your value ofquarkus.cxf.path, but also that they do not start with a placeholder (like/{id}) or regex/{id: \w+}that might clash with your value ofquarkus.cxf.pathtoo.
-
-
If you use Quarkus Reactive Routes
-
Make sure your
@io.quarkus.vertx.web.Routeand@io.quarkus.vertx.web.RouteBaseannotations do not clash with your value ofquarkus.cxf.path. -
Make sure your programmatic routes registered via
@Observes io.vertx.mutiny.ext.web.Routeror an injectedRouterdo not conflict with your value ofquarkus.cxf.path. Check your calls ofRouter.route("/my-path")and your calls of HTTP verb methods ofRouter, such asRouter.get("/my-path").
-