324.15. POJO (非) マーシャリング

Camel のプラグ可能なデータ形式は、JAXB、XStream、JibX、Castor、XMLBeans などのライブラリーを使用した pojo/xml マーシャリングのサポートを提供します。ルートでこれらのデータ形式を使用して、Web サービスとの間で pojo を送受信できます。

Web サービス にアクセスする ときは、リクエストをマーシャリングし、レスポンスメッセージをアンマーシャリングできます。

JaxbDataFormat jaxb = new JaxbDataFormat(false);
jaxb.setContextPath("com.example.model");

from("direct:example").marshal(jaxb).to("spring-ws:http://foo.com/bar").unmarshal(jaxb);

同様に、Web サービス を提供する 場合、POJO への XML リクエストをアンマーシャリングし、レスポンスメッセージを XML にマーシャリングすることができます。

from("spring-ws:rootqname:{http://example.com/}GetFoo?endpointMapping=#endpointMapping").unmarshal(jaxb)
.to("mock:example").marshal(jaxb);