Henrik Walland Lund Henrik Walland Lund - 25 days ago 22
Java Question

Problems with MarshallingWebServiceInboundGateway

I'm using spring-boot with spring-integration and spring-ws to provide a SOAP web service as the entry point for my integration flow.

I've configured the inbound gateway thus:

@Bean
MarshallingWebServiceInboundGateway entryPoint() {
MarshallingWebServiceInboundGateway entryPoint = new MarshallingWebServiceInboundGateway(jaxb2Marshaller());
return entryPoint;
}

@Bean
Jaxb2Marshaller jaxb2Marshaller() {
Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
jaxb2Marshaller.setContextPath("my.schemas");
return jaxb2Marshaller;
}


The MessageDispatcherServlet has been configured thus:

@Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext context) {
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(context);
servlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean(servlet, "/entrypoint/*");
}


And the mapping:

@Autowired
MarshallingWebServiceInboundGateway entryPoint;

@Bean
UriEndpointMapping uriEndpointMapping() {
UriEndpointMapping uriEndpointMapping = new UriEndpointMapping();
uriEndpointMapping.setDefaultEndpoint(entryPoint);
return uriEndpointMapping;
}


According to the docs, I should be able to use the
MarshallingWebServiceInboundGateway
in this manner, but when I attempt a request on this endpoint in SoapUI, I get this:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring xml:lang="en">No adapter for endpoint [entryPoint]: Is your endpoint annotated with @Endpoint, or does it implement a supported interface like MessageHandler or PayloadEndpoint?</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


What am I missing here?

Answer

This problem was solved. I had to also define a bean as such:

@Bean
MessageEndpointAdapter messageEndpointAdapter() {
    MessageEndpointAdapter adapter = new MessageEndpointAdapter();
    return adapter;
}

I could find no reference to this in any of the docs, but this solved this particular issues for me.

Comments