我正在尝试使用Apache CXF从现有的WSDL生成基于JAVA的Webservice客户端及其相关的XSD文件。为此,我使用下面列出的maven配置文件,其中basicall运行良好。
<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.testcamera</groupId>
<artifactId>TestCamera</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>TestCamera Maven App</name>
<properties>
<java.version>1.8</java.version>
<tomcat.version>9.0.4</tomcat.version>
<cxf.version>3.2.2</cxf.version>
</properties>
<build>
<!-- <finalName>???</finalName> -->
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<!-- encoding>UTF-8</encoding -->
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<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>
<sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/wsdls/ver10/device/wsdl/devicemgmt.wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<filtering>false</filtering>
<directory>src/main/resources</directory>
</resource>
<resource>
<filtering>false</filtering>
<directory>src/main/java</directory>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<testResources>
<testResource>
<filtering>false</filtering>
<directory>src/test/resources</directory>
</testResource>
<testResource>
<filtering>false</filtering>
<directory>src/test/java</directory>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
</testResources>
</build>
<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> -->
<!-- Jetty is needed if you're are not using the CXFServlet -->
<!-- <dependency> -->
<!-- <groupId>org.apache.cxf</groupId> -->
<!-- <artifactId>cxf-rt-transports-http-jetty</artifactId> -->
<!-- <version>${cxf.version}</version> -->
<!-- </dependency> -->
</dependencies>
</project>
&#13;
问题是我需要为此Web服务添加代理支持。这就是为什么我需要将以下依赖项添加到我的maven依赖项中,这会导致问题并向我显示错误。 这里是相关的POM.xml:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
cxf-rt-transports-http
之后的相关错误消息
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
&#13;
如果有人知道为什么会发生这种行为,那将会很棒!
相关的WSDL在以下URL下可用: https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl 注意:要查看wsdl的内容,您需要右键单击该页面并查看源代码!
提前致谢! 香美