Spring integration 使用JAXB解组XML
实际上,我对spring非常陌生,目前由于一些需求,我正在使用spring集成,我制作了一些JAXB类来将数据转换为XML,并且必须通过Web服务发送数据,但作为响应,我使用一些新元素将XML取回,我想知道如何使用我制作的相同JAXB类来解组新XML?我使用以下组件来实现这一点(java配置):Spring integration 使用JAXB解组XML,spring-integration,Spring Integration,实际上,我对spring非常陌生,目前由于一些需求,我正在使用spring集成,我制作了一些JAXB类来将数据转换为XML,并且必须通过Web服务发送数据,但作为响应,我使用一些新元素将XML取回,我想知道如何使用我制作的相同JAXB类来解组新XML?我使用以下组件来实现这一点(java配置): @Bean public Jaxb2Marshaller jaxb2Marshaller() throws Exception { Jaxb2Marshaller mar
@Bean
public Jaxb2Marshaller jaxb2Marshaller() throws Exception {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
/* Packages with root elements (@XmlRootElement). Your JAXB classes */
marshaller.setContextPaths("...");
return marshaller;
}
@Bean
@ServiceActivator(inputChannel = "toWebServiceChannel")
public MessageHandler wsGateway() throws Exception {
ConfigWebServiceURLProvider provider = new ConfigWebServiceURLProvider(isHttps, host, port, endpoint);
/* marshaller and unmarshaller could be the same */
MarshallingWebServiceOutboundGateway gw = new MarshallingWebServiceOutboundGateway(url, jaxb2Marshaller(), jaxb2Marshaller());
gw.setOutputChannelName( "fromWebServiceChannel" );
return gw;
}