diff --git a/docs/modules/ROOT/examples/client-server/application.properties b/docs/modules/ROOT/examples/client-server/application.properties index 81c1b49c2..da24ee728 100644 --- a/docs/modules/ROOT/examples/client-server/application.properties +++ b/docs/modules/ROOT/examples/client-server/application.properties @@ -123,4 +123,20 @@ quarkus.cxf.client.loop.client-endpoint-url = http://localhost:${quarkus.http.te quarkus.cxf.client.loop.service-interface = io.quarkiverse.cxf.it.large.slow.generated.LargeSlowService quarkus.cxf.client.loop.auto-redirect = true +quarkus.cxf.client.soap12.client-endpoint-url = http://localhost:${quarkus.http.test-port}/soap/soap12 +quarkus.cxf.client.soap12.service-interface = io.quarkiverse.cxf.it.HelloService +quarkus.cxf.client.soap12.soap-binding = http://www.w3.org/2003/05/soap/bindings/HTTP/ +quarkus.cxf.client.soap12.logging.enabled = true +#quarkus.cxf.client.soap12.http-conduit-factory = URLConnectionHTTPConduitFactory + +quarkus.cxf.client.contentType.client-endpoint-url = http://localhost:${quarkus.http.test-port}/soap/soap12 +quarkus.cxf.client.contentType.service-interface = io.quarkiverse.cxf.it.HelloService +#quarkus.cxf.client.contentType.soap-binding = http://www.w3.org/2003/05/soap/bindings/HTTP/ +quarkus.cxf.client.contentType.content-type = application/soap+xml; action="contentTypeAction" +quarkus.cxf.client.contentType.logging.enabled = true + +quarkus.cxf.endpoint."/soap12".implementor = io.quarkiverse.cxf.it.soap12.Soap12HelloServiceImpl +quarkus.cxf.endpoint."/soap12".soap-binding = http://www.w3.org/2003/05/soap/bindings/HTTP/ +quarkus.cxf.endpoint."/soap12".logging.enabled = true + quarkus.default-locale = en_US \ No newline at end of file diff --git a/integration-tests/client-server/src/main/java/io/quarkiverse/cxf/it/HelloService.java b/integration-tests/client-server/src/main/java/io/quarkiverse/cxf/it/HelloService.java index 1fb4203fe..fc87b8a59 100644 --- a/integration-tests/client-server/src/main/java/io/quarkiverse/cxf/it/HelloService.java +++ b/integration-tests/client-server/src/main/java/io/quarkiverse/cxf/it/HelloService.java @@ -7,6 +7,6 @@ public interface HelloService { public static final String NS = "https://quarkiverse.github.io/quarkiverse-docs/quarkus-cxf/test"; - @WebMethod + @WebMethod(operationName = "hello", action = "helloAction") public String hello(String person); } diff --git a/integration-tests/client-server/src/main/java/io/quarkiverse/cxf/it/soap12/Soap12HelloServiceImpl.java b/integration-tests/client-server/src/main/java/io/quarkiverse/cxf/it/soap12/Soap12HelloServiceImpl.java new file mode 100644 index 000000000..586440193 --- /dev/null +++ b/integration-tests/client-server/src/main/java/io/quarkiverse/cxf/it/soap12/Soap12HelloServiceImpl.java @@ -0,0 +1,23 @@ +package io.quarkiverse.cxf.it.soap12; + +import jakarta.annotation.Resource; +import jakarta.jws.WebService; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.xml.ws.WebServiceContext; +import jakarta.xml.ws.handler.MessageContext; + +import io.quarkiverse.cxf.it.HelloService; + +@WebService(serviceName = "HelloService", targetNamespace = HelloService.NS) +public class Soap12HelloServiceImpl implements HelloService { + + @Resource + WebServiceContext wsContext; + + @Override + public String hello(String person) { + final HttpServletRequest req = (HttpServletRequest) wsContext.getMessageContext().get(MessageContext.SERVLET_REQUEST); + return "Hello " + person + ", Content-Type: " + req.getHeader("Content-Type"); + } + +} diff --git a/integration-tests/client-server/src/main/java/io/quarkiverse/cxf/it/soap12/Soap12Rest.java b/integration-tests/client-server/src/main/java/io/quarkiverse/cxf/it/soap12/Soap12Rest.java new file mode 100644 index 000000000..8b7cf4ca4 --- /dev/null +++ b/integration-tests/client-server/src/main/java/io/quarkiverse/cxf/it/soap12/Soap12Rest.java @@ -0,0 +1,41 @@ +package io.quarkiverse.cxf.it.soap12; + +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; + +import io.quarkiverse.cxf.annotation.CXFClient; +import io.quarkiverse.cxf.it.HelloService; + +@Path("/Soap12Rest") +public class Soap12Rest { + + @CXFClient("soap12") + HelloService soap12; + + @CXFClient("contentType") + HelloService contentType; + + HelloService getClient(String clientName) { + switch (clientName) { + case "soap12": { + return soap12; + } + case "contentType": { + return contentType; + } + default: + throw new IllegalArgumentException("Unexpected client name: " + clientName); + } + } + + @Path("/sync/{client}") + @POST + @Produces(MediaType.TEXT_PLAIN) + public String hello(@PathParam("client") String client, String body) { + return getClient(client).hello(body); + } + +} diff --git a/integration-tests/client-server/src/main/resources/application.properties b/integration-tests/client-server/src/main/resources/application.properties index 81c1b49c2..da24ee728 100644 --- a/integration-tests/client-server/src/main/resources/application.properties +++ b/integration-tests/client-server/src/main/resources/application.properties @@ -123,4 +123,20 @@ quarkus.cxf.client.loop.client-endpoint-url = http://localhost:${quarkus.http.te quarkus.cxf.client.loop.service-interface = io.quarkiverse.cxf.it.large.slow.generated.LargeSlowService quarkus.cxf.client.loop.auto-redirect = true +quarkus.cxf.client.soap12.client-endpoint-url = http://localhost:${quarkus.http.test-port}/soap/soap12 +quarkus.cxf.client.soap12.service-interface = io.quarkiverse.cxf.it.HelloService +quarkus.cxf.client.soap12.soap-binding = http://www.w3.org/2003/05/soap/bindings/HTTP/ +quarkus.cxf.client.soap12.logging.enabled = true +#quarkus.cxf.client.soap12.http-conduit-factory = URLConnectionHTTPConduitFactory + +quarkus.cxf.client.contentType.client-endpoint-url = http://localhost:${quarkus.http.test-port}/soap/soap12 +quarkus.cxf.client.contentType.service-interface = io.quarkiverse.cxf.it.HelloService +#quarkus.cxf.client.contentType.soap-binding = http://www.w3.org/2003/05/soap/bindings/HTTP/ +quarkus.cxf.client.contentType.content-type = application/soap+xml; action="contentTypeAction" +quarkus.cxf.client.contentType.logging.enabled = true + +quarkus.cxf.endpoint."/soap12".implementor = io.quarkiverse.cxf.it.soap12.Soap12HelloServiceImpl +quarkus.cxf.endpoint."/soap12".soap-binding = http://www.w3.org/2003/05/soap/bindings/HTTP/ +quarkus.cxf.endpoint."/soap12".logging.enabled = true + quarkus.default-locale = en_US \ No newline at end of file diff --git a/integration-tests/client-server/src/test/java/io/quarkiverse/cxf/it/soap12/Soap12IT.java b/integration-tests/client-server/src/test/java/io/quarkiverse/cxf/it/soap12/Soap12IT.java new file mode 100644 index 000000000..75bcb272d --- /dev/null +++ b/integration-tests/client-server/src/test/java/io/quarkiverse/cxf/it/soap12/Soap12IT.java @@ -0,0 +1,8 @@ +package io.quarkiverse.cxf.it.soap12; + +import io.quarkus.test.junit.QuarkusIntegrationTest; + +@QuarkusIntegrationTest +class Soap12IT extends Soap12Test { + +} diff --git a/integration-tests/client-server/src/test/java/io/quarkiverse/cxf/it/soap12/Soap12Test.java b/integration-tests/client-server/src/test/java/io/quarkiverse/cxf/it/soap12/Soap12Test.java new file mode 100644 index 000000000..70351cbf1 --- /dev/null +++ b/integration-tests/client-server/src/test/java/io/quarkiverse/cxf/it/soap12/Soap12Test.java @@ -0,0 +1,33 @@ +package io.quarkiverse.cxf.it.soap12; + +import org.hamcrest.Matchers; +import org.junit.jupiter.api.Test; + +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.RestAssured; + +@QuarkusTest +class Soap12Test { + + @Test + void soap12() { + RestAssured.given() + .body("Joe") + .post("/Soap12Rest/sync/soap12") + .then() + .statusCode(200) + .body(Matchers.is("Hello Joe, Content-Type: application/soap+xml; action=\"helloAction\"; charset=UTF-8")); + } + + @Test + void contentType() { + RestAssured.given() + .body("Joe") + .post("/Soap12Rest/sync/contentType") + .then() + .statusCode(200) + .body(Matchers + .is("Hello Joe, Content-Type: application/soap+xml; action=\"contentTypeAction\"; charset=UTF-8")); + } + +}