want me to make a java2wsdl plugin? never used it but it probably isn't different from the wsdl2java one..
perhaps it would even be better to make an axis-maven-plugin that has multiple goals, one for each of these types of tools... I'll look into it if you like. jesse On 11/10/05, Christoph Schönfeld <[EMAIL PROTECTED]> wrote: > > I want to share my solution for the Axis/Maven 2.0 integration. I was > able to get both, java2wsdl and wsdl2java, running, using the Ant trick > for java2wsdl. > > I was wrong with the point about the build life cycle. WSDL creation > fits very well into it! > > As long as there is no maven plug-in for java2wsdl the Axis Ant Task > must be used along with an external Ant build file as recommended in the > antrun plug-in documentation. You can use the following pom.xml to let > the wsdl2java plug-in generate the source: > > <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"> > > <parent> > <groupId>com.myco</groupId> > <artifactId>webservices</artifactId> > <version>1.0-SNAPSHOT</version> > </parent> > > <modelVersion>4.0.0</modelVersion> > <groupId>com.myco</groupId> > <artifactId>WS-IMPL</artifactId> > <packaging>jar</packaging> > <version>1.0-SNAPSHOT</version> > <name>Webservice Impl</name> > > <build> > <plugins> > > <plugin> > <!-- > As long as the java2wsdl-maven-plugin is not there we > have to use the antrun plug-in to do the job. > --> > <artifactId>maven-antrun-plugin</artifactId> > <executions> > <execution> > <phase>generate-sources</phase> > <configuration> > <tasks> > <ant antfile="java2wsdl.xml" target="generate"/> > </tasks> > </configuration> > <goals> > <goal>run</goal> > </goals> > </execution> > </executions> > </plugin> > > <!-- The order of these two plug-ins is important > to make sure that the Ant task is run before the sources > are generated using the wsdl2java-maven-plugin below. > --> > > <plugin> > <groupId>org.codehaus.mojo</groupId> > <artifactId>wsdl2java-maven-plugin</artifactId> > <version>0.4-SNAPSHOT</version> > <configuration> > </configuration> > <executions> > <execution> > <phase>generate-sources</phase> > <configuration> > <!-- configuration, see > http://mojo.codehaus.org/wsdl2java-maven-plugin/generate-mojo.html --> > <sourceDirectory>${basedir}/target/generated-wsdl</sourceDirectory> > <packageSpace>com.myco.webservices</packageSpace> > <serverSide>true</serverSide> > </configuration> > <goals> > <goal>generate</goal> > </goals> > </execution> > </executions> > </plugin> > </plugins> > </build> > > <dependencies> > <dependency> > <groupId>junit</groupId> > <artifactId>junit</artifactId> > <version>3.8.1</version> > <scope>test</scope> > </dependency> > > <dependency> > <groupId>axis</groupId> > <artifactId>axis</artifactId> > <version>1.2.1</version> > </dependency> > > <dependency> > <groupId>axis</groupId> > <artifactId>axis-jaxrpc</artifactId> > <version>1.2</version> > </dependency> > > <dependency> > <groupId>axis</groupId> > <artifactId>axis-wsdl4j</artifactId> > <version>1.5.1</version> > </dependency> > > <dependency> > <groupId>axis</groupId> > <artifactId>axis-saaj</artifactId> > <version>1.2.1</version> > </dependency> > > <dependency> > <groupId>com.myco</groupId> > <artifactId>WS-API</artifactId> > <version>1.0-SNAPSHOT</version> > </dependency> > > </dependencies> > </project> > > The java2wsdl.xml Ant Build file looks like this: > > <?xml version="1.0" encoding="UTF-8"?> > <project name="Java2Wsdl" default="generate"> > > <path id="classpath"> > <fileset dir="${axis.home}/lib"> > <include name="*.jar"/> > </fileset> > <pathelement path="${java.class.path}"/> > </path> > > <path id="axis.classpath"> > <path refid="classpath"/> > > <!-- Add the classes of the API module --> > <pathelement path="../WS-API/target/classes" /> > </path> > > <taskdef name="axis-java2wsdl" > classname="org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask" > > <classpath refid="classpath" /> > </taskdef> > > <target name="generate" description="Generates the WSDL files"> > <mkdir dir="target/generated-wsdl"/> > <axis-java2wsdl classpathref="axis.classpath" > output="target/generated-wsdl/MyService.wsdl" > classname="com.myco.webservices.MyService" > namespace="urn:MyService" > location="http://localhost:8080/axis/services/MyService" > > > <mapping namespace="urn:MyService" > package="com.myco.webservices" /> > </axis-java2wsdl> > </target> > > </project> > > > When the Maven plug-in for java2wsdl will be available, one could > replace the Ant stuff with this simpler code: > > <build> > <plugins> > <plugin> > <artifactId>java2wsdl-maven-plugin</artifactId> > <version>...</version> > <configuration> > <!-- --> > </configuration> > <executions> > <execution> > <goals> > <goal>generate</goal> > </goals> > </execution> > </executions> > </plugin> > </plugins> > </build> > > This solution is not very elegant, as I needed to hard-code the location > of the WS-API classes in the Ant build file. You need to change that for > your implementation to match the location of your module that contains > the class from which the WSDL file shall be created. > > My last open question is how to best implement the > MyServiceSaopBindingImpl, because it gets created in the > generated-sources folder and I do not want to change it there because it > gets overwritten each time the source files are generated. A solution > would perhaps be to provide a different implementation of > com.myco.MyService but that requires to change the reference in > deploy.wsdd to the subclass. But that's something for tomorrow. :) > > > However, I hope this helps a bit for the moment. > > > Cheers, > Christoph > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- jesse mcconnell
