Henrik Walland Lund
Henrik Walland Lund

Reputation: 142

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?

Upvotes: 3

Views: 410

Answers (2)

The Frozen One
The Frozen One

Reputation: 291

Thanks a lot, I was going mad about this one. I spent about 4 hours in reading docs, try, swear, read again, digging in the SI sources, try again, swear even louder until I found your post...

I think it's mentioned nowhere else that the adapter declaration is required! At least I managed to convert from your fancy Java config to xml ;-)

  <bean id="endpointAdapter" class="org.springframework.ws.server.endpoint.adapter.MessageEndpointAdapter" />

Once again, THANK YOU!

Upvotes: 0

Henrik Walland Lund
Henrik Walland Lund

Reputation: 142

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.

Upvotes: 3

Related Questions