I am producing a SOAP WS using Spring boot. I am using contract first philosophy to develop this.
I have following schema
<?xml version="1.0" encoding="UTF-8"?> <xs:schema elementFormDefault="qualified" targetNamespace="www.google.com" version="1.0" xmlns:tns="www.google.com" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="CommandRequest" type="tns:CommandRequest"/> <xs:complexType name="CommandRequest"> <xs:sequence> <xs:element minOccurs="0" name="enterpriseId" type="xs:string"/> <xs:element minOccurs="0" name="pwd" type="xs:string"/> <xs:element minOccurs="0" name="command" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:element name="CommandResponse" type="tns:CommandResponse"/> <xs:complexType name="CommandResponse"> <xs:sequence> <xs:element name="code" type="xs:int"/> <xs:element minOccurs="0" name="message" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:schema> Configuration class
@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, "/cmd-service/*"); } @Bean(name = "command") public DefaultWsdl11Definition defaultWsdl11Definition(XsdSchema commandSchema) { DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition(); wsdl11Definition.setPortTypeName("CommandServicePort"); wsdl11Definition.setLocationUri("/cmd-service"); wsdl11Definition.setTargetNamespace("www.google.com"); wsdl11Definition.setSchema(commandSchema); return wsdl11Definition; } @Bean public XsdSchema countriesSchema() { return new SimpleXsdSchema(new ClassPathResource("CommandService.xsd")); } } EndPoint code
@Endpoint public class CommandEndPoint { private static final String NAMESPACE_URI = "www.google.com"; @PayloadRoot(namespace = NAMESPACE_URI, localPart = "CommandRequest") @ResponsePayload public JAXBElement<CommandResponse> command( @RequestPayload CommandRequest commandRequest) { } } The above code exposes one webservice at localhost:8090/cmd-service/command.wsdl.
I want expose two different wsdl (1.localhost:8090/service1/command.wsdl and 2. localhost:8090/service2/command.wsdl) using the same schema. Can any body suggest me how to solve this problem?