290.3. Java DSL の使用
以下の例では、com.example.customerservice パッケージで設定された soap の名前付き DataFormat を使用して JAXBContext を初期化します。2 番目のパラメーターは ElementNameStrategy です。ルートは、通常のオブジェクトと例外をマーシャリングできます。(以下は SOAP Envelope をキューに送信するだけです。Web サービスプロバイダーは実際には SOAP 呼び出しが実際にキューをリッスンする必要があります。この場合、SOAP リクエストは 1 通りです。要求応答が必要な場合は、次の例を確認してください。
SoapJaxbDataFormat soap = new SoapJaxbDataFormat("com.example.customerservice", new ServiceInterfaceStrategy(CustomerService.class));
from("direct:start")
.marshal(soap)
.to("jms:myQueue");
「SOAP dataformat inherits from the JAXB dataformat inherits from the JAXB dataformat applys as the most settings applies here」も参照 してください。
290.3.1. SOAP 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> 要素に version 属性を設定できます。
<!-- 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>