ppalaga commented on code in PR #4886: URL: https://github.com/apache/camel-quarkus/pull/4886#discussion_r1190949354
########## docs/modules/ROOT/pages/reference/extensions/cxf-soap.adoc: ########## @@ -43,3 +43,265 @@ Or add the coordinates to your existing project: ifeval::[{doc-show-user-guide-link} == true] Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications. endif::[] + +[id="extensions-cxf-soap-usage"] +== Usage +[id="extensions-cxf-soap-usage-general"] +=== General + +`camel-quarkus-cxf-soap` is using extensions from `quarkus-cxf` project (a.k.a. +{link-quarkus-cxf-doc}[CXF Extensions for Quarkus]) under the hood. +This is important to keep in mind because the set of supported use cases and WS specifications is largely given by `quarkus-cxf`. + +IMPORTANT: Please check the Quarkus CXF {link-quarkus-cxf-doc}/reference/index.html[Reference] page to learn about supported use cases and WS specifications. + +[[bom]] +[id="extensions-cxf-soap-usage-dependency-management"] +=== Dependency management + +The versions of CXF and `quarkus-cxf` are xref:user-guide/dependency-management.adoc[managed] by {project-name} +so you do not need to care for selecting a compatible versions of those projects. + +[[client]] +[id="extensions-cxf-soap-usage-client"] +=== Client + +With `camel-quarkus-cxf-soap` (no additional dependencies required), you can use CXF clients as consumers in Camel routes: + +[source,java] +---- +import org.apache.camel.builder.RouteBuilder; +import {javaxOrJakartaPackagePrefix}.enterprise.context.ApplicationScoped; +import {javaxOrJakartaPackagePrefix}.enterprise.context.SessionScoped; +import {javaxOrJakartaPackagePrefix}.enterprise.inject.Produces; +import {javaxOrJakartaPackagePrefix}.inject.Named; + +@ApplicationScoped +public class CxfSoapClientRoutes extends RouteBuilder { + + @Override + public void configure() { + + /* You can either configure the client inline */ + from("direct:cxfUriParamsClient") + .to("cxf://http://localhost:8082/calculator-ws?wsdlURL=wsdl/CalculatorService.wsdl&dataFormat=POJO&serviceClass=org.foo.CalculatorService"); + + /* Or you can use a named bean produced below */ + from("direct:cxfBeanClient") + .to("cxf:bean:soapClientEndpoint?dataFormat=POJO"); + + } + + @Produces + @SessionScoped + @Named + CxfEndpoint cxfBeanClient() { + final CxfEndpoint result = new CxfEndpoint(); + result.setServiceClass(CalculatorService.class); + result.setAddress("http://localhost:8082/calculator-ws"); + result.setWsdlURL("wsdl/CalculatorService.wsdl"); // a resource in the class path + return result; + } +} +---- + +The `CalculatorService` may look like the following: + +[source,java] +---- +import {javaxOrJakartaPackagePrefix}.jws.WebMethod; +import {javaxOrJakartaPackagePrefix}.jws.WebService; + +@WebService(targetNamespace = CalculatorService.TARGET_NS) // <1> +public interface CalculatorService { + + public static final String TARGET_NS = "http://acme.org/wscalculator/Calculator"; + + @WebMethod // <1> + public int add(int intA, int intB); + + @WebMethod // <1> + public int subtract(int intA, int intB); + + @WebMethod // <1> + public int divide(int intA, int intB); + + @WebMethod // <1> + public int multiply(int intA, int intB); +} +---- + +<1> The JAX-WS annotations are required; note that the Simple CXF Frontend is not supported. + Also note that complex parameter types require JAXB annotations or otherwise they won't work properly in native mode. + +[TIP] +You can test this client application against https://quay.io/repository/l2x6/calculator-ws[quay.io/l2x6/calculator-ws:1.2] container that implements this service endpoint interface: ++ Review Comment: To make the subsequent code block a part of the TIP. The same can be used when you want to attach something to a list item, table cell or similar. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org