我想使用wsdl从头开始创建一个apache cxf maven项目。我需要使用wsdl2java。我首先找不到wsdl的原型。当我尝试
mvn archetype:generate -Dfilter = org.apache.cxf.archetype:
我只看到这些。首先没有wsdl的原型吗?如果没有,有人可以推荐最有效的方法吗?感谢
选择原型: 1:远程 - > org.apache.cxf.archetype:cxf-jaxrs-service(简单的CXF JAX-RS webap) p服务使用Spring配置) 2:远程 - > org.apache.cxf.archetype:cxf-jaxws-javafirst(创建一个项目 从Java代码开始开发Web服务)
答案 0 :(得分:0)
我总是为生成的wsdl创建子模块。 Eclipse有路径问题 - 这个模块不需要多次编译。
对于客户:
<properties>
<wsdl.dir>${basedir}/src/main/resources/axis2</wsdl.dir>
<generateServerSide>false</generateServerSide>
<sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version><!--$NO-MVN-MAN-VER$ -->
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${sourceRoot}</sourceRoot>
<defaultOptions>
<bindingFiles>
<bindingFile>${wsdl.dir}/binding.xml</bindingFile>
</bindingFiles>
</defaultOptions>
<wsdlOptions>
<wsdlOption>
<wsdl>${wsdl.dir}/first.wsdl</wsdl>
<packagenames>
<packagename>com.company.gen.first</packagename>
</packagenames>
<extraargs>
<extraarg>-impl</extraarg>
<extraarg>-autoNameResolution</extraarg>
<extraarg>-wsdlLocation</extraarg>
<wsdlurl />
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin> <!-- for idea/eclipse -->
<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>${sourceRoot}</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
对于服务器:
<execution>
<id>first</id>
<goals>
<goal>wsdl2code</goal>
</goals>
<configuration>
<generateServerSide>${generateServerSide}</generateServerSide>
<generateAllClasses>${generateServerSide}</generateAllClasses>
<generateServicesXml>${generateServerSide}</generateServicesXml>
<generateServerSideInterface>${generateServerSide}</generateServerSideInterface>
<wsdlFile>${wsdl.dir}/first.wsdl</wsdlFile>
<packageName>com.company.gen.first</packageName>
<unpackClasses>true</unpackClasses>
<syncMode>sync</syncMode>
<namespaceURIs>
<namespaceURI>
<uri>http://uri.company.com</uri>
<packageName>com.company.gen.first</packageName>
</namespaceURI>
</namespaceURIs>
</configuration>
</execution>