You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "ppalaga (via GitHub)" <gi...@apache.org> on 2023/05/10 20:18:59 UTC

[GitHub] [camel-quarkus] ppalaga commented on a diff in pull request #4886: Document CXF SOAP usage, configuration and limitations

ppalaga commented on code in PR #4886:
URL: https://github.com/apache/camel-quarkus/pull/4886#discussion_r1190356283


##########
extensions/cxf-soap/runtime/src/main/doc/usage.adoc:
##########
@@ -0,0 +1,251 @@
+=== 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]]
+=== 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]]
+=== 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:
++
+[source,shell]
+----
+$ docker run -p 8082:8080 quay.io/l2x6/calculator-ws:1.1

Review Comment:
   Thanks for catching it, are more comments coming?



-- 
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-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org