Using Spring-WS getWebServiceTemplate (). MarshalSendAndReceive How to tell Jaxb2Marshaller to use Eclipse Moxy Jaxb Implementation
I need to process an object using eclipse moxy with spring-ws. I am running a spring-boot project with spring-ws. I have included moxy jar and all jaxb.properties files in all model directories.
How to make spring-ws use moxy jaxb implementation?
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;
}
}
Customer order
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);
}
}
Here I want to use the mox implementation for joxb.
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>
+3
source to share
No one has answered this question yet
Check out similar questions: