Reputation: 315
i'm new to Web services, Axis 2 and maven, but i will need it for my master-thesis. I have successfully created and tested a SOAP Web service like in this Tutorial: Web service Tutorial
Now i want to create a MavenProject, where i'm able to create the client classes and stubs for this service like in this tutorial: Client Tutorial by using the axis2-wsdl2code-maven-plugin. The generation works fine, but i get everytime an error in the Stub-class.
The error is: org.apache.axis2.xmlbeans cannot be resolved to a type. This is the only error i get in the Stub. This ist for example a method, where the error appears (line 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);
}
}
The remaining generated classes have no errors and seem to be okay.
So I think it must be a dependency issue, because the system can not find the package org.apache.axis2.xmlbeans. I'm using the latest version of Apache Axis 2 (1.7.1) and Maven 2. So i have adjusted the dependencies from the video to the latest version from Maven Repository-Website.
Axis2 Runtime is loaded succesfully and configured in eclipse. Path and Environment Variables are set.
Here is my current POM for the client:
<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>
Thanks a lot for your help!
Upvotes: 2
Views: 4707
Reputation: 17418
I had to add below dependencies,
<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>
Then project got build successfully.
Upvotes: 0
Reputation: 9154
Add the following dependency:
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-xmlbeans</artifactId>
<version>1.7.1</version>
</dependency>
Upvotes: 5