javaee / metro-jax-ws

https://javaee.github.io/metro-jax-ws/
Other
132 stars 68 forks source link

wsimport and wsgen tools removed from Java 11 #1251

Closed mickaelbaron closed 5 years ago

mickaelbaron commented 6 years ago

Hi,

The new version of Java 11 does not supply the tools to import and generate WSDL (wsimport and wsgen).

Do you have an idea to solve this lack?

Mickael

fatihpense commented 6 years ago

You can download binaries here and add to path: https://javaee.github.io/metro-jax-ws/

However, I'm looking at removed imports right now: import javax.jws.... regards, Fatih

fatihpense commented 6 years ago

You should also add packages removed from JDK e.g.: 'com.sun.xml.ws:jaxws-ri:2.3.0.2'

Regards, Fatih

mickaelbaron commented 6 years ago

Hi,

Thanks. I'm not used to looking at into the binaries of Metro JAX-WS.

I'm going to test with Java 11 and the JAX-WS maven plugin.

Mickael

martinm1000 commented 6 years ago

@mickaelbaron Hi, I've never used this plugin but I now need to, and I'm using java 11. Any pointers on your tries with java 11 ?

mickaelbaron commented 6 years ago

Hi @martinm1000,

On the latest version of JAX-WS (2.3.1) you will see a new package dedicated to the JAX-WS Maven plugin. I hope this plugin will be available into the Maven repositories.

Mickael

martinm1000 commented 6 years ago

@mickaelbaron I guess we need to addthis specific dependency to the plugin definition in maven and all will then work ? Do you know that specific package ? is it https://mvnrepository.com/artifact/com.sun.xml.ws/jaxws-tools ?

soasada commented 6 years ago

Hi @mickaelbaron and @martinm1000,

I'm trying to use the new jaxws-maven-plugin to generate client code via WSDL with JDK 11, but I'm getting the following error:

The following artifacts could not be resolved: com.sun.xml.ws:jaxws-tools-bundle:jar:2.3.1, com.sun.xml.ws:jaxws-tools-bundle:jar:sources:2.3.1: Could not find artifact com.sun.xml.ws:jaxws-tools-bundle:jar:2.3.1 in central

I check the central maven repository and this artifact does not exists. My plugin configuration is:

<plugin>
                <groupId>com.sun.xml.ws</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <version>2.3.1</version>

                <executions>
                    <execution>
                        <goals>
                            <goal>wsimport</goal>
                        </goals>
                        <configuration>
                            <bindingFiles>
                                <bindingFile>${project.basedir}/src/main/resources/wsdl/bindings.xml</bindingFile>
                            </bindingFiles>
                            <sourceDestDir>${project.basedir}/src/main/java</sourceDestDir>
                            <wsdlDirectory>${project.basedir}/src/main/resources/wsdl</wsdlDirectory>
                            <wsdlLocation>classpath:wsdl/example.wsdl</wsdlLocation>
                            <packageName>com.example.generated</packageName>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Any ideas? Where am I wrong?

mickaelbaron commented 6 years ago

Dear @soasada,

I've the same error than you

The following artifacts could not be resolved: com.sun.xml.ws:jaxws-tools-bundle:jar:2.3.1, com.sun.xml.ws:jaxws-tools-bundle:jar:sources:2.3.1: Failure to find com.sun.xml.ws:jaxws-tools-bundle:jar:2.3.1 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

At this moment, i've have no idea.

I'm going to create an issue on the new repository hosted by Eclipse foundation => https://github.com/eclipse-ee4j/metro-jax-ws

Mickael

soasada commented 6 years ago

Dear @soasada,

I've the same error than you

The following artifacts could not be resolved: com.sun.xml.ws:jaxws-tools-bundle:jar:2.3.1, com.sun.xml.ws:jaxws-tools-bundle:jar:sources:2.3.1: Failure to find com.sun.xml.ws:jaxws-tools-bundle:jar:2.3.1 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

At this moment, i've have no idea.

I'm going to create an issue on the new repository hosted by Eclipse foundation => https://github.com/eclipse-ee4j/metro-jax-ws

Mickael

Perfect, what are the eclipse artifacts names?

mickaelbaron commented 6 years ago

Hi,

eclipse artifacts names?

What do you mean? the Maven artifacts ? I've the same than you

`

com.sun.xml.ws jaxws-maven-plugin ${jaxws.version} wsgen fr.mickaelbaron.helloworldwebservice.HelloWorldServiceImpl true true ` I've just compiled and deployed in local. ` $ git checkout tags/2.3.1 $ mvn install -Dmaven.test.skip=true (because i wanted to test quickly) ` These two dependencies (com.sun.xml.ws:jaxws-tools-bundle:jar:2.3.1, com.sun.xml.ws:jaxws-tools-bundle:jar:sources:2.3.1) are deployed in my Maven local repository and now it's working. Mickael
soasada commented 6 years ago

Do you know when they'll be at the maven remote repo? Could you please send me the link of the repos in order to download them?

mickaelbaron commented 6 years ago

Hi,

It's on my laptop;-)

At this moment the best solution for you is to generate yourself the artifacts

Mickael

soasada commented 6 years ago

Hi @mickaelbaron,

Yes, sorry for my question, I mean, where did you download the maven artifacts? I want to install in my local maven repo :)

mickaelbaron commented 6 years ago

You need to build the project with $ mvn clean install. After the compilation process, you will have into your local maven repo the missing dependencies

Mickael

hazendaz commented 6 years ago

@mickaelbaron It doesn't seem like this is goign to get fixed anytime soon. Can you drag the two build binaries and drop here and also on the mojohuas repo with similar raised issues you noted on? I think that woudl help quite a bit. For whatever reason I cannot get this to successfully build with jdk8, 9, 10, or 11 using your suggestion so I'm rather stuck.

t-d-chen commented 6 years ago

Hi @mickaelbaron Thanks for sharing the information! I ran the command "mvn clean install" under "../metro-jax-ws-master/jaxws-ri/bundles/jaxws-tools/jaxws-tools-bundle" and was able to install the two dependencies (com.sun.xml.ws:jaxws-tools-bundle:jar:2.3.1, com.sun.xml.ws:jaxws-tools-bundle:jar:sources:2.3.1) in my local Maven repository. However, I got the following error when I tried to build my project with Java 11:

[INFO] jaxws:wsimport args: [-keep, -s, 'myProjectFolder\target\generated-sources\wsimport', -d, 'myProjectFolder\target\classes', -encoding, UTF-8, -extension, -p, my.package.name, "myProjectFolder/WSDL/myWSDLName.wsdl"] parsing WSDL...

Exception in thread "main" java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.jvnet.jax_ws_commons.jaxws.Invoker.main(Invoker.java:73) Caused by: java.lang.NoClassDefFoundError: javax/xml/ws/WebServiceException at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016) ... Caused by: java.lang.ClassNotFoundException: javax.xml.ws.WebServiceException at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 28 more [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.306 s [INFO] Finished at: 2018-10-31T16:50:26-04:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.sun.xml.ws:jaxws-maven-plugin:2.3.1:wsimport (default) on project myProjectName: Mojo failed - check output -> [Help 1] [ERROR]

Here is my pom snippet: `

com.sun.xml.ws
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3.1</version>
<executions> 
    <execution> 
        <goals> 
            <goal>wsimport</goal> 
        </goals>
    </execution>
</executions>
<configuration>
    <wsdlDirectory>WSDL</wsdlDirectory>
        <wsdlFiles>
            <wsdlFile>myWSDLName.wsdl</wsdlFile>
        </wsdlFiles>
</configuration>

`

Any advice would be appreciated.

mickaelbaron commented 6 years ago

Hi @t-d-chen,

I suppose your project has a missing dependency when i see this error Caused by: java.lang.ClassNotFoundException: javax.xml.ws.WebServiceException. This class is located into this dependency jaxws-api-2.3.1.jar

Can you give your full pom.xml content?

For information, into my pom.xml file, I use this dependency for JAX-WS

<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>${jaxws.version}</version>
</dependency>

Mickael

t-d-chen commented 6 years ago

Hi Mickael,

Here is my full pom.xml. It works when is set to 1.8. I tried adding the jaxws-rt dependency but got the same error.

<?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.myGroupId</groupId>
    <artifactId>MyClient</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <dependencies>
<dependency>
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>jaxws-ri</artifactId>
    <version>2.3.1</version>
    <type>pom</type>
</dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.9</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.6</version>
        </dependency>
      <dependency>
         <groupId>UIControls</groupId>
         <artifactId>UIControls</artifactId>
         <version>1.0</version>
      </dependency>
    </dependencies>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>11</java.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
    </properties>
    <build>
    <resources>
      <resource>
        <directory>${project.basedir}\WSDL</directory>
        <includes>
          <include>MyWSDLFileName.wsdl</include>
        </includes>
      </resource>
      <resource>
        <directory>${project.basedir}\resources</directory>
        <includes>
          <include>version.properties</include>
        </includes>
      </resource>
    </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.0</version>
                 <configuration>
                    <archive>
                        <index>false</index>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>
                            <mainClass>ui.MyClient</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.8</version>
    <executions>
        <execution>
            <id>copy-dependencies</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>copy-dependencies</goal>
            </goals>
            <configuration>
                <outputDirectory>${project.build.directory}/lib</outputDirectory>
                <includeScope>runtime</includeScope>
            </configuration>
        </execution>
    </executions>
</plugin>
            <plugin>
      <groupId>org.apache.maven.plugins</groupId>      
      <artifactId>maven-assembly-plugin</artifactId>
      <version>3.1.0</version>
      <configuration>
        <archive>
          <manifest>
            <mainClass>ui.MyClient</mainClass>
          </manifest>
        </archive>
        <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
        <executions>
          <execution>
            <id>make-assembly</id> 
            <phase>package</phase> 
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </configuration>
    </plugin>
            <plugin>
                <groupId>com.sun.xml.ws</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <version>2.3.1</version>
                <executions> 
                    <execution> 
                        <goals> 
                            <goal>wsimport</goal> 
                        </goals>
                    </execution>
                </executions>
                        <configuration>
                            <wsdlDirectory>WSDL</wsdlDirectory>
                            <wsdlFiles>
                                <wsdlFile>MyWSDLFileName.wsdl</wsdlFile>
                            </wsdlFiles>
                            <sourceDestDir>${project.basedir}/src</sourceDestDir>
                        </configuration>
            </plugin>
           <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                             <sources>
                                <source>${project.basedir}/src</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Thanks, t-d-chen

mickaelbaron commented 6 years ago

Hi,

Can you replace

<groupId>com.sun.xml.ws</groupId>
    <artifactId>jaxws-ri</artifactId>
    <version>2.3.1</version>
    <type>pom</type>

By

<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.1</version>

Mickael

t-d-chen commented 6 years ago

Hi Mickael,

I tried jaxws-rt, and got the same error. I think the error is isolated to running "wsimport". The rest of my project can compile and run with Java 11. Do you have a simple WSDL file that you can try running "wsimport" on your computer?

Thanks, t-d-chen

mickaelbaron commented 6 years ago

Hi @t-d-chen,

To be honest, I've only tested with wsgen. I'm going to prepare a minimal POC to test all configuration about JAX-WS plugin.

Mickeel

gmsalex commented 6 years ago

I tried jaxws-rt, and got the same error. I think the error is isolated to running "wsimport". The rest of my project can compile and run with Java 11. Do you have a simple WSDL file that you can try running "wsimport" on your computer?

It is the EndorsedFilter.java which removes libraries from classpath that are missing in jdk 11. Try to make it "return false" recompile and install plugin locally and re-rerun wsimport goal. I was successful.

t-d-chen commented 6 years ago

It is the EndorsedFilter.java which removes libraries from classpath that are missing in jdk 11. Try to make it "return false" recompile and install plugin locally and re-rerun wsimport goal. I was successful.

It actually fixed the wsimport not running problem. Now I can run wsimport to generate code from WSDL and build my project. Many thanks to gmsalex and mickaelbaron!!!

trecloux commented 6 years ago

@t-d-chen Can you please publish your findings ? That would be super useful.

chli1 commented 6 years ago

This commit fixed the EndorsedFilter for me, however the implementation is a bit hacky and won't work for Java 12+.

https://github.com/chli1/metro-jax-ws/commit/a787ce581aa83b9b4692562f3a54c344ef255d75

nickbuc1 commented 6 years ago

@t-d-chen @gmsalex Any chance you could explain how you fixed the issue in more details? That would be really helpful.

vahidshirvani commented 6 years ago

Here is my solution that works in java 11 for WSDL files.

<?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">
    ...
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>mkdir</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>mkdir</executable>
                            <arguments>
                                <argument>-pv</argument>
                                <argument>target/generated-sources/wsimport</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>firstFile</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>java</executable>
                            <arguments>
                                <argument>-classpath</argument>
                                <classpath/>
                                <argument>com.sun.tools.ws.WsImport</argument>
                                <argument>-extension</argument>
                                <argument>-Xnocompile</argument>
                                <argument>-wsdllocation</argument>
                                <argument>/firstFile.wsdl</argument>
                                <argument>-s</argument>
                                <argument>target/generated-sources/wsimport</argument>
                                <argument>src/main/resources/firstFile.wsdl</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>secondFile</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>java</executable>
                            <arguments>
                                <argument>-classpath</argument>
                                <classpath/>
                                <argument>com.sun.tools.ws.WsImport</argument>
                                <argument>-extension</argument>
                                <argument>-Xnocompile</argument>
                                <argument>-wsdllocation</argument>
                                <argument>/secondFile.wsdl</argument>
                                <argument>-s</argument>
                                <argument>target/generated-sources/wsimport</argument>
                                <argument>src/main/resources/secondFile.wsdl</argument>
                            </arguments>
                        </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/wsimport</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>

        <!-- xml.bind module -->
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-core</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.3.0</version>
        </dependency>

        <!-- xml.ws module -->
        <dependency>
            <groupId>javax.xml.ws</groupId>
            <artifactId>jaxws-api</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-rt</artifactId>
            <version>2.3.0</version>
        </dependency>

        <!-- javax.activation -->
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1.1</version>
        </dependency>

        <!-- wsimport -->
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-tools</artifactId>
            <version>2.3.1</version>
            <scope>compile</scope>
        </dependency>

    </dependencies>
</project>
vahidshirvani commented 6 years ago

And here is my solution that works in java 11 for XSD files.

<?xml version="1.0"?>
<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">
 ...
    <build>
        <plugins>
            <plugin>
                <groupId>org.jvnet.jaxb2.maven2</groupId>
                <artifactId>maven-jaxb2-plugin</artifactId>
                <configuration>
                    <schemaIncludes>
                        <include>**/*.xsd</include>
                    </schemaIncludes>
                </configuration>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>

        <!-- module: java.xml.bind -->
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-core</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.3.0</version>
        </dependency>

        <!-- module: java.xml.ws -->
        <dependency>
            <groupId>javax.xml.ws</groupId>
            <artifactId>jaxws-api</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-rt</artifactId>
            <version>2.3.0</version>
        </dependency>

    </dependencies>
</project>

Worth mentioning that this plugin is able to read WSDL files as well. However it might not be able to generate all source files and if those are not necessary in your project then this is a more simple solution compared to exec-maven-plugin in my previous answer.

    <build>
        <plugins>
            <plugin>
                <groupId>org.jvnet.jaxb2.maven2</groupId>
                <artifactId>maven-jaxb2-plugin</artifactId>
                <executions>
                    <execution>
                        <id>wsdl</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <schemaLanguage>WSDL</schemaLanguage>
                            <schemaIncludes>
                                <include>**/*.wsdl</include>
                            </schemaIncludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

BTW your .xsd and .wsdl files must be under resources directory.

lukasj commented 5 years ago

fixed in 2.3.2 in https://github.com/eclipse-ee4j/metro-jax-ws repo

mickaelbaron commented 5 years ago

Hi, good news.

Do you have an idea on the availability of this new version on the Maven Repositories?

Mickael

lukasj commented 5 years ago

should be sometimes around mid Dec (end of Jan at the latest)

mickaelbaron commented 5 years ago

Cool,

And for the next issues what are the preference to submit them? https://github.com/eclipse-ee4j/metro-jax-ws or https://github.com/javaee/metro-jax-ws.

This transition period (JavaEE => Jarkarta EE) is so confused...

Mickael

lukasj commented 5 years ago

eclipse-ee4j/metro-jax-ws is the right place going forward

t-d-chen commented 5 years ago

trecloux, nickbuc1, Sorry, I didn't see your message sooner. Hopefully you already found a solution. In summary, below is what I did to make the wsimport in 2.3.1 work for me. But please note that these are just workarounds. I would wait for a new version of metro-jax-ws to be available in the Maven Repository.

  1. Run the command "mvn clean install" at "../metro-jax-ws-master/jaxws-ri/bundles/jaxws-tools/jaxws-tools-bundle". You’ll see a “target” folder generated with the following jar files: • jaxws-tools-bundle-2.3.1.jar • jaxws-tools-bundle-2.3.1-sources.jar Install the two jar files in your local Maven repository.
  2. Edit “..\metro-jax-ws-master\jaxws-ri\jaxws-maven-plugin\src\main\java\org\jvnet\jax_ws_commons\jaxws\EndorsedFilter.java” by modifying line 42 and line 45 to "return false". Run the command “mvn clean install” at “..\metro-jax-ws-master\jaxws-ri\jaxws-maven-plugin”. You’ll see a “target” folder generated with the following jar file: • jaxws-maven-plugin-2.3.1.jar Install the jar file in your local Maven repository.

Thanks, t-d-chen

stIncMale commented 5 years ago

@t-d-chen Thank you, that actually helped. However, I was not able to do the things exactly as you described. For example I was not able to build neither jaxws-maven-plugin nor the whole metro-jax-ws from https://github.com/javaee/metro-jax-ws because of the requited dependencies which are not available in Maven Central (however I was able to build jaxws-tools-bundle after changing the dependency from com.sun.xml.ws:wscompile:2.3.1-SNAPSHOT to com.sun.xml.ws:wscompile:2.3.1 in metro-jax-ws/jaxws-ri/bundles/jaxws-tools/jaxws-tools-bundle/pom.xml).

So I had to change the bytecode of EndorsedFilter.class in com.sun.xml.ws:jaxws-maven-plugin:2.3.1:jar which I downloaded from Maven Central. I used Recaf bytecode editor do to this task. Specifically I changed all pairs of instructions in method EndorsedFilter.accept from

iconst_1
ireturn //return 1, which is true

to

iconst_0
ireturn //return 0, which is false

Maybe these additions will be useful for someone. Though I hope that jaxws-maven-plugin from Jakarta EE will be released soon and people will not need to suffer form these hacks.

lukasj commented 5 years ago

@stIncMale development continues at https://github.com/eclipse-ee4j/metro-jax-ws where this has been already fixed; note that groupId of the plugin was changed to 'com.sun.xml.ws' there

stIncMale commented 5 years ago

@lukasj Thank you, but the the plugin has not been released from ee4j project based on what I can (or rather can not) see in Maven Central. Was it deployed to a different repository? If it is not released, I will try to build it myself.

note that groupId of the plugin was changed to 'com.sun.xml.ws' there

Actually, I see that the same groupId is used for the plugin in javaee project (at least in the master branch).

lukasj commented 5 years ago

It's in staging only (so still subject to change) but if you want to test it then use following repo/pluginrepo

<repository>
    <id>oss.sonatype.org</id>
    <name>OSS Sonatype Staging</name>
    <url>https://oss.sonatype.org/content/groups/staging</url>
</repository>
stIncMale commented 5 years ago

Good to know! Will try it tomorrow.

stIncMale commented 5 years ago

@lukasj com.sun.xml.ws:jaxws-maven-plugin:2.3.2 from https://oss.sonatype.org/content/groups/staging/com/sun/xml/ws/jaxws-maven-plugin/2.3.2/ transitively requires dependencies which are neither available in OSS Sonatype Staging nor in Maven Central: Execution ... of goal com.sun.xml.ws:jaxws-maven-plugin:2.3.2:wsimport failed: Plugin com.sun.xml.ws:jaxws-maven-plugin:2.3.2 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.jvnet.staxex:stax-ex:jar:1.8.1, com.sun.xml.stream.buffer:streambuffer:jar:1.5.7, org.jvnet.mimepull:mimepull:jar:1.9.11, com.sun.xml.fastinfoset:FastInfoset:jar:1.2.16

lukasj commented 5 years ago

@stIncMale should be OK now, thanks for the heads up, came just in time...

stIncMale commented 5 years ago

@lukasj Looks like now it's working. We will be very glad to use com.sun.xml.ws:jaxws-maven-plugin:2.3.2 once it's released. Do you have an anticipated release date?

stIncMale commented 5 years ago

While com.sun.xml.ws:jaxws-maven-plugin:2.3.2 is being in the staging one can also use com.helger.maven:jaxws-maven-plugin:2.6 (see https://github.com/mojohaus/jaxws-maven-plugin/issues/54#issuecomment-440597801) which is in Maven Central as an alternative to https://github.com/javaee/metro-jax-ws/issues/1251#issuecomment-443468986.

com.helger.maven:jaxws-maven-plugin:2.6 works for us with OpenJDK 11 and we are using it until com.sun.xml.ws:jaxws-maven-plugin:2.3.2 is released.

vinodnarayankar commented 5 years ago

Here is my solution that works in java 11 for WSDL files.

<?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">
    ...
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>mkdir</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>mkdir</executable>
                            <arguments>
                                <argument>-pv</argument>
                                <argument>target/generated-sources/wsimport</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>firstFile</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>java</executable>
                            <arguments>
                                <argument>-classpath</argument>
                                <classpath/>
                                <argument>com.sun.tools.ws.WsImport</argument>
                                <argument>-extension</argument>
                                <argument>-Xnocompile</argument>
                                <argument>-wsdllocation</argument>
                                <argument>/firstFile.wsdl</argument>
                                <argument>-s</argument>
                                <argument>target/generated-sources/wsimport</argument>
                                <argument>src/main/resources/firstFile.wsdl</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>secondFile</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>java</executable>
                            <arguments>
                                <argument>-classpath</argument>
                                <classpath/>
                                <argument>com.sun.tools.ws.WsImport</argument>
                                <argument>-extension</argument>
                                <argument>-Xnocompile</argument>
                                <argument>-wsdllocation</argument>
                                <argument>/secondFile.wsdl</argument>
                                <argument>-s</argument>
                                <argument>target/generated-sources/wsimport</argument>
                                <argument>src/main/resources/secondFile.wsdl</argument>
                            </arguments>
                        </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/wsimport</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>

        <!-- xml.bind module -->
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-core</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.3.0</version>
        </dependency>

        <!-- xml.ws module -->
        <dependency>
            <groupId>javax.xml.ws</groupId>
            <artifactId>jaxws-api</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-rt</artifactId>
            <version>2.3.0</version>
        </dependency>

        <!-- javax.activation -->
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1.1</version>
        </dependency>

        <!-- wsimport -->
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-tools</artifactId>
            <version>2.3.1</version>
            <scope>compile</scope>
        </dependency>

    </dependencies>
</project>

I am moving from Java 1.8 to 1.10. Above configuration has working fine. however, few methods in the class has different signature compare to 1.8 generated output. what might be the issue the this?

Would you please provide some inputs?

vinodnarayankar commented 5 years ago

Here is my solution that works in java 11 for WSDL files.

<?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">
    ...
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>mkdir</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>mkdir</executable>
                            <arguments>
                                <argument>-pv</argument>
                                <argument>target/generated-sources/wsimport</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>firstFile</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>java</executable>
                            <arguments>
                                <argument>-classpath</argument>
                                <classpath/>
                                <argument>com.sun.tools.ws.WsImport</argument>
                                <argument>-extension</argument>
                                <argument>-Xnocompile</argument>
                                <argument>-wsdllocation</argument>
                                <argument>/firstFile.wsdl</argument>
                                <argument>-s</argument>
                                <argument>target/generated-sources/wsimport</argument>
                                <argument>src/main/resources/firstFile.wsdl</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>secondFile</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>java</executable>
                            <arguments>
                                <argument>-classpath</argument>
                                <classpath/>
                                <argument>com.sun.tools.ws.WsImport</argument>
                                <argument>-extension</argument>
                                <argument>-Xnocompile</argument>
                                <argument>-wsdllocation</argument>
                                <argument>/secondFile.wsdl</argument>
                                <argument>-s</argument>
                                <argument>target/generated-sources/wsimport</argument>
                                <argument>src/main/resources/secondFile.wsdl</argument>
                            </arguments>
                        </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/wsimport</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>

        <!-- xml.bind module -->
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-core</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.3.0</version>
        </dependency>

        <!-- xml.ws module -->
        <dependency>
            <groupId>javax.xml.ws</groupId>
            <artifactId>jaxws-api</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-rt</artifactId>
            <version>2.3.0</version>
        </dependency>

        <!-- javax.activation -->
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1.1</version>
        </dependency>

        <!-- wsimport -->
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-tools</artifactId>
            <version>2.3.1</version>
            <scope>compile</scope>
        </dependency>

    </dependencies>
</project>

I am moving from Java 1.8 to 1.10. Above configuration has working fine. however, few methods in the class has different signature compare to 1.8 generated output. what might be the issue the this?

Would you please provide some inputs?

Some more research on this helped to understand that jaxws:bindings was missing and after adding jaxws:bindings , signature of the method started matching partially. Still I am missing something from binding. I would highly appreciate if any one helps to generate classes/bean for JAVA 10 from wsdl/xsd files. The code already works fine with java 8.