1

I have two wsdl files and I need the path to be relative.

Mac Result:

File01Service.java excerpt:

wsdlLocation = "/service-api-definition/File01.wsdl"

File02Service.java excerpt:

wsdlLocation = "/service-api-definition/File02.wsdl"

PC Result:

File01Service.java excerpt:

wsdlLocation = "C:/Users/USERNAME/git/src/main/resources/service-api-definition/File01.wsdl

File02Service.java excerpt:

wsdlLocation = "C:/Users/USERNAME/git/src/main/resources/service-api-definition/File02.wsdl

Here is the excerpt from my pom.xml

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <version>2.5</version>
            <configuration>
                <sourceDestDir>target/generated-sources/wsdlimport/Service1.0</sourceDestDir>
                <wsdlDirectory>${basedir}/src/main/resources/service-api-definition/</wsdlDirectory>
                <vmArgs>
                    <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
                </vmArgs>
                <args>
                    <arg>-B-XautoNameResolution</arg>
                </args>
                <verbose>true</verbose>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.jvnet.jaxb2_commons</groupId>
                    <artifactId>jaxb2-namespace-prefix</artifactId>
                    <version>1.3</version>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <id>wsdla-exec</id>
                    <goals>
                    <goal>wsimport</goal>
                    </goals>
                    <configuration>
                        <wsdlLocation>/service-api-definition/File01.wsdl</wsdlLocation>
                    </configuration>
                </execution>
                <execution>
                    <id>wsdlb-exec</id>
                    <goals>
                    <goal>wsimport</goal>
                    </goals>
                    <configuration>
                        <wsdlLocation>/service-api-definition/File02.wsdl</wsdlLocation>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>add-source</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>add-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>target/generated-sources/wsdlimport/Service1.0</source>
                  </sources>
                </configuration>
              </execution>
            </executions>
        </plugin>
    </plugins>
</build>

I'm struggling to understand why the same project can produce two different results depending on platform. I need both machines to produce viable and identical jars. The mac is producing the correct result. Can someone help explain how the PC isn't doing this?

Thanks!

Greg H
  • 23
  • 9
  • I think there's a comment in here, or a workaround which might work for you! [Controlling jax-ws wsdllocation attribute values absolute path with jaxws mav](https://stackoverflow.com/questions/9802487/controlling-jax-ws-wsdllocation-attribute-values-absolute-path-with-jaxws-mav?rq=1) – JGlass Jan 25 '18 at 16:55
  • I have read that question and comments and can confirm that those proposed solutions/workarounds don't work for this situation. There is something else going on that these similar stackoverflow questions/answers haven't helped with. – Greg H Jan 25 '18 at 17:04
  • Is it an internal WSDL URL on your own network, e.g on a different server than your current server - only asking as you could just use http:\\ instead of file:// though I know that means the endpoint has to be available (they aren't always are) when your application is started. – JGlass Jan 25 '18 at 17:08
  • It needs to be a local resource file within the jar itself once deployed, as the mac does it, it is a relative path. no http:\\ or file:// – Greg H Jan 25 '18 at 17:15

0 Answers0