이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 39. Payload-Based Route


39.1. Processing Messages in PAYLOAD Format

Overview

Select the PAYLOAD format, if you want to access the SOAP message body in XML format, encoded as a DOM object (that is, of org.w3c.dom.Node type). One of the advantages of the PAYLOAD format is that no JAX-WS and JAXB stub code is required, which allows your application to be dynamic, potentially handling many different WSDL interfaces.
Having a message body in XML format enables you to parse the request using XML languages such as XPath and to generate responses using templating languages, such as Velocity.
Note
The DOM format is not the optimal type to use for large XML message bodies. For large messages, consider using the techniques described in Chapter 40, Provider-Based Route.

Demonstration location

The code presented in this chapter is taken from the following demonstration:
cxf-webinars-jboss-fuse-6.3/customer-ws-camel-cxf-payload
Copy to Clipboard Toggle word wrap
For details of how to download and install the demonstration code, see Chapter 34, Demonstration Code for Camel/CXF

Camel CXF component

The Camel CXF component is an Apache CXF component that integrates Web services with routes. You can use it either to instantiate consumer endpoints (at the start of a route), which behave like Web service instances, or to instantiate producer endpoints (at any other points in the route), which behave like WS clients.
Note
Came CXF endpoints—which are instantiated using the cxf:cxfEndpoint XML element and are implemented by the Apache Camel project—are not to be confused with the Apache CXF JAX-WS endpoints—which are instantiated using the jaxws:endpoint XML element and are implemented by the Apache CXF project.

PAYLOAD data format

The PAYLOAD data format is selected by setting the dataFormat=PAYLOAD option on a Camel CXF endpoint URI and it has the following characteristics:
  • Enables you to access the message body as a DOM object (XML payload).
  • No JAX-WS or JAXB stub code required.
  • The SOAP body is marshalled as follows:
    • The message body is effectively an XML payload of org.w3c.dom.Node type (wrapped in a CxfPayload object).
    • The type of the message body is org.apache.camel.component.cxf.CxfPayload.
  • The SOAP headers are converted into headers in the exchange's In message, of org.apache.cxf.binding.soap.SoapHeader type.

Implementing and building a PAYLOAD route

To implement and build the demonstration PAYLOAD-based route, starting from scratch, you would perform the following steps:
  1. Instantiate the Camel CXF endpoint in Spring, using the cxf:cxfEndpoint element.
  2. Implement the route in XML, where you can use the content-based router to sort requests by operation name.
  3. For each operation, define a processor bean to process the request.
  4. Define velocity templates for generating the reponse messages.

Sample PAYLOAD route

Figure 39.1, “Sample PAYLOAD Route” shows an outline of the route that is used to process the operations of the CustomerService Web service using the PAYLOAD data format. After sorting the request messages by operation name, an operation-specific processor bean reads the incoming request parameters. Finally, the response messages are generated using Velocity templates.

Figure 39.1. Sample PAYLOAD Route

맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat