You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2023/06/06 20:29:10 UTC

[camel] branch camel-3.20.x updated: Add Java snippets on CXF component page, normalize formating markup, re-indent examples

This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch camel-3.20.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-3.20.x by this push:
     new 67d6dbbc4b4 Add Java snippets on CXF component page, normalize formating markup, re-indent examples
67d6dbbc4b4 is described below

commit 67d6dbbc4b4b57014079a17179eedb4a550f45bb
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Tue Jun 6 11:46:25 2023 +0200

    Add Java snippets on CXF component page, normalize formating markup, re-indent examples
---
 .../src/main/docs/cxf-component.adoc               | 411 ++++++++++++++-------
 1 file changed, 275 insertions(+), 136 deletions(-)

diff --git a/components/camel-cxf/camel-cxf-soap/src/main/docs/cxf-component.adoc b/components/camel-cxf/camel-cxf-soap/src/main/docs/cxf-component.adoc
index 6001ad2fbc5..7bf0a129577 100644
--- a/components/camel-cxf/camel-cxf-soap/src/main/docs/cxf-component.adoc
+++ b/components/camel-cxf/camel-cxf-soap/src/main/docs/cxf-component.adoc
@@ -27,40 +27,39 @@ Maven users must add the following dependency to their `pom.xml`
 for this component:
 
 [source,xml]
-------------------------------------------------------------
+----
 <dependency>
     <groupId>org.apache.camel</groupId>
     <artifactId>camel-cxf-soap</artifactId>
     <version>x.x.x</version>
     <!-- use the same version as your Camel core version -->
 </dependency>
-------------------------------------------------------------
-
+----
 
 == URI format
 
 There are two URI formats for this endpoint: *cxfEndpoint* and *someAddress*.
 
-------------------------------
+----
 cxf:bean:cxfEndpoint[?options]
-------------------------------
+----
 
 Where *cxfEndpoint* represents a bean ID that references a bean in the
 Spring bean registry. With this URI format, most of the endpoint details
 are specified in the bean definition.
 
----------------------------
+----
 cxf://someAddress[?options]
----------------------------
+----
 
 Where *someAddress* specifies the CXF endpoint's address. With this URI
 format, most of the endpoint details are specified using options.
 
 For either style above, you can append options to the URI as follows:
 
----------------------------------------------------------------------
+----
 cxf:bean:cxfEndpoint?wsdlURL=wsdl/hello_world.wsdl&dataFormat=PAYLOAD
----------------------------------------------------------------------
+----
 
 
 // component-configure options: START
@@ -162,7 +161,7 @@ We can then create the simplest CXF service (note we didn't specify the `POJO` m
                 .log("${body}");
 ----
 
-For more complicated implementation of the service (more "Camel way"), we can set the body from the route instead: 
+For more complicated implementation of the service (more "Camel way"), we can set the body from the route instead:
 
 [source,java]
 ----
@@ -334,6 +333,20 @@ service and (2) before the response comes back to the SOAP Client. Processor
 (1) and (2) in this example are InsertRequestOutHeaderProcessor and
 InsertResponseOutHeaderProcessor. Our route looks like this:
 
+[tabs]
+====
+Java::
++
+[source,java]
+----
+from("cxf:bean:routerRelayEndpointWithInsertion")
+    .process(new InsertRequestOutHeaderProcessor())
+    .to("cxf:bean:serviceRelayEndpointWithInsertion")
+    .process(new InsertResponseOutHeaderProcessor());
+----
+
+XML::
++
 [source,xml]
 ----
 <route>
@@ -343,6 +356,7 @@ InsertResponseOutHeaderProcessor. Our route looks like this:
     <process ref="InsertResponseOutHeaderProcessor" />
 </route>
 ----
+====
 
 SOAP headers are propagated to and from Camel Message headers. The Camel
 message header name is "org.apache.cxf.headers.Header.list" which is a
@@ -498,71 +512,108 @@ invoke the outside web service, you can set the request context and get
 response context with the following code:
 
 [source,java]
--------------------------------------------------------------------------------------------------------------
-        CxfExchange exchange = (CxfExchange)template.send(getJaxwsEndpointUri(), new Processor() {
-             public void process(final Exchange exchange) {
-                 final List<String> params = new ArrayList<String>();
-                 params.add(TEST_MESSAGE);
-                 // Set the request context to the inMessage
-                 Map<String, Object> requestContext = new HashMap<String, Object>();
-                 requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, JAXWS_SERVER_ADDRESS);
-                 exchange.getIn().setBody(params);
-                 exchange.getIn().setHeader(Client.REQUEST_CONTEXT , requestContext);
-                 exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, GREET_ME_OPERATION);
-             }
-         });
-         org.apache.camel.Message out = exchange.getMessage();
-         // The output is an object array, the first element of the array is the return value
-         Object\[\] output = out.getBody(Object\[\].class);
-         LOG.info("Received output text: " + output\[0\]);
-         // Get the response context form outMessage
-         Map<String, Object> responseContext = CastUtils.cast((Map)out.getHeader(Client.RESPONSE_CONTEXT));
-         assertNotNull(responseContext);
-         assertEquals("Get the wrong wsdl operation name", "{http://apache.org/hello_world_soap_http}greetMe",
-                      responseContext.get("javax.xml.ws.wsdl.operation").toString());
--------------------------------------------------------------------------------------------------------------
+----
+CxfExchange exchange = (CxfExchange)template.send(getJaxwsEndpointUri(), new Processor() {
+     public void process(final Exchange exchange) {
+         final List<String> params = new ArrayList<String>();
+         params.add(TEST_MESSAGE);
+         // Set the request context to the inMessage
+         Map<String, Object> requestContext = new HashMap<String, Object>();
+         requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, JAXWS_SERVER_ADDRESS);
+         exchange.getIn().setBody(params);
+         exchange.getIn().setHeader(Client.REQUEST_CONTEXT , requestContext);
+         exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, GREET_ME_OPERATION);
+     }
+});
+org.apache.camel.Message out = exchange.getMessage();
+// The output is an object array, the first element of the array is the return value
+Object\[\] output = out.getBody(Object\[\].class);
+LOG.info("Received output text: " + output\[0\]);
+// Get the response context form outMessage
+Map<String, Object> responseContext = CastUtils.cast((Map)out.getHeader(Client.RESPONSE_CONTEXT));
+assertNotNull(responseContext);
+assertEquals("Get the wrong wsdl operation name", "{http://apache.org/hello_world_soap_http}greetMe",
+    responseContext.get("javax.xml.ws.wsdl.operation").toString());
+----
 
 == Attachment Support
 
-*POJO Mode:* MTOM are supported if is enabled(see
-example in Payload Mode for enabling MTOM).  Since attachments are 
-marshalled and unmarshalled into POJOs, the attachments should be 
+*POJO Mode:* Message Transmission Optimization Mechanism (MTOM) is supported if is enabled (see
+example in Payload Mode for enabling MTOM). Since attachments are
+marshalled and unmarshalled into POJOs, the attachments should be
 retrieved from Camel Message Body(As parameter list), and it isn't
 possible to retrieve attachments by Camel Message API
 
 [source,java]
---------------------------------------------
+----
 DataHandler Exchange.getIn(AttachmentMessage.class).getAttachment(String id)
---------------------------------------------
+----
 
-*Payload Mode:* MTOM is supported by this Mode. Attachments can be
-retrieved by Camel Message APIs mentioned above. SOAP with Attachment
-(SwA) is supported and attachments can be retrieved. SwA is
-the default (same as setting the CXF endpoint property "mtom-enabled" to
-false). 
+*Payload Mode:* Message Transmission Optimization Mechanism (MTOM) is supported by this Mode.
+Attachments can be retrieved by Camel Message APIs mentioned above.
+SOAP with Attachment (SwA) is supported and attachments can be retrieved.
+SwA is the default (same as setting the CXF endpoint property `mtomEnabled` to `false`).
 
-To enable MTOM, set the CXF endpoint property "mtom-enabled" to _true_.
+To enable MTOM, set the CXF endpoint property `mtomEnabled` to `true`.
 
-[source,xml]
+[tabs]
+====
+Java (Quarkus)::
++
+[source,java]
 ----
-<cxf:cxfEndpoint id="routerEndpoint" address="http://localhost:${CXFTestSupport.port1}/CxfMtomRouterPayloadModeTest/jaxws-mtom/hello"
-         wsdlURL="mtom.wsdl"
-         serviceName="ns:HelloService"
-         endpointName="ns:HelloPort"
-         xmlns:ns="http://apache.org/camel/cxf/mtom_feature">
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.cxf.common.DataFormat;
+import org.apache.camel.component.cxf.jaxws.CxfEndpoint;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.enterprise.context.SessionScoped;
+import jakarta.enterprise.inject.Produces;
+import jakarta.inject.Named;
 
-     <cxf:properties>
-         <!--  enable mtom by setting this property to true -->
-         <entry key="mtom-enabled" value="true"/>
+@ApplicationScoped
+public class CxfSoapMtomRoutes extends RouteBuilder {
 
-         <!--  set the camel-cxf endpoint data fromat to PAYLOAD mode -->
-         <entry key="dataFormat" value="PAYLOAD"/>
-     </cxf:properties>
+    @Override
+    public void configure() {
+        from("cxf:bean:mtomPayloadModeEndpoint")
+                .process( exchange -> { ... });
+    }
+
+    @Produces
+    @SessionScoped
+    @Named
+    CxfEndpoint mtomPayloadModeEndpoint() {
+        final CxfEndpoint result = new CxfEndpoint();
+        result.setServiceClass(MyMtomService.class);
+        result.setDataFormat(DataFormat.PAYLOAD);
+        result.setMtomEnabled(true);
+        result.setAddress("/mtom/hello");
+        return result;
+    }
+}
+----
+
+XML (Spring)::
++
+[source,xml]
+----
+<cxf:cxfEndpoint id="mtomPayloadModeEndpoint" address="http://localhost:${CXFTestSupport.port1}/CxfMtomRouterPayloadModeTest/mtom"
+        wsdlURL="mtom.wsdl"
+        serviceName="ns:MyMtomService"
+        endpointName="ns:MyMtomPort"
+        xmlns:ns="http://apache.org/camel/cxf/mtom_feature">
+
+    <cxf:properties>
+        <!--  enable mtom by setting this property to true -->
+        <entry key="mtom-enabled" value="true"/>
+        <!--  set the camel-cxf endpoint data fromat to PAYLOAD mode -->
+        <entry key="dataFormat" value="PAYLOAD"/>
+    </cxf:properties>
 </cxf:cxfEndpoint>
 ----
+====
 
-You can produce a Camel message with attachment to send to a CXF
-endpoint in Payload mode.
+You can produce a Camel message with attachment to send to a CXF endpoint in Payload mode.
 
 [source,java]
 ----
@@ -585,7 +636,7 @@ Exchange exchange = context.createProducerTemplate().send("direct:testEndpoint",
 
 });
 
-// process response 
+// process response
 
 CxfPayload<SoapHeader> out = exchange.getMessage().getBody(CxfPayload.class);
 assertEquals(1, out.getBody().size());
@@ -616,60 +667,58 @@ assertEquals(560, image.getWidth());
 assertEquals(300, image.getHeight());
 ----
 
-You can also consume a Camel message received from a CXF endpoint in
-Payload mode.
+You can also consume a Camel message received from a CXF endpoint in Payload mode.
 The https://github.com/apache/camel/blob/main/components/camel-cxf/camel-cxf-spring-soap/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomConsumerPayloadModeTest.java#L97[CxfMtomConsumerPayloadModeTest] illustrates how this works:
 
 [source,java]
 ----
 public static class MyProcessor implements Processor {
 
-        @Override
-        @SuppressWarnings("unchecked")
-        public void process(Exchange exchange) throws Exception {
-            CxfPayload<SoapHeader> in = exchange.getIn().getBody(CxfPayload.class);
-
-            // verify request
-            assertEquals(1, in.getBody().size());
-
-            Map<String, String> ns = new HashMap<>();
-            ns.put("ns", MtomTestHelper.SERVICE_TYPES_NS);
-            ns.put("xop", MtomTestHelper.XOP_NS);
-
-            XPathUtils xu = new XPathUtils(ns);
-            Element body = new XmlConverter().toDOMElement(in.getBody().get(0));
-            Element ele = (Element) xu.getValue("//ns:Detail/ns:photo/xop:Include", body,
-                    XPathConstants.NODE);
-            String photoId = ele.getAttribute("href").substring(4); // skip "cid:"
-            assertEquals(MtomTestHelper.REQ_PHOTO_CID, photoId);
-
-            ele = (Element) xu.getValue("//ns:Detail/ns:image/xop:Include", body,
-                    XPathConstants.NODE);
-            String imageId = ele.getAttribute("href").substring(4); // skip "cid:"
-            assertEquals(MtomTestHelper.REQ_IMAGE_CID, imageId);
-
-            DataHandler dr = exchange.getIn(AttachmentMessage.class).getAttachment(photoId);
-            assertEquals("application/octet-stream", dr.getContentType());
-            assertArrayEquals(MtomTestHelper.REQ_PHOTO_DATA, IOUtils.readBytesFromStream(dr.getInputStream()));
-
-            dr = exchange.getIn(AttachmentMessage.class).getAttachment(imageId);
-            assertEquals("image/jpeg", dr.getContentType());
-            assertArrayEquals(MtomTestHelper.requestJpeg, IOUtils.readBytesFromStream(dr.getInputStream()));
-
-            // create response
-            List<Source> elements = new ArrayList<>();
-            elements.add(new DOMSource(StaxUtils.read(new StringReader(MtomTestHelper.RESP_MESSAGE)).getDocumentElement()));
-            CxfPayload<SoapHeader> sbody = new CxfPayload<>(
-                    new ArrayList<SoapHeader>(),
-                    elements, null);
-            exchange.getMessage().setBody(sbody);
-            exchange.getMessage(AttachmentMessage.class).addAttachment(MtomTestHelper.RESP_PHOTO_CID,
-                    new DataHandler(new ByteArrayDataSource(MtomTestHelper.RESP_PHOTO_DATA, "application/octet-stream")));
-
-            exchange.getMessage(AttachmentMessage.class).addAttachment(MtomTestHelper.RESP_IMAGE_CID,
-                    new DataHandler(new ByteArrayDataSource(MtomTestHelper.responseJpeg, "image/jpeg")));
+    @Override
+    @SuppressWarnings("unchecked")
+    public void process(Exchange exchange) throws Exception {
+        CxfPayload<SoapHeader> in = exchange.getIn().getBody(CxfPayload.class);
+
+        // verify request
+        assertEquals(1, in.getBody().size());
+
+        Map<String, String> ns = new HashMap<>();
+        ns.put("ns", MtomTestHelper.SERVICE_TYPES_NS);
+        ns.put("xop", MtomTestHelper.XOP_NS);
+
+        XPathUtils xu = new XPathUtils(ns);
+        Element body = new XmlConverter().toDOMElement(in.getBody().get(0));
+        Element ele = (Element) xu.getValue("//ns:Detail/ns:photo/xop:Include", body,
+                XPathConstants.NODE);
+        String photoId = ele.getAttribute("href").substring(4); // skip "cid:"
+        assertEquals(MtomTestHelper.REQ_PHOTO_CID, photoId);
+
+        ele = (Element) xu.getValue("//ns:Detail/ns:image/xop:Include", body,
+                XPathConstants.NODE);
+        String imageId = ele.getAttribute("href").substring(4); // skip "cid:"
+        assertEquals(MtomTestHelper.REQ_IMAGE_CID, imageId);
+
+        DataHandler dr = exchange.getIn(AttachmentMessage.class).getAttachment(photoId);
+        assertEquals("application/octet-stream", dr.getContentType());
+        assertArrayEquals(MtomTestHelper.REQ_PHOTO_DATA, IOUtils.readBytesFromStream(dr.getInputStream()));
+
+        dr = exchange.getIn(AttachmentMessage.class).getAttachment(imageId);
+        assertEquals("image/jpeg", dr.getContentType());
+        assertArrayEquals(MtomTestHelper.requestJpeg, IOUtils.readBytesFromStream(dr.getInputStream()));
+
+        // create response
+        List<Source> elements = new ArrayList<>();
+        elements.add(new DOMSource(StaxUtils.read(new StringReader(MtomTestHelper.RESP_MESSAGE)).getDocumentElement()));
+        CxfPayload<SoapHeader> sbody = new CxfPayload<>(
+                new ArrayList<SoapHeader>(),
+                elements, null);
+        exchange.getMessage().setBody(sbody);
+        exchange.getMessage(AttachmentMessage.class).addAttachment(MtomTestHelper.RESP_PHOTO_CID,
+                new DataHandler(new ByteArrayDataSource(MtomTestHelper.RESP_PHOTO_DATA, "application/octet-stream")));
+
+        exchange.getMessage(AttachmentMessage.class).addAttachment(MtomTestHelper.RESP_IMAGE_CID,
+                new DataHandler(new ByteArrayDataSource(MtomTestHelper.responseJpeg, "image/jpeg")));
 
-        }
     }
 }
 ----
@@ -724,14 +773,41 @@ mode] that can transport messages of arbitrary structures (i.e., not
 bound to a specific XML schema). To use this mode, you simply omit
 specifying the wsdlURL and serviceClass attributes of the CXF endpoint.
 
+[tabs]
+====
+Java (Quarkus)::
++
+[source,java]
+----
+import org.apache.camel.component.cxf.common.DataFormat;
+import org.apache.camel.component.cxf.jaxws.CxfEndpoint;
+import jakarta.enterprise.context.SessionScoped;
+import jakarta.enterprise.inject.Produces;
+import jakarta.inject.Named;
+
+...
+
+@Produces
+@SessionScoped
+@Named
+CxfEndpoint dispatchEndpoint() {
+    final CxfEndpoint result = new CxfEndpoint();
+    result.setDataFormat(DataFormat.PAYLOAD);
+    result.setAddress("/SoapAnyPort");
+    return result;
+}
+----
+
+XML (Spring)::
++
 [source,xml]
--------------------------------------------------------------------------------------------
-<cxf:cxfEndpoint id="testEndpoint" address="http://localhost:9000/SoapContext/SoapAnyPort">
-     <cxf:properties>
-       <entry key="dataFormat" value="PAYLOAD"/>
-     </cxf:properties>
-   </cxf:cxfEndpoint>
--------------------------------------------------------------------------------------------
+----
+<cxf:cxfEndpoint id="dispatchEndpoint" address="http://localhost:9000/SoapContext/SoapAnyPort">
+    <cxf:properties>
+        <entry key="dataFormat" value="PAYLOAD"/>
+    </cxf:properties>
+</cxf:cxfEndpoint>
+----
 
 It is noted that the default CXF dispatch client does not send a
 specific SOAPAction header. Therefore, when the target service requires
@@ -748,11 +824,44 @@ is removed in `RAW` mode), you have to configure
 `LoggingOutInterceptor` to be run during the `WRITE` phase. The
 following is an example.
 
+[tabs]
+====
+Java (Quarkus)::
++
+[source,java]
+----
+import java.util.List;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.cxf.common.DataFormat;
+import org.apache.camel.component.cxf.jaxws.CxfEndpoint;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.phase.Phase;
+import jakarta.enterprise.context.SessionScoped;
+import jakarta.enterprise.inject.Produces;
+import jakarta.inject.Named;
+
+...
+
+@Produces
+@SessionScoped
+@Named
+CxfEndpoint soapMtomEnabledServerPayloadModeEndpoint() {
+    final CxfEndpoint result = new CxfEndpoint();
+    result.setServiceClass(HelloService.class);
+    result.setDataFormat(DataFormat.RAW);
+    result.setOutFaultInterceptors(List.of(new LoggingOutInterceptor(Phase.WRITE)));;
+    result.setAddress("/helloworld");
+    return result;
+}
+----
+
+XML (Spring)::
++
 [source,xml]
--------------------------------------------------------------------------------------------------------
+----
 <bean id="loggingOutInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor">
     <!--  it really should have been user-prestream but CXF does have such phase! -->
-    <constructor-arg value="target/write"/>
+    <constructor-arg value="write"/>
 </bean>
 
 <cxf:cxfEndpoint id="serviceEndpoint" address="http://localhost:${CXFTestSupport.port2}/LoggingInterceptorInMessageModeTest/helloworld"
@@ -764,7 +873,8 @@ following is an example.
         <entry key="dataFormat" value="RAW"/>
     </cxf:properties>
 </cxf:cxfEndpoint>
--------------------------------------------------------------------------------------------------------
+----
+====
 
 == Description of CxfHeaderFilterStrategy options
 
@@ -817,24 +927,24 @@ straightforward) CXF interceptor/JAXWS Handler to the CXF endpoint.
 
 
 [source,xml]
--------------------------------------------------------------------------------------------------------
+----
 <bean id="dropAllMessageHeadersStrategy" class="org.apache.camel.component.cxf.transport.header.CxfHeaderFilterStrategy">
 
     <!--  Set relayHeaders to false to drop all SOAP headers -->
     <property name="relayHeaders" value="false"/>
 
 </bean>
--------------------------------------------------------------------------------------------------------
+----
 
 Then, your endpoint can reference the `CxfHeaderFilterStrategy`.
 
 [source,xml]
--------------------------------------------------------------------------------------------------------
+----
 <route>
     <from uri="cxf:bean:routerNoRelayEndpoint?headerFilterStrategy=#dropAllMessageHeadersStrategy"/>
     <to uri="cxf:bean:serviceNoRelayEndpoint?headerFilterStrategy=#dropAllMessageHeadersStrategy"/>
 </route>
--------------------------------------------------------------------------------------------------------
+----
 
 * You can plugin your own `MessageHeaderFilter` implementations overriding
 or adding additional ones to the list of relays. In order to override a
@@ -845,7 +955,7 @@ override.
 Here is an example of configuring user defined Message Header Filters:
 
 [source,xml]
--------------------------------------------------------------------------------------------------------
+----
 <bean id="customMessageFilterStrategy" class="org.apache.camel.component.cxf.transport.header.CxfHeaderFilterStrategy">
     <property name="messageHeaderFilters">
         <list>
@@ -857,7 +967,7 @@ Here is an example of configuring user defined Message Header Filters:
         </list>
     </property>
 </bean>
--------------------------------------------------------------------------------------------------------
+----
 
 * In addition to `relayHeaders`, the following properties can be
 configured in `CxfHeaderFilterStrategy`.
@@ -896,9 +1006,9 @@ If you are using some SOAP client such as PHP, you will get this kind of
 error, because CXF doesn't add the XML processing instruction
 `<?xml version="1.0" encoding="utf-8"?>`:
 
----------------------------------------------------------------------------------------
+----
 Error:sendSms: SoapFault exception: [Client] looks like we got no XML document in [...]
----------------------------------------------------------------------------------------
+----
 
 To resolve this issue, you just need to tell StaxOutInterceptor to
 write the XML start document for you, as in the https://github.com/apache/camel/blob/main/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/WriteXmlDeclarationInterceptor.java[WriteXmlDeclarationInterceptor] below:
@@ -921,12 +1031,12 @@ public class WriteXmlDeclarationInterceptor extends AbstractPhaseInterceptor<Soa
 As an alternative you can add a message header for it as demonstrated in https://github.com/apache/camel/blob/main/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfConsumerTest.java#L62[CxfConsumerTest]:
 
 [source,java]
--------------------------------------------------------------------
+----
  // set up the response context which force start document
  Map<String, Object> map = new HashMap<String, Object>();
  map.put("org.apache.cxf.stax.force-start-document", Boolean.TRUE);
- exchange.getOut().setHeader(Client.RESPONSE_CONTEXT, map);
--------------------------------------------------------------------
+ exchange.getMessage().setHeader(Client.RESPONSE_CONTEXT, map);
+----
 
 == Configure the CXF endpoints with Spring
 
@@ -937,7 +1047,7 @@ tags. When you are invoking the service endpoint, you can set the
 which operation you are calling.
 
 [source,xml]
-----------------------------------------------------------------------------------------------------------------
+----
 <beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:cxf="http://camel.apache.org/schema/cxf"
@@ -960,7 +1070,7 @@ which operation you are calling.
        </route>
     </camelContext>
   </beans>
-----------------------------------------------------------------------------------------------------------------
+----
 
 Be sure to include the JAX-WS `schemaLocation` attribute specified on
 the root beans element. This allows CXF to validate the file and is
@@ -1041,25 +1151,54 @@ http://cxf.apache.org/docs/jax-ws-configuration.html[JAX-WS
 Configuration page].
 
 [NOTE]
-====
+======
 You can use cxf:properties to set the camel-cxf endpoint's dataFormat
 and setDefaultBus properties from spring configuration file.
 
+[tabs]
+====
+Java (Quarkus)::
++
+[source,java]
+----
+import org.apache.camel.component.cxf.common.DataFormat;
+import org.apache.camel.component.cxf.jaxws.CxfEndpoint;
+import jakarta.enterprise.context.SessionScoped;
+import jakarta.enterprise.inject.Produces;
+import jakarta.inject.Named;
+
+...
+
+@Produces
+@SessionScoped
+@Named
+CxfEndpoint testEndpoint() {
+    final CxfEndpoint result = new CxfEndpoint();
+    result.setServiceClass(HelloService.class);
+    result.setDataFormat(DataFormat.RAW);
+    result.setDefaultBus(true);
+    result.setAddress("/hello");
+    return result;
+}
+----
+
+XML (Spring)::
++
 [source,xml]
--------------------------------------------------------------------------
+----
 <cxf:cxfEndpoint id="testEndpoint" address="http://localhost:9000/router"
      serviceClass="org.apache.camel.component.cxf.HelloService"
-     endpointName="s:PortName"
-     serviceName="s:ServiceName"
+     endpointName="s:HelloPort"
+     serviceName="s:HelloService"
      xmlns:s="http://www.example.com/test">
      <cxf:properties>
        <entry key="dataFormat" value="RAW"/>
        <entry key="setDefaultBus" value="true"/>
      </cxf:properties>
    </cxf:cxfEndpoint>
--------------------------------------------------------------------------
-==== 
-
+----
+====
+======
 
 
 include::spring-boot:partial$starter.adoc[]