Skip to content

Commit

Permalink
Add SOAP 1.2 test
Browse files Browse the repository at this point in the history
  • Loading branch information
ppalaga committed Dec 6, 2024
1 parent 4df9d45 commit 48a9051
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 1 deletion.
10 changes: 10 additions & 0 deletions docs/modules/ROOT/examples/client-server/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,14 @@ 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.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
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Original file line number Diff line number Diff line change
@@ -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");
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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;

HelloService getClient(String clientName) {
switch (clientName) {
case "soap12": {
return soap12;
}
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);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,14 @@ 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.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
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package io.quarkiverse.cxf.it.soap12;

import io.quarkus.test.junit.QuarkusIntegrationTest;

@QuarkusIntegrationTest
class Soap12IT extends Soap12Test {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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"));
}

}

0 comments on commit 48a9051

Please sign in to comment.