In my spring boot ws application, I created the jax-ws web service after the first approach to the contract. The web service is working, but I cannot auto-retry my other beans inside my web service.
How can I determine my web service in spring as a bean?
Below is my webservice impl class
@WebService(endpointInterface = "com.foo.bar.MyServicePortType")
@Service
public class MySoapService implements MyServicePortType {
@Autowired
private MyBean obj;
public Res method(final Req request) {
System.out.println("\n\n\nCALLING.......\n\n" + obj.toString());
return new Res();
}
}
MyServicePortType generated by maven from wsdl file
When I call this service (via SoapUi), it gives a NullPointerException, because the MyBean is not auto-sensing.
Since my application is built on spring boot, there is no xml file. I currently have an sun-jaxws.xmlendpoint configuration file . How to perform the following configuration in a spring boot application
<wss:binding url="/hello">
<wss:service>
<ws:service bean="#helloWs"/>
</wss:service>
</wss:binding>
Below is my SpringBootServletInitializer class
@Configuration
public class WebXml extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(final SpringApplicationBuilder application) {
return application.sources(WSApplication.class);
}
@Bean
public ServletRegistrationBean jaxws() {
final ServletRegistrationBean jaxws = new ServletRegistrationBean(new WSServlet(), "/jaxws");
return jaxws;
}
@Override
public void onStartup(final ServletContext servletContext) throws ServletException {
super.onStartup(servletContext);
servletContext.addListener(new WSServletContextListener());
}
}
thank