使用Apache骆驼我怎么解组我是通过CXF端点进来反序列化对象?
-
26-09-2019 - |
题
我有一个很简单的骆驼路线。它以一个CXF端点公开为Web服务。 然后我想将其转换为XML和调用方法上的bean。
目前,我发现了Web服务调用后CXF特定对象。 我怎么把我的序列化对象了CXF MessageList中,并用它向前发展?
我的路线:
<camel:route>
<camel:from uri="cxf:bean:helloEndpoint" />
<camel:marshal ref="xstream-utf8" />
<camel:to uri="bean:hello?method=hello"/>
</camel:route>
在XML序列化的消息:
<?xml version='1.0' encoding='UTF-8'?>
<org.apache.cxf.message.MessageContentsList serialization="custom">
<unserializable-parents />
<list>
<default>
<size>1</size>
</default>
<int>6</int>
<com.whatever.Person>
<firstName>Joe</firstName>
<middleName></middleName>
<lastName>Buddah</lastName>
<dateOfBirth>2010-04-13 12:09:00.137 CDT</dateOfBirth>
</com.whatever.Person>
</list>
</org.apache.cxf.message.MessageContentsList>
我期望XML更是这样的:
<com.whatever.Person>
<firstName>Joe</firstName>
<middleName></middleName>
<lastName>Buddah</lastName>
<dateOfBirth>2010-04-13 12:09:00.137 CDT</dateOfBirth>
</com.whatever.Person>
解决方案
我发现它。我不得不使用它。
<camel:convertBodyTo type="com.whatever.Person"/>
其他提示
您还可以使用JAXB数据格式,我认为盒子的CXF支持进行。
我假定你有使用CXF的WSDL2Java有模型对象自动生成?如果是的话,你可以看看哪个应具有@ JAXB注解
的生成的源代码不隶属于 StackOverflow