views:

2679

answers:

6

I want to build an Axis2 client (I'm only accessing a remote web service, I'm not implementing one!) with Maven2 and I don't want to add 21MB of JARs to my project. What do I have to put in my pom.xml to compile the code when I've converted the WSDL with ADB?

A: 

I am afraid you need to distribute almost all the jars, even if it is for a client only. I remember trying to find that out myself and soon gave up after too many Runtime ClassNotFound exceptions.

For more light-weight clients you may consider CXF.

kgiannakakis
I think this critism is only justified for older versions of Axis2. The maven modules have been restructured in version 1.5I'm a groovy programmer and discovered that the GroovyWS module (based on CXF) downloaded a very large number of 3rd party dependencies, which appear to be largely unused. This demonstrates that the problem is not necessarily the library but the author of the POM module.....I think it's better to split up a projects modules rather than download every jar that I may or may not need :-)
Mark O'Connor
+2  A: 

(Note: This response was provided by Aaron Digulla himself. What follows is the exact text of his own answer.)

In maven2, the minimum dependency set to make an ADB client work ("ADB" as in the way you created the Java classes from the WSDL) is this:

    <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-kernel</artifactId>
            <version>1.4.1</version>
    </dependency>
    <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-adb</artifactId>
            <version>1.4.1</version>
    </dependency>

Hmmm... it seems I can't flag that as the correct answer. Can someone please copy this so I can flag his post?

Alex
Thanks :) I've deleted my original post.
Aaron Digulla
A: 

If your client is running on Java 6, consider using JAX-WS for consuming the WS. JAX-WS uses the JAXB standard for binding and you don't need a single extra jar for the client.

Sun
I'll consider this when our production servers move to Java 6 which should happen within the next decade or so ... ;)
Aaron Digulla
+1  A: 

Actually, you only need the axis-abd dependency since the axis2-kernel is a sub-dependency of axis-abd. Therefore you can sum it up with:

<dependency>
    <groupId>org.apache.axis2</groupId>
    <artifactId>axis2-adb</artifactId>
    <version>1.5.1</version>
</dependency>
Luís Duarte
Note, however, that Maven best practices say that if you use anything from axis2-kernel in your code that you should declare it explicitly. That way you don't run into an unexpected surprise later when you remove adb. (Granted, kernel should always be included, at least you'd think it would be)
Mike Cornell
A: 

In Axis2 version 1.5.1 the maven modules appear to have been restructured.

My Groovy scripts (Using ADB binding) have the following dependencies:

@Grapes([
    @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', module='axis2-transport-http', version='1.5.1'),
])

There's a logic to these. I could use an alternative binding framework when generating my stub or could use an alternative transport protocol to HTTP.

Example code in this answer

Mark O'Connor
+2  A: 

The minimum jars for the client are:

  • axis2-kernel-1.5.1.jar, axiom-api-1.2.8.jar, axis2-adb-1.5.1.jar, axiom-impl-1.2.8.jar, activation-1.1.jar wsdl4j-1.6.2.jar, XmlSchema-1.4.3.jar, commons-logging-1.1.1.jar, neethi-2.0.4.jar, axis2-transport-local-1.5.1.jar, axis2-transport-http-1.5.1.jar, commons-httpclient-3.1.jar, mail-1.4.jar httpcore-4.0.jar, commons-codec-1.3.jar

//STAX jars below are not part of Axis2 1.5.1 release and will be needed if your JDK version is less than 6

  • stax-1.2.0.jar, stax-api-1.0.1.jar
Late_But_May_Help_Someone