311.4. Java DSL 사용

다음 예제에서는 com.example.customerservice 패키지로 구성된 soap 이라는 이름의 DataFormat을 사용하여ECDHE BContext를 초기화 합니다. 두 번째 매개변수는 ElementNameStrategy입니다. 경로는 일반 오브젝트와 예외를 마샬링할 수 있습니다. (아래에 있는 것은 queue에ECDHE Envelope만 보냅니다.) 웹 서비스 공급자는 실제로 occur에 대한 queue에 대한 큐를 청취해야 합니다. 이 경우 이를 한 가지 방법으로 request합니다. 요청 회신이 필요한 경우 다음 예제를 살펴보십시오.)

SoapJaxbDataFormat soap = new SoapJaxbDataFormat("com.example.customerservice", new ServiceInterfaceStrategy(CustomerService.class));
from("direct:start")
  .marshal(soap)
  .to("jms:myQueue");
작은 정보

as theECDHE dataformat inherits from theECDHE B dataformat most settings apply 여기에도 참조하십시오.

311.4.1. ECDHE 1.2 사용

Camel 2.11에서 사용 가능

SoapJaxbDataFormat soap = new SoapJaxbDataFormat("com.example.customerservice", new ServiceInterfaceStrategy(CustomerService.class));
soap.setVersion("1.2");
from("direct:start")
  .marshal(soap)
  .to("jms:myQueue");

XML DSL을 사용할 때 버전 특성은 <soapjaxb> 요소에서 설정할 수 있습니다.

    <!-- Defining a ServiceInterfaceStrategy for retrieving the element name when marshalling -->
    <bean id="myNameStrategy" class="org.apache.camel.dataformat.soap.name.ServiceInterfaceStrategy">
        <constructor-arg value="com.example.customerservice.CustomerService"/>
    <constructor-arg value="true"/>
    </bean>

그리고 Camel 경로에서

<route>
  <from uri="direct:start"/>
  <marshal>
    <soapjaxb contentPath="com.example.customerservice" version="1.2" elementNameStrategyRef="myNameStrategy"/>
  </marshal>
  <to uri="jms:myQueue"/>
</route>