Apache camelで安静DSLを使用してXMLレスポンスを消費して生成しようとしていますが、出力POJOオブジェクトをxmlにマーシャリングする方法は例外です。 org.apache.camel.InvalidPayloadException::以下は、SY ApacheのキャメルルートApache CamelでREST DSLを使用してxml応答を生成する方法
ここ<camelContext id="camelContext-02bcd908-03ed-4c2c-878a-b87e3a3668ca"
xmlns="http://camel.apache.org/schema/blueprint">
<restConfiguration bindingMode="xml" component="servlet"
contextPath="/camel-example-servlet-rest-blueprint/rest" port="8181">
<dataFormatProperty key="mustBeJAXBElement" value="true" />
</restConfiguration>
<!-- defines the rest services using the context-path /user -->
<rest consumes="application/xml" path="/user" produces="application/xml">
<description>User rest service</description>
<!-- this is a rest GET to view an user by the given id -->
<get outType="org.apache.camel.example.rest.User" uri="/{id}">
<description>Find user by id</description>
<to uri="bean:userService?method=getUser(${header.id})" />
</get>
<!-- this is a rest GET to find all users -->
<get outType="org.apache.camel.example.rest.User[]" uri="/findAll">
<description>Find all users</description>
<to uri="bean:userService?method=listUsers" />
</get>
</rest>
</camelContext>
例外イム
にjava.io.IOExceptionを得ているあるタイプのないボディが利用可能:javax.xml.bind.JAXBElementが、値を持つ:型[java.util.TreeMap.Values]の[[email protected]、[email protected]]:メッセージ[ID-NISB- TEC-C3880-56991-1499145269945-37-3]。 Exchange [ID-NISB-TEC-C3880-56991-1499145269945-37-2] at org.apache.camel.converter.jaxb.JaxbDataFormat.marshal(JaxbDataFormat.java:153) at org.apache.camel.processor。 MarshalProcessor.process(MarshalProcessor.java:69) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109) at org.apache.camel.processor.MarshalProcessor.process(MarshalProcessor.java:50)