Java 从xsd使用spring引导创建soap服务,而不自动生成类

Java 从xsd使用spring引导创建soap服务,而不自动生成类,java,spring,maven,soap,xsd,Java,Spring,Maven,Soap,Xsd,我是使用SpringBoot的初学者,我正在尝试将spring应用程序迁移到SpringBoot,并且在尝试使用xsd使用SpringWS创建soap服务时遇到了一些困难 我的xsd如下所示: <?xml version="1.0" encoding="UTF-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified"

我是使用SpringBoot的初学者,我正在尝试将spring应用程序迁移到SpringBoot,并且在尝试使用xsd使用SpringWS创建soap服务时遇到了一些困难

我的xsd如下所示:

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

   <xs:element name="getStockDetailsRequest" type="tns:getStockDetailsRequest"/>
   <xs:element name="getStockDetailsResponse" type="tns:getStockDetailsResponse"/>
   <xs:complexType name="getStockDetailsRequest">
      <xs:sequence>
         <xs:element minOccurs="0" name="userData" type="tns:userData"/>
         <xs:element maxOccurs="unbounded" minOccurs="0" name="oaCodes" type="xs:string"/>
      </xs:sequence>
   </xs:complexType>
   <xs:complexType name="userData">
      <xs:sequence>
         <xs:element minOccurs="0" name="dealerCode" type="xs:string"/>
         <xs:element minOccurs="0" name="department" type="xs:string"/>
         <xs:element minOccurs="0" name="userName" type="xs:string"/>
      </xs:sequence>
   </xs:complexType>
   <xs:complexType name="getStockDetailsResponse">
      <xs:sequence>
          <xs:element name="name" type="xs:string"/>
      </xs:sequence>
   </xs:complexType>
</xs:schema>
Maven自动在包pegaws.orange.ro中生成我的类。但是,我需要重用当前应用程序中的类,而不是创建新的类

例如,它在包pegaws.orange.ro/UserData.java中创建了类,但我需要重用包ro.orange.beans/UserData.java中的类

这是可能的,还是我需要接受自动生成的类

多谢各位

<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">
  <modelVersion>4.0.0</modelVersion>

  <groupId>orange.com</groupId>
  <artifactId>prstutorial</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.5.RELEASE</version>
    </parent>

  <name>prstutorial</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>1.8</java.version>
  </properties>

  <dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-ws</artifactId>
    </dependency>

    <dependency>
        <groupId>wsdl4j</groupId>
        <artifactId>wsdl4j</artifactId>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>

  </dependencies>

      <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxb2-maven-plugin</artifactId>
                <version>1.6</version>
                <executions>
                    <execution>
                        <id>xjc</id>
                        <goals>
                            <goal>xjc</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <schemaDirectory>${project.basedir}/src/main/resources/META-INF/schema</schemaDirectory>
                    <outputDirectory>${project.basedir}/src/main/java</outputDirectory>
                    <clearOutputDir>false</clearOutputDir>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
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));
    }
}