-
Using Axis’s wsdl2java in a Maven Build
When using Apache Axis, you often want to generate the service stub code from a WSDL file provided by the remote API developer. We recently ran in to this situation at Highwinds.
What we wanted to do was keep the WSDL in source control, and use Maven to build the source from the WSDL at build time during the generate-sources lifecycle hook. This seemingly simple task ended up taking me some time to figure out – not because it was hard, but because there are so many bad implementations of Axis plugins for Maven out there, and Google has all of them in its sights.
Finally, I found a really nice implementation by the Codehaus guys. Here’s the POM for those of you who might be interested. Enjoy!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
<?xml version="1.0"?> <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> <name>Sample Axis-Maven Project</name> <groupId>com.maximporges</groupId> <artifactId>axis-maven</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>axistools-maven-plugin</artifactId> <version>1.3</version> <configuration> <!-- The plugin navigates your source src/main/** tree and finds your WSDLs for you; just name them individually in a <wsdlFiles/> element. --> <wsdlFiles> <wsdlFiles>MyWsdlFile.wsdl</wsdlFiles> <wsdlFiles>MyOtherWsdlFile.wsdl</wsdlFiles> </wsdlFiles> <!-- This is optional, but lets you explicitly namespace the generated code. --> <packageSpace>com.whatever.i.want</packageSpace> </configuration> <dependencies> <!-- Required for attachment support; you can remove these dependencies if attachment support is not needed. Note that if you do want it, you have to specify the dependencies both here in the plugin and also in the POM dependencies. --> <dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> <version>1.4.1</version> </dependency> <dependency> <groupId>javax.activation</groupId> <artifactId>activation</artifactId> <version>1.1</version> </dependency> </dependencies> <executions> <execution> <goals> <goal>wsdl2java</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>org.apache.axis</groupId> <artifactId>axis</artifactId> <version>1.4</version> </dependency> <dependency> <groupId>javax.xml</groupId> <artifactId>jaxrpc-api</artifactId> <version>1.1</version> </dependency> <dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> <version>1.4.1</version> </dependency> <dependency> <groupId>javax.activation</groupId> <artifactId>activation</artifactId> <version>1.1</version> </dependency> </dependencies> </project>
Category: Uncategorized | Tags: Coding
Related Posts
- Using AppleScript to Position iChat Windows
- An Objective-C Tutorial for Enterprise Java Programmers (4)
- Performing SQL Validation (a.k.a. “Data Dips”) with RIATest
- Configuring Tomcat SSL Client/Server Authentication (6)
- Calculating the Differences Between Consecutive Rows with SQL
- Duct Tape, Astronauts, and Everything In Between
- JDK 1.7.0 on Snow Leopard
- How to Install m2eclipse in Flex Builder 3 (1)
- Saving OmniGraffle Documents in Subversion
- How To Become A Software Engineer/Programmer (15)
Recent Posts
- The Arduinome is Finished! (3)
- Loom Becomes as3commons-bytecode (5)
- Arduinome Coming Soon!
- Setting up WebDAV on OS X (1)
- Possible Fix for iPad Wifi Problems
- Bluetooth Headphones and iPad (2)
- Fixing “Bluetooth audio failed” Error Message on Mac OS X with Sony DR-BT50 Headphones
- Programming the Meggy Jr.
- Drag and Drop in iPad Safari is a Drag (1)
- iPad Enhancements