使用Spring-WS getWebServiceTemplate()。marshalSendAndReceive如何指定Jaxb2Marshaller以使用Eclipse Moxy Jaxb实现

时间:2015-05-22 18:33:37

标签: spring jaxb spring-ws moxy webservicetemplate

我需要使用带有spring-ws的eclipse moxy来编组一个对象。我正在用spring-ws运行一个spring-boot项目。我在所有模型目录中都包含了moxy jar和所有jaxb.properties文件。

如何让Spring-WS使用jaxb的moxy实现?

订单配置

git show

订购客户

function clean($string) {

   return preg_replace('/[^\p{L}0-9\-]/u', ' ', $string);// Removes special chars.

}

这是我想要使用jaxb的Moxy实现的地方。

的pom.xml

@Configuration
public class OrderConfiguration {

    @Bean
    public Jaxb2Marshaller marshaller() throws Exception {
        Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
        marshaller.setLazyInit(true);
        marshaller.setContextPaths("OMITTED.xcbl.ordermanagement");
        return marshaller;
    }

    @Bean
    public OrderClient orderClient(Jaxb2Marshaller marshaller) throws Exception {
        OrderClient client = new OrderClient();
        client.setMarshaller(marshaller);
        client.setUnmarshaller(marshaller);
        return client;
    }

    @Bean
    public ChangeOrderClient changeOrderClient(Jaxb2Marshaller marshaller) throws Exception {
        ChangeOrderClient client = new ChangeOrderClient();
        client.setMarshaller(marshaller);
        client.setUnmarshaller(marshaller);
        return client;
    }
}

0 个答案:

没有答案