2

A lot of reading I've done on this. Seems very staight-forward. If you see the pom file you can see that rather than creating the class files from a remote URL, I have the file that has to be part of the project. The commented out configuration works...finds WSDL and creates the correct files. When I try to drive that locally, nothing works. The version I show is where I try to use the maven ${project.basedir} variable. I have tried "/src/main/java", "src/main/java", hard coding the path. How do I do this? I have tried all of the examples I have seen. Here is my pom.xml

    <?xml version="1.0" encoding="UTF-8"?>
<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>com.mycompany</groupId>
    <artifactId>abc</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>abc</name>
    <description>consume soap</description>

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

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

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.ws</groupId>
            <artifactId>spring-ws-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
                <plugin>
                    <groupId>org.jvnet.jaxb2.maven2</groupId>
                    <artifactId>maven-jaxb2-plugin</artifactId>
                    <version>0.12.3</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>generate</goal>
                            </goals>
                        </execution>
                    </executions>

                <configuration>
                    <packageName>com.mycompany.abc.domain</packageName>
                    <wsdl>true</wsdl>
                    <xmlschema>false</xmlschema>
                    <schemaFiles>abc.wsdl</schemaFiles>
                    <schemaDirectory>${project.basedir}/src/main/resources</schemaDirectory>
                    <outputDirectory>${project.basedir}/src/main/java</outputDirectory>
                    <clearOutputDir>true</clearOutputDir>
                </configuration>

    <!-- THIS CONFIGURATION WORKS...IF IT COMES FROM A REMOTE PLACE
                    <configuration>
                        <schemaLanguage>WSDL</schemaLanguage>
                        <generatePackage>com.mycompany.abc.domain</generatePackage>
                        <schemas>
                            <schema>
                                <url>http://www.webservicex.com/stockquote.asmx?WSDL</url>
                            </schema>
                        </schemas>
                        <clearOutputDir>false</clearOutputDir>
                    </configuration>
    -->

                </plugin>
            </plugins>
        </pluginManagement>
    </build>

</project>
Travis
  • 203
  • 1
  • 3
  • 13
  • Anybody have any ideas? Just get a message about no schemas being created no matter how I run it when file is local – Travis Jan 26 '18 at 18:40

1 Answers1

11

After much experimenting, here is my solution. Still not sure why prior iterations wouldn't work...maybe I was crossing v1 & v2?

<configuration>
    <generatePackage>com.ezcorp.peoplesoft.ws</generatePackage>
    <schemaDirectory>${project.basedir}/src/main/resources/wsdl</schemaDirectory>
    <schemaIncludes>
        <include>*.wsdl</include>
    </schemaIncludes>
    <clearOutputDir>true</clearOutputDir>
</configuration>
Travis
  • 203
  • 1
  • 3
  • 13
  • Thank you. I was apparently missing the ${project.basedir}/ – guyland123 Jan 08 '19 at 17:51
  • I am trying to do this, but it puts all the classes in a flat structure, not in their packages as defined by their schema. https://stackoverflow.com/questions/62636121/maven-generatepackage-for-a-wsdl-generating-classes-from-schema-definition – Richard Jun 29 '20 at 10:42