I have WSDL and schema files provided by client. I need to create Spring-boot SOAP web service with this WSDL file. I have google it and all the examples that I can find, th
You can create WebServiceConfiguration java class in your packages.
@EnableWs
@Configuration
public class WebServiceConfig extends WsConfigurerAdapter {
@Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(applicationContext);
servlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean(servlet, "/ProjectName/*");
}
@Bean(name = "wsdlname")
public DefaultWsdl11Definition defaultWsdl11Definition (XsdSchema cityRequestSchema) {
DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
wsdl11Definition.setRequestSuffix("ByCountry");
wsdl11Definition.setResponseSuffix("City");
wsdl11Definition.setPortTypeName("Hotelport");
wsdl11Definition.setLocationUri("/ProjectName");
wsdl11Definition.setTargetNamespace("http://spring.io/guides/gs-producing-web-service");
wsdl11Definition.setSchema(cityRequestSchema);
return wsdl11Definition;
}
@Bean
public XsdSchema cityRequestSchema() {
return new SimpleXsdSchema(new ClassPathResource("CityRequest.xsd"));
}
After run as spring boot app...then copy paste this url in your browser. http://localhost:8080/ProjectName/wsdlname.wsdl
noted:localhost:8080 to replace with your tomcat port