This article is participating in “Java Theme Month – Java Debug Notes Event”, see < Event link > for more details.

What is the minimum classpath for an Axis2 client?

I want to build an Axis2 client (I only access a remote Web service!). I don’t want to add 21MB jars to my project. When I convert WSDL with ADB, what do I have to put in POM.xml to compile the code?

Answer a

In Maven2, the minimum set of dependencies for ADB clients to work (” ADB “is the same as creating Java classes from WSDL) is as follows:

    <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-kernel</artifactId>
            <version>1.41.</version>
    </dependency>
    <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-adb</artifactId>
            <version>1.41.</version>
    </dependency>
Copy the code

Answer two

The simplest Jar of the client is

  • Activation – 1.1. The jar
  • The axiom API – 1.2.8. Jar
  • Axiom – impl – 1.2.8. Jar
  • Axis2 – the adb – 1.5.1. Jar
  • Axis2 – kernel – 1.5.1. Jar
  • Axis2 – transport – HTTP – 1.5.1. Jar
  • Axis2 – transport – local – 1.5.1. Jar
  • The Commons – the codec – 1.3. The jar
  • Commons httpclient – 3.1. The jar
  • Commons logging – 1.1.1. The jar
  • Httpcore 4.0. The jar
  • The mail – 1.4. The jar
  • Neethi – 2.0.4. Jar
  • Wsdl4j – 1.6.2. Jar
  • XmlSchema – 1.4.3. Jar

The following STAX jars are not part of the Axis2 1.5.1 release and are required if your JDK version is older than 6:

  • Stax – 1.2.0. Jar
  • Stax API – 1.0.1. Jar

Answer three

Axis2 version 1.6.2 doesn’t work for me (although this may have something to do with the fact that I also use the Axis2-WSdL2code-Maven-plugin and XMLBeans as a data binding framework). I use the following POM:

    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-kernel</artifactId>
        <version>1.62.</version>
    </dependency>
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-adb</artifactId>
        <version>1.62.</version>
    </dependency>
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-transport-http</artifactId>
        <version>1.62.</version> </dependency> <dependency> <groupId>org.apache.axis2</groupId> <artifactId>axis2-transport-local</artifactId>  <version>1.62.</version>
    </dependency>
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-xmlbeans</artifactId>
        <version>1.62.</version>
    </dependency>
Copy the code

Answer four

For those using Gradle, I’ve eliminated unnecessary libraries:

dependencies {

    ext.compileEx = { lib, exModules, exGroups ->
        compile (lib) {
            exModules.each { exclude module : "$it" }
            exGroups.each  { exclude group: "$it" }
        }
    }

    List axisExModules = [ 'axiom-compat'.'jaxen'.'apache-mime4j-core' ]
    List axisExGroups  = [ 'javax.servlet'.'commons-fileupload'.'org.apache.woden'.'javax.ws.rs'.'org.apache.geronimo.specs'.'org.codehaus.woodstox' ]
    compileEx ('org, apache axis2: axis2 - the adb: 1.6.3', axisExModules, axisExGroups)
    compileEx ('org, apache axis2: axis2 - transport - local: 1.6.3', axisExModules, axisExGroups)
    compileEx ('org, apache axis2: axis2 - transport - HTTP: 1.6.3', axisExModules, axisExGroups)

}
Copy the code

This is my original post on the Gradle forum.

Answer five

In Axis2 version 1.5.1, maven coordinates seem to have been changed.

My Groovy script (using ADB bindings) has the following dependencies:

@grab ([@grab (group='org.apache.axis2', module='axis2-kernel', version='1.5.1'), @grab (group='org.apache.axis2', Module ='axis2-adb', version='1.5.1'), @grab (group='org.apache.axis2', module='axis2-transport-local', version='1.5.1'), @ Grab (group = 'org, apache axis2', the module = 'axis2 - transport - HTTP, version =' 1.5.1 '),])
Copy the code

That’s logic. I could use a different framework for generating stubs, or I could use a different transport protocol for HTTP.

The article translated from Stack Overflow:stackoverflow.com/questions/3…