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 .springframework.boot.web.servlet.ServletRegistrationBean;
import .springframework.context.ApplicationContext;
import .springframework.context.annotation.Bean;
import .springframework.context.annotation.Configuration;
import .springframework.core.io.ClassPathResource;
import .springframework.ws.config.annotation.EnableWs;
import .springframework.ws.config.annotation.WsConfigurerAdapter;
import .springframework.ws.transport.http.MessageDispatcherServlet;
import .springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition;
import .springframework.xml.xsd.SimpleXsdSchema;
import .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(";);
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!
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 .springframework.boot.web.servlet.ServletRegistrationBean;
import .springframework.context.ApplicationContext;
import .springframework.context.annotation.Bean;
import .springframework.context.annotation.Configuration;
import .springframework.core.io.ClassPathResource;
import .springframework.ws.config.annotation.EnableWs;
import .springframework.ws.config.annotation.WsConfigurerAdapter;
import .springframework.ws.transport.http.MessageDispatcherServlet;
import .springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition;
import .springframework.xml.xsd.SimpleXsdSchema;
import .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!
Share Improve this question asked Nov 16, 2024 at 10:57 Papp ZoltánPapp Zoltán 2091 silver badge8 bronze badges 1- I moved the FileUploadEndpoint / SOAPWebServiceConfig / FileUploadImpl to the same directory as ForrasUploadSoapServerApplication and configuration loaded. How funny. – Papp Zoltán Commented Nov 16, 2024 at 12:02
1 Answer
Reset to default 0If 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);
}
}