You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Fr...@KabelDeutschland.de on 2005/11/10 19:16:40 UTC

Maven and Axis

Hey all,
is there a documentation how to use axis, wsdl2java and java2wsdl with maven2?

Fredy


Informieren Sie sich jetzt über die faszinierenden Möglichkeiten des digitalen Fernsehens und über Kabel Digital HOME  - auf dem Kabel Deutschland Infokanal. 

Der Kabel Deutschland Infokanal ist neu in den Kabelnetzen von Bayern, Hamburg und Niedersachsen.
 
 
Diese E-Mail und etwaige Anhänge enthalten vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, benachrichtigen Sie bitte den Absender, indem Sie auf diese Nachricht antworten und vernichten Sie anschließend diese Mail und die Anlagen. Das unerlaubte Kopieren sowie die unbefugte Weitergabe und Verbreitung dieser Mail und den Anhängen ist nicht gestattet. Kabel Deutschland kann für durch Viren entstandene Schäden, die über diese Mail übermittelt worden sind, nicht haftbar gemacht werden.

This e-mail and its attachments may contain confidential and/or legally privileged information. If you are not the intended recipient (or have received this e-mail in error) please immediately notify the sender by replying to this e-mail and then delete this e-mail and its attachments from your system / computer. Any unauthorised copying, disclosure, dissemination or distribution of the material in this e-mail is strictly prohibited. Kabel Deutschland accepts no liability for any damage caused by any virus transmitted by this email.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Solution for Axis/Maven integration

Posted by Jesse McConnell <je...@gmail.com>.
could you just make a issue on the mojo jira and attach the patch there?
I'll try and get to that today/tonight. I'll also look into making a more
general axis plugin then too.

http://jira.codehaus.org/browse/MOJO

thanks :) if you want just assign the jira ticket to me

jesse

On 11/11/05, Christoph Schönfeld <cs...@sylphen.com> wrote:
>
> Hi Jesse,
>
> > want me to make a java2wsdl plugin?
> that would be great!
>
> Regarding my open question, I looked into the documentation of the
> WSDL2Java tool at
> http://ws.apache.org/axis/java/reference.html#WSDL2JavaReference
>
> There is a switch which solves my problem:
>
> -c, --implementationClassName <argument>
> Set the name of the implementation class.Especially useful when
> exporting an existing class as a web service using java2wsdl
> followed by wsdl2java. If you are using the skeleton deploy
> option you must make sure, after generation, that your
> implementation class implements the port type name interface
> generated by wsdl2java. You should also make sure that all your
> exported methods throws java.lang.RemoteException.
>
> I added support for this and also for the -NStoPkg parameter for
> mappings of namespaces to packages to your Plug-in code.
>
> A patch is provided at
> http://www.sylphen.com/~sylph02/wsdl2java-maven-plugin.patch.
> You need to cd to trunk/mojo/wsdl2java-maven-plugin to apply it using
> patch -p1 < patch-file.
>
> The NStoPkg switch is configured like this:
>
> <configuration>
> <fileNStoPkg>(path to property file)</fileNSToPkg>
> </configuration>
>
> The implementationClassName field in the Mojo currently sort of breaks
> support for multiple WSDL files. This should be a mapping, one for each
> WSDL file, but I could not figure out how to implement configuration
> with a map because this section is missing in the Maven plug-in
> configuration documentation.
>
> So, for now the plug-in just uses one property implementationClassName
> which allows to set the implementation class name but this is used for
> all WSDL files.
>
> It must be given like this:
>
> <configuration>
>
> <implementationClassName>com.myco.MyServiceImpl</implementationClassName>
> </configuration>
>
> However, the code for the map implementation is there, it's just
> commented out. The configuration would probably look like this:
>
> <configuration>
> <implementationClassMappings>
> <entry>
> <key>myservice1.wsdl</key>
> <value>com.myco.webservices.impl.MyService1</value>
> </entry>
> <entry>
> <key>myservice2.wsdl</key>
> <value>com.myco.webservices.impl.MyService2</value>
> </entry>
> </implementationClassMappings>
> </configuration>
>
>
> Christoph
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


--
jesse mcconnell

Re: Solution for Axis/Maven integration

Posted by Christoph Schönfeld <cs...@sylphen.com>.
Hi Jesse,

> want me to make a java2wsdl plugin? 
that would be great! 

Regarding my open question, I looked into the documentation of the
WSDL2Java tool at
http://ws.apache.org/axis/java/reference.html#WSDL2JavaReference

There is a switch which solves my problem: 

-c, --implementationClassName <argument>
        Set the name of the implementation class.Especially useful when
        exporting an existing class as a web service using java2wsdl
        followed by wsdl2java. If you are using the skeleton deploy
        option you must make sure, after generation, that your
        implementation class implements the port type name interface
        generated by wsdl2java. You should also make sure that all your
        exported methods throws java.lang.RemoteException.
        
I added support for this and also for the -NStoPkg parameter for
mappings of namespaces to packages to your Plug-in code. 

A patch is provided at
http://www.sylphen.com/~sylph02/wsdl2java-maven-plugin.patch.
You need to cd to trunk/mojo/wsdl2java-maven-plugin to apply it using 
patch -p1 < patch-file.

The NStoPkg switch is configured like this:

<configuration>
  <fileNStoPkg>(path to property file)</fileNSToPkg>
</configuration>

The implementationClassName field in the Mojo currently sort of breaks
support for multiple WSDL files. This should be a mapping, one for each
WSDL file, but I could not figure out how to implement configuration
with a map because this section is missing in the Maven plug-in
configuration documentation.

So, for now the plug-in just uses one property implementationClassName
which allows to set the implementation class name but this is used for
all WSDL files. 

It must be given like this:

<configuration>

<implementationClassName>com.myco.MyServiceImpl</implementationClassName>
</configuration>

However, the code for the map implementation is there, it's just
commented out. The configuration would probably look like this: 

<configuration>
  <implementationClassMappings>
    <entry>
      <key>myservice1.wsdl</key>
      <value>com.myco.webservices.impl.MyService1</value>
    </entry>
    <entry>
      <key>myservice2.wsdl</key>
      <value>com.myco.webservices.impl.MyService2</value>
    </entry>
  </implementationClassMappings>
</configuration>


Christoph



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Solution for Axis/Maven integration

Posted by Jesse McConnell <je...@gmail.com>.
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 <cs...@sylphen.com> 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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


--
jesse mcconnell

Solution for Axis/Maven integration

Posted by Christoph Schönfeld <cs...@sylphen.com>.
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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven and Axis

Posted by Christoph Schönfeld <cs...@sylphen.com>.
I am also dealing with this right now. As far as my research led me,
there seems to be only the wsdl2java-maven-plugin. There is no official
release of it but you can download the plug-in and build it yourself
from http://svn.mojo.codehaus.org/trunk/mojo/wsdl2java-maven-plugin/

You need to rename the source files from *.jav to *.java, though. If you
don't have it yet, you also need to install the javax.mail artifact
manually (because the Sun JARs are not on the ibiblio server) on which
Axis depends.

There is no plugin for java2wsdl yet. My hint about the reason for this
is that java2wsdl doesn't fit into the standard Maven life cycle. The
phase generate-sources suits for the wsdl2java-plug-in but there is no
phase like "post-compile" which allows processing of compiled classes to
produce the WSDL file. Thus, generating the WSDL has to be done without
knowledge of Maven. Please object if I am wrong!

I have not finished Axis/Maven integration here yet, but my approach
will be to create one module, WS-API, containing the Java interface from
which the WSDL shall be generated. In a second module, WS-IMPL,
depending on WS-API, I will use the Axis Ant Task to generate the WSDL
file independently of Maven and store it in src/main/wsdl which is the
location used by the wsdl2java-maven-plugin. I will use it in the Maven
build for WS-IMPL to generate the source code. I hope it will work that
way. 

Does anyone else have ideas?

Christoph


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org