ffang commented on code in PR #15573:
URL: https://github.com/apache/camel/pull/15573#discussion_r1761171123


##########
components/camel-cxf/camel-cxf-soap/src/main/docs/cxf-component.adoc:
##########
@@ -590,86 +600,50 @@ And implementation:
 
 package org.apache.camel.component.cxf.soap.server;
 
-@WebService(name = "EchoService", serviceName = "EchoService", targetNamespace 
= "http://server.soap.cxf.component.camel.apache.org/";)
-public class EchoServiceImpl implements EchoService {
+import jakarta.jws.WebService;
+
+@WebService(name = "TextService", serviceName = "TextService", targetNamespace 
= "http://server.soap.cxf.component.camel.apache.org/";)
+public class TextServiceImpl implements TextService {
 
     @Override
-    public String echo(String text) {
-        return text;
+    public String upperCase(String text) {
+        return text.toUpperCase();
     }
 
+    @Override
+    public String lowerCase(String text) {
+        return text.toLowerCase();
+    }
 }
-----
 
-We can then create the simplest CXF service (note we didn't specify the `POJO` 
mode, as it is the default mode):
-
-[source,java]
-----
-    
from("cxf:echoServiceResponseFromImpl?serviceClass=org.apache.camel.component.cxf.soap.server.EchoServiceImpl&address=/echo-impl")//
 no body set here; the response comes from EchoServiceImpl
-                .log("${body}");
 ----
 
-For more complicated implementation of the service (more "Camel way"), we can 
set the body from the route instead:
+We can then create the simplest CXF service (note we didn't specify the `POJO` 
mode, as it is the default mode) in "Camel way":
 
 [source,java]
 ----
-    
from("cxf:echoServiceResponseFromRoute?serviceClass=org.apache.camel.component.cxf.soap.server.EchoServiceImpl&address=/echo-route")
-                .setBody(exchange -> 
exchange.getMessage().getBody(String.class) + " from Camel route");
+    
from("cxf:textServiceResponseFromRoute?serviceClass=org.apache.camel.component.cxf.soap.server.TextService&address=/text-route",
+            .process(exchange -> {
+                String operation = (String) 
exchange.getIn().getHeader(CxfConstants.OPERATION_NAME);
+                String inputArg = ((MessageContentsList) 
exchange.getIn().getBody()).get(0).toString();
+                String result = null;
+                if (operation.equals("upperCase")) {
+                    result = inputArg.toUpperCase();
+                }
+                else if (operation.equals("lowerCase")) {
+                    result = inputArg.toLowerCase();
+                }
+                exchange.getIn().setBody(result);
+            });                                     
 ----
 
-
-=== How to consume a message from a Camel CXF endpoint in POJO data format
-
-The Camel CXF endpoint consumer POJO data format is based on the
-http://cxf.apache.org/docs/invokers.html[CXF invoker], so the
-message header has a property with the name of
-`CxfConstants.OPERATION_NAME` and the message body is a list of the SEI
-method parameters.
-
-Consider the 
https://github.com/apache/camel/blob/main/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/wsdl_first/PersonProcessor.java[PersonProcessor]
 example code:
+For more dynamic implementation (more "CXF way"), we can use 
https://camel.apache.org/components/next/bean-component.html[Bean] invocation 
based on requested operation name:

Review Comment:
   I think using camel-bean uri in "to" is a more "Camel Way" here.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to