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:

application.properties
quarkus.cxf.path=/soap

With the above in place, a Hello service having

application.properties
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) or quarkus.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.Path annotations on your REST resource classes and make sure they do not start with your value of quarkus.cxf.path.

    • If you have REST resources without class-level @jakarta.ws.rs.Path annotation, then you also need to check @jakarta.ws.rs.Path annotations on their methods. Make sure that their values not only do not start with a literal matching your value of quarkus.cxf.path, but also that they do not start with a placeholder (like /{id}) or regex /{id: \w+} that might clash with your value of quarkus.cxf.path too.

  • If you use Quarkus Reactive Routes

    • Make sure your @io.quarkus.vertx.web.Route and @io.quarkus.vertx.web.RouteBase annotations do not clash with your value of quarkus.cxf.path.

    • Make sure your programmatic routes registered via @Observes io.vertx.mutiny.ext.web.Router or an injected Router do not conflict with your value of quarkus.cxf.path. Check your calls of Router.route("/my-path") and your calls of HTTP verb methods of Router, such as Router.get("/my-path").