I try to learn SpringBoot SOAP web-service implementation and don't understand why configuration methods not called. The configuration bean looks like this:
package hu.infokristaly.fileservice;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.ws.config.annotation.EnableWs;
import org.springframework.ws.config.annotation.WsConfigurerAdapter;
import org.springframework.ws.transport.http.MessageDispatcherServlet;
import org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition;
import org.springframework.xml.xsd.SimpleXsdSchema;
import org.springframework.xml.xsd.XsdSchema;
@Configuration
@EnableWs
public class SOAPWebServiceConfig extends WsConfigurerAdapter {
@Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(applicationContext);
servlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean(servlet, "/ws/*");
}
@Bean(name = "FileUploadServiceWsdl")
public DefaultWsdl11Definition calculatorServiceDefinition(XsdSchema calculatorServiceSchema) {
DefaultWsdl11Definition wsdlDefinition = new DefaultWsdl11Definition();
wsdlDefinition.setPortTypeName("FileUploadServicePort");
wsdlDefinition.setLocationUri("/ws/fileuplaod-service");
wsdlDefinition.setTargetNamespace("http://infokristaly.hu/fileuplaod");
wsdlDefinition.setSchema(fileUplaodServiceSchema());
return wsdlDefinition;
}
@Bean
public XsdSchema fileUplaodServiceSchema() {
return new SimpleXsdSchema(new ClassPathResource("fileupload.xsd"));
}
}
In other project the messageDispatcherServlet / fileUplaodServiceSchema / calculatorServiceDefinition methods called on startup.
Here is my Github repo
Please help me find solution. It's maybe just some misspell but I can't see the problem. Thanks for all suggestions!
If your configuratoins are in different packages, use @ComponentScan on application like this:
@SpringBootApplication
@ComponentScan(basePackages = {"hu.infokristaly"})
public class ForrasUploadSoapServerApplication {
private static ApplicationContext applicationContext;
public static void main(String[] args) {
SpringApplication.run(ForrasUploadSoapServerApplication.class, args);
}
}