Estou tentando criar um service SOAP com WSDL link → WSDL file example: A sample SOAP web service contract | Tom Donohue
Consegui configurar a classe config para fornecer o wsdl, mas quando tento criar o Endpoint para pegar algo do BD o sistema solicitou criar um bean para classe book provida do WSDL e para isso usei @EnableJpaRepositories("com.package.Book")
e neste momento o wsdl retornou status 404.
EnableWs
@Configuration
public class WebServiceConfig extends WsConfigurerAdapter {
@Bean
public ServletRegistrationBean<Servlet> messageDispatcherServlet(ApplicationContext applicationContext) {
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(applicationContext);
return new ServletRegistrationBean<>(servlet, "/bookstore/ws/*");
}
@Bean(name = "books")
public Wsdl11Definition defaultWsdl11Definition() {
SimpleWsdl11Definition wsdl11Definition = new SimpleWsdl11Definition();
wsdl11Definition.setWsdl(new ClassPathResource("/wsdl/bookstore.wsdl"));
return wsdl11Definition;
}
}
Endpoint
public class BookEndpoint {
private static final String NAMESPACE_URI = "uri*****";
private BookRepository repository;
@Autowired
public BookEndpoint(BookRepository repository) {
this.repository = repository;
// TODO Auto-generated constructor stub
}
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "GetAllBooks")
@ResponsePayload
public GetAllBooksResponse getBooks(@RequestPayload GetAllBooks request) {
ObjectFactory factory = new ObjectFactory();
GetAllBooksResponse response = factory.createGetAllBooksResponse();
response.getBook().addAll(repository.findAll());
return response;
}
}
@SpringBootApplication
@EntityScan(basePackages = { "com.wsdl.Book" })
@ComponentScan("com.wsdl.Book")
@EnableJpaRepositories(basePackageClasses = com.estudo.wsdl.Book.class)
public class ServiceBookStoreApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceBookStoreApplication.class, args);
}
}
2021-12-03 18:09:08.719 INFO 21416 --- [ restartedMain] c.estudo.ServiceBookStoreApplication : Starting ServiceBookStoreApplication using Java 11.0.13 on DESKTOP with PID 21416 (C:\Users\Estudo\Documents\EstudoSpringboot-SOAP\ServiceBookStore\target\classes started by Estudo in C:\Users\Estudo\Documents\EstudoSpringboot-SOAP\ServiceBookStore)
2021-12-03 18:09:08.720 INFO 21416 --- [ restartedMain] c.estudo.ServiceBookStoreApplication : No active profile set, falling back to default profiles: default
2021-12-03 18:09:08.811 INFO 21416 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2021-12-03 18:09:08.811 INFO 21416 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2021-12-03 18:09:09.408 INFO 21416 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-12-03 18:09:09.440 INFO 21416 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 21 ms. Found 0 JPA repository interfaces.
2021-12-03 18:09:10.053 INFO 21416 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [org.springframework.ws.config.annotation.DelegatingWsConfiguration$$EnhancerBySpringCGLIB$$e2738ba6] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-03 18:09:10.111 INFO 21416 --- [ restartedMain] .w.s.a.s.AnnotationActionEndpointMapping : Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
2021-12-03 18:09:10.603 INFO 21416 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-12-03 18:09:10.615 INFO 21416 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-12-03 18:09:10.616 INFO 21416 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.55]
2021-12-03 18:09:10.743 INFO 21416 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-12-03 18:09:10.744 INFO 21416 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1932 ms
2021-12-03 18:09:11.013 INFO 21416 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2021-12-03 18:09:11.078 INFO 21416 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.32.Final
2021-12-03 18:09:11.258 INFO 21416 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2021-12-03 18:09:11.398 INFO 21416 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2021-12-03 18:09:12.112 INFO 21416 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2021-12-03 18:09:12.153 INFO 21416 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.SQLServer2012Dialect
2021-12-03 18:09:12.674 INFO 21416 --- [ restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2021-12-03 18:09:12.686 INFO 21416 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2021-12-03 18:09:12.748 WARN 21416 --- [ restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2021-12-03 18:09:13.179 INFO 21416 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2021-12-03 18:09:13.220 INFO 21416 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2021-12-03 18:09:13.235 INFO 21416 --- [ restartedMain] c.estudo.ServiceBookStoreApplication : Started ServiceBookStoreApplication in 5.016 seconds (JVM running for 6.42)
localhost:8080/bookstore/ws/books.wsdl
# Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Fri Dec 03 17:16:43 BRT 2021
There was an unexpected error (type=Not Found, status=404).
No message available