JAXWS CXF WSDL first + MyEclipse + Maven Byron自學視頻03

    技术2022-05-19  19

    JAXWS CXF WSDL first + MyEclipse + Maven Byron自學視頻03

    Description: 使用 Apache CXF 搭配 wsdl2java 調用 WebService範例來源: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/wsdl_first/Tags: jaxws, cxf, apache, webservice, myeclipse, maven, hello world, java, eclipse, byron, wsdl2java, wsdl first, jetty, tomcat

     

    Powered by VideoBam - Free Video Hosting

     

    提及技巧:

    * 在 Maven plugins 中, 引用 cxf-codegen-plugin 的 goal:wsdl2java, 執行 phase:generate-sources, 產生 Client端所需 class 的源碼

     

     

    pom.xml

    <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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.wyd.jaxws</groupId> <artifactId>jaxws-cxf-wsdl</artifactId> <version>0.0.1-SNAPSHOT</version> <properties> <cxf.version>2.3.3</cxf.version> </properties> <dependencies> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-jaxws</artifactId> <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-http</artifactId> <version>${cxf.version}</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.1</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-codegen-plugin</artifactId> <version>${cxf.version}</version> <executions> <execution> <id>generate-sources</id> <phase>generate-sources</phase> <configuration> <!-- 默認的 產生source檔 存放位置, 故可省略不寫 <sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot> --> <wsdlOptions> <wsdlOption> <wsdl>${basedir}/src/main/wsdl/ZzhelloWorld.wsdl</wsdl> </wsdlOption> </wsdlOptions> </configuration> <goals> <goal>wsdl2java</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project>


    最新回复(0)