I need to marshall an object using eclipse moxy with spring-ws. I'm running a spring-boot project with spring-ws. I have included the moxy jar and all of the jaxb.properties files in all of the model directories.

How do I make Spring-WS use the moxy implementation of jaxb?

Order Configuration

@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;
    }
}

Order Client

public void acceptOrder(OrderResponse orderResponse) {

    try {
        PostDocumentResponse messageAcknowledgment = (PostDocumentResponse) getWebServiceTemplate().marshalSendAndReceive(URI, orderResponse, message -> setSoapHeaderNamespacesAndCredentials((SoapMessage) message));
    } catch (Exception e) {
        logger.error("Soap fault occurred when accepting order.", e);
    }
}

This is where I want to use the Moxy implementation of jaxb.

POM.xml

<dependency>
       <groupId>org.eclipse.persistence</groupId>
        <artifactId>org.eclipse.persistence.moxy</artifactId>
        <version>2.6.0</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jaxb</groupId>
        <artifactId>jaxb-runtime</artifactId>
        <version>2.2.11</version>
</dependency>
0

There are 0 best solutions below