create soap service with spring boot from xsd without auto-generating classes
<p>I am a beginner in using spring boot and I am trying to migrate a spring application to spring boot and i am getting some difficulties when trying to create a soap service with spring-ws using a xsd.</p>

<p>My xsd looks like this:</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;xs:schema attributeFormDefault="unqualified" 
            elementFormDefault="unqualified" 
            targetNamespace="ro.orange.PegaWS" 
            xmlns:xs="http://www.w3.org/2001/XMLSchema" 
            xmlns:tns="ro.orange.PegaWS"&gt;

   &lt;xs:element name="getStockDetailsRequest" type="tns:getStockDetailsRequest"/&gt;
   &lt;xs:element name="getStockDetailsResponse" type="tns:getStockDetailsResponse"/&gt;
   &lt;xs:complexType name="getStockDetailsRequest"&gt;
      &lt;xs:sequence&gt;
         &lt;xs:element minOccurs="0" name="userData" type="tns:userData"/&gt;
         &lt;xs:element maxOccurs="unbounded" minOccurs="0" name="oaCodes" type="xs:string"/&gt;
      &lt;/xs:sequence&gt;
   &lt;/xs:complexType&gt;
   &lt;xs:complexType name="userData"&gt;
      &lt;xs:sequence&gt;
         &lt;xs:element minOccurs="0" name="dealerCode" type="xs:string"/&gt;
         &lt;xs:element minOccurs="0" name="department" type="xs:string"/&gt;
         &lt;xs:element minOccurs="0" name="userName" type="xs:string"/&gt;
      &lt;/xs:sequence&gt;
   &lt;/xs:complexType&gt;
   &lt;xs:complexType name="getStockDetailsResponse"&gt;
      &lt;xs:sequence&gt;
          &lt;xs:element name="name" type="xs:string"/&gt;
      &lt;/xs:sequence&gt;
   &lt;/xs:complexType&gt;
&lt;/xs:schema&gt;
</code></pre>

<p>I build using maven:</p>

<pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;

  &lt;groupId&gt;orange.com&lt;/groupId&gt;
  &lt;artifactId&gt;prstutorial&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;jar&lt;/packaging&gt;

    &lt;parent&gt;
        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
        &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
        &lt;version&gt;1.3.5.RELEASE&lt;/version&gt;
    &lt;/parent&gt;

  &lt;name&gt;prstutorial&lt;/name&gt;
  &lt;url&gt;http://maven.apache.org&lt;/url&gt;

  &lt;properties&gt;
    &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
    &lt;java.version&gt;1.8&lt;/java.version&gt;
  &lt;/properties&gt;

  &lt;dependencies&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
        &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
    &lt;/dependency&gt;

    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
        &lt;artifactId&gt;spring-boot-starter-ws&lt;/artifactId&gt;
    &lt;/dependency&gt;

    &lt;dependency&gt;
        &lt;groupId&gt;wsdl4j&lt;/groupId&gt;
        &lt;artifactId&gt;wsdl4j&lt;/artifactId&gt;
    &lt;/dependency&gt;

    &lt;dependency&gt;
      &lt;groupId&gt;junit&lt;/groupId&gt;
      &lt;artifactId&gt;junit&lt;/artifactId&gt;
      &lt;version&gt;4.12&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;

  &lt;/dependencies&gt;

      &lt;build&gt;
        &lt;plugins&gt;
            &lt;plugin&gt;
                &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
            &lt;/plugin&gt;

            &lt;plugin&gt;
                &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                &lt;artifactId&gt;jaxb2-maven-plugin&lt;/artifactId&gt;
                &lt;version&gt;1.6&lt;/version&gt;
                &lt;executions&gt;
                    &lt;execution&gt;
                        &lt;id&gt;xjc&lt;/id&gt;
                        &lt;goals&gt;
                            &lt;goal&gt;xjc&lt;/goal&gt;
                        &lt;/goals&gt;
                    &lt;/execution&gt;
                &lt;/executions&gt;
                &lt;configuration&gt;
                    &lt;schemaDirectory&gt;${project.basedir}/src/main/resources/META-INF/schema&lt;/schemaDirectory&gt;
                    &lt;outputDirectory&gt;${project.basedir}/src/main/java&lt;/outputDirectory&gt;
                    &lt;clearOutputDir&gt;false&lt;/clearOutputDir&gt;
                &lt;/configuration&gt;
            &lt;/plugin&gt;
        &lt;/plugins&gt;
    &lt;/build&gt;
&lt;/project&gt;
</code></pre>

<p>I am also create the soap service here:</p>

<pre><code>package ro.orange.acrm.proxy.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
import org.springframework.boot.context.embedded.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.web.servlet.DispatcherServlet;
import org.springframework.ws.config.annotation.EnableWs;
import org.springframework.ws.transport.http.MessageDispatcherServlet;
import org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition;
import org.springframework.ws.wsdl.wsdl11.Wsdl11Definition;
import org.springframework.xml.xsd.SimpleXsdSchema;
import org.springframework.xml.xsd.XsdSchema;

@EnableWs
@Configuration
public class WebServicesConfig {

    private static String SCHEMA_LOCATION = "META-INF/schema/stocks.xsd";

    @Value("${NRSSmartPadServiceEndPointWSDL}")
    private String nrsSmartPadService;

    @Bean
    public DispatcherServlet dispatcherServlet() {
        return new DispatcherServlet();
    }

    @Bean
    public ServletRegistrationBean dispatcherServletRegistration() {
        ServletRegistrationBean registration = new ServletRegistrationBean(dispatcherServlet(), "/rest/*");
        registration.setName(DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME);
        return registration;
    }

    @Bean
    public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
        MessageDispatcherServlet servlet = new MessageDispatcherServlet();
        servlet.setApplicationContext(applicationContext);
        servlet.setTransformWsdlLocations(true);
        return new ServletRegistrationBean(servlet, "/*");
    }

    @Bean(name = "PegaWS")
    public Wsdl11Definition defaultWsdl11Definition() {
         DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
         wsdl11Definition.setPortTypeName("PegaWS");
         wsdl11Definition.setLocationUri("/PegaWS");
         wsdl11Definition.setTargetNamespace("ro.orange.PegaWS");
         wsdl11Definition.setSchema(countriesSchema());
         return wsdl11Definition;
    }

    @Bean
    public XsdSchema countriesSchema() {
        return new SimpleXsdSchema(new ClassPathResource(SCHEMA_LOCATION));
    }
}
</code></pre>

<p>Maven auto-generates my classes in package pegaws.orange.ro. However i need to reuse my classes from the current application and not create new ones. </p>

<p>For example it creates the class in package pegaws.orange.ro/UserData.java but i need to reuse my class from package ro.orange.beans/UserData.java.</p>

<p>Is this possible, or do I need to accept the auto-generated classes? </p>

<p>Thank you.</p>