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

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

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


##########
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:

Review Comment:
   `as producers` ? 



##########
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:
   Whis is this extra `+` here ?



##########
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");

Review Comment:
   `soapClientEndpoint` vs `cxfBeanClient` ?



##########
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:
++
+[source,shell]
+----
+$ docker run -p 8082:8080 quay.io/l2x6/calculator-ws:1.2
+----
+
+NOTE: `quarkus-cxf` supports {link-quarkus-cxf-doc}/user-guide/first-soap-client.html[injecting SOAP clients]
+      using `@io.quarkiverse.cxf.annotation.CXFClient` annotation.
+      Please refer to the {link-quarkus-cxf-doc}/user-guide/first-soap-client.html[SOAP Clients] chapter of `quarkus-cxf` user guide for more details.
+
+[[server]]
+[id="extensions-cxf-soap-usage-server"]
+=== Server
+
+With `camel-quarkus-cxf-soap`, you can expose SOAP endpoints as producers in Camel routes.

Review Comment:
   `as consumers` ?



-- 
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