Axis 1.7.1 依赖性问题 - 生成的存根中出错 class
Axis 1.7.1 dependency issue - error in generated stub class
我是 Web 服务、Axis 2 和 maven 的新手,但我的硕士论文需要它。我已成功创建并测试了本教程中的 SOAP Web 服务:Web service Tutorial
现在我想创建一个 MavenProject,我可以在其中为该服务创建客户端 classes 和存根,就像在本教程中一样:Client Tutorial 通过使用 axis2-wsdl2code-maven-plugin。这一代工作正常,但我每次都会在 Stub-class.
中遇到错误
错误是:org.apache。axis2.xmlbeans 无法解析为类型。这是我在存根中遇到的唯一错误。例如,这是一个出现错误的方法(第 5 行 org.apache.axis2.xmlbeans.XmlBeansXMLReader):
private org.apache.axiom.om.OMElement toOM(
final com.mycompany.axisservice3.SayOnlyOneHelloDocument param)
throws org.apache.axis2.AxisFault {
org.apache.axiom.om.OMXMLParserWrapper builder = org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder(new javax.xml.transform.sax.SAXSource(
new org.apache.axis2.xmlbeans.XmlBeansXMLReader(param,
_xmlOptions), new org.xml.sax.InputSource()));
try {
return builder.getDocumentElement(true);
} catch (java.lang.Exception e) {
throw org.apache.axis2.AxisFault.makeFault(e);
}
}
其余生成的 classes 没有错误,看起来没问题。
所以我觉得肯定是依赖问题,因为系统找不到包org.apache.axis2.xmlbeans。我使用的是最新版本的 Apache Axis 2 (1.7.1) 和 Maven 2。所以我已经将视频中的依赖项调整为 Maven Repository-Website 中的最新版本。
Axis2 Runtime 加载成功并在eclipse 中配置。路径和环境变量已设置。
这是我当前的客户端 POM:
<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>org.andy</groupId>
<artifactId>AxisService3Client</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>target/generated-sources/axis2/wsdl2code/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-wsdl2code-maven-plugin</artifactId>
<version>1.7.1</version>
<executions>
<execution>
<goals>
<goal>wsdl2code</goal>
</goals>
<configuration>
<unpackClasses>true</unpackClasses>
<databindingName>xmlbeans</databindingName>
<packageName>org.andy.ws</packageName>
<wsdlFile>src/main/resources/wsdl/HelloService.wsdl</wsdlFile>
<syncMode>sync</syncMode>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId>
<version>1.2.18</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-impl</artifactId>
<version>1.2.18</version>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.neethi</groupId>
<artifactId>neethi</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.schema</groupId>
<artifactId>XmlSchema</artifactId>
<version>1.4.7</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
</dependencies>
非常感谢您的帮助!
添加以下依赖:
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-xmlbeans</artifactId>
<version>1.7.1</version>
</dependency>
我必须添加以下依赖项,
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-xmlbeans</artifactId>
<version>1.7.1</version>
</dependency>
然后项目构建成功。
我是 Web 服务、Axis 2 和 maven 的新手,但我的硕士论文需要它。我已成功创建并测试了本教程中的 SOAP Web 服务:Web service Tutorial
现在我想创建一个 MavenProject,我可以在其中为该服务创建客户端 classes 和存根,就像在本教程中一样:Client Tutorial 通过使用 axis2-wsdl2code-maven-plugin。这一代工作正常,但我每次都会在 Stub-class.
中遇到错误错误是:org.apache。axis2.xmlbeans 无法解析为类型。这是我在存根中遇到的唯一错误。例如,这是一个出现错误的方法(第 5 行 org.apache.axis2.xmlbeans.XmlBeansXMLReader):
private org.apache.axiom.om.OMElement toOM(
final com.mycompany.axisservice3.SayOnlyOneHelloDocument param)
throws org.apache.axis2.AxisFault {
org.apache.axiom.om.OMXMLParserWrapper builder = org.apache.axiom.om.OMXMLBuilderFactory.createOMBuilder(new javax.xml.transform.sax.SAXSource(
new org.apache.axis2.xmlbeans.XmlBeansXMLReader(param,
_xmlOptions), new org.xml.sax.InputSource()));
try {
return builder.getDocumentElement(true);
} catch (java.lang.Exception e) {
throw org.apache.axis2.AxisFault.makeFault(e);
}
}
其余生成的 classes 没有错误,看起来没问题。
所以我觉得肯定是依赖问题,因为系统找不到包org.apache.axis2.xmlbeans。我使用的是最新版本的 Apache Axis 2 (1.7.1) 和 Maven 2。所以我已经将视频中的依赖项调整为 Maven Repository-Website 中的最新版本。
Axis2 Runtime 加载成功并在eclipse 中配置。路径和环境变量已设置。
这是我当前的客户端 POM:
<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>org.andy</groupId>
<artifactId>AxisService3Client</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>target/generated-sources/axis2/wsdl2code/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-wsdl2code-maven-plugin</artifactId>
<version>1.7.1</version>
<executions>
<execution>
<goals>
<goal>wsdl2code</goal>
</goals>
<configuration>
<unpackClasses>true</unpackClasses>
<databindingName>xmlbeans</databindingName>
<packageName>org.andy.ws</packageName>
<wsdlFile>src/main/resources/wsdl/HelloService.wsdl</wsdlFile>
<syncMode>sync</syncMode>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId>
<version>1.2.18</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-impl</artifactId>
<version>1.2.18</version>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.neethi</groupId>
<artifactId>neethi</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.schema</groupId>
<artifactId>XmlSchema</artifactId>
<version>1.4.7</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
</dependencies>
非常感谢您的帮助!
添加以下依赖:
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-xmlbeans</artifactId>
<version>1.7.1</version>
</dependency>
我必须添加以下依赖项,
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-xmlbeans</artifactId>
<version>1.7.1</version>
</dependency>
然后项目构建成功。