Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
825 views
in Technique[技术] by (71.8m points)

soap - Execute jaxws-maven-plugin from java code

Need your help. I am using jaxws-maven-plugin to create JAXB annotated entities from wsdl file.

<plugin>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <version>2.3.2</version>
            <executions>
                <execution>
                    <id>generate-java-sources</id>
                    <phase>process-sources</phase>
                    <goals>
                        <goal>wsimport</goal>
                    </goals>
                    <configuration>
                        <catalog>${basedir}/src/main/resources/catalog.xml</catalog>
                        <sourceDestDir>${basedir}/src/main/java</sourceDestDir>
                        <extension>true</extension>
                        <wsdlFiles>
                            <wsdlFile>${basedir}/src/main/resources/wsdl/lastTest.wsdl</wsdlFile>
                        </wsdlFiles>
                        <wsdlLocation>/wsdl/lastTest.wsdl</wsdlLocation>
                    </configuration>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>javax.annotation</groupId>
                    <artifactId>javax.annotation-api</artifactId>
                    <version>1.3.2</version>
                </dependency>
                <dependency>
                    <groupId>javax.xml.bind</groupId>
                    <artifactId>jaxb-api</artifactId>
                    <version>2.3.1</version>
                </dependency>
                <dependency>
                    <groupId>javax.xml.ws</groupId>
                    <artifactId>jaxws-api</artifactId>
                    <version>2.3.1</version>
                </dependency>
                <dependency>
                    <groupId>javax.jws</groupId>
                    <artifactId>javax.jws-api</artifactId>
                    <version>1.1</version>
                </dependency>
            </dependencies>
        </plugin>

This works as expected, but I need to generate the result of this plugin from java code, as in this example for the library org.apache.cxf, example:

import org.apache.cxf.tools.wsdlto.WSDLToJava;

// CXF wsdl2java Example
public class WSDLToJavaCodeGenerator {
  public static void main(String[] args) {
    try {
      // you can also specify WSDL directly like http://localhost:8080/CXFTutorial/ChangeStudent?wsdl
      WSDLToJava.main(new String[] { "-d", "src", "ChangeStudent.wsdl" });
      System.out.println("finished %%%%%%%%%%");
    } catch (Exception e) {
      e.printStackTrace();
    }

  }

Please help me find the library! Thanks!

question from:https://stackoverflow.com/questions/65939292/execute-jaxws-maven-plugin-from-java-code

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...