Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SOAP 1.2 test #1644

Merged
merged 2 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 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,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
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,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);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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
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,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"));
}

}
Loading