users@jersey.java.net

Re: Re: WADL and JavaScript generation

From: Gérald Quintana <gerald.quintana_at_gmail.com>
Date: Tue, 8 Jan 2008 14:00:11 +0100

Hello,

I tested the WADL generator Ant task. I think it's missing a "base
url" (optionnal) argument because generated WADL file doesn't contain
the base attribute in the resources element:
<resources base="http://www.mycompany.com">
Hence this WADL file can not be used directly with wadl2java without
being modified. After that I couldn't use the Java code generated by
wadl2java (missing library org.jvnet.ws.wadl.util.*) so I abandon this
solution.

I read the article by Steve Vinoski as well: I don't agree with his
idea that no interface is a good thing, but I don't want to throw a
troll in this mailing list. By the way, I agree that in my case the
WADL artefact is useless: The only I am looking for, is a way to call
the web service easily (in Java and/or JavaScript). I don't want to
write 10 lines of code to build the URL and the HTTP request (with
Apache HTTP Client or whatever) and then 10 lines of code to decode
the HTTP response (multiplied by the number of web services).
Implementing a web service with JAXRS is as easy as implementing a
function, calling it should be as easy. I couldn't find among provided
samples, the one showing a JAXRS client calling a JAXRS service, I may
have missed it.

Thanks for your work on JAXRS/Jersey,
Gerald

----------------------------------------------------------------------------------------------------------------------------------
FYI, I am attaching the Ant file I used for testing:
<project default="main" basedir=".">
        <property name="jersey.dir" value="C:\java\jersey-0.5-ea-20080108" />
        <property name="wadl.dir" value="C:\java\wadl-dist-1.0-SNAPSHOT" />
        <path id="project.class.path">
                <pathelement location="build/classes"/>
                <fileset dir="${jersey.dir}/lib" includes="**/*.jar"/>
                <fileset dir="${wadl.dir}/lib" includes="**/*.jar"/>
        </path>
        <target name="java2wadl">
                <taskdef name="wadlgen"
classname="com.sun.ws.rest.api.wadl.WadlGeneratorTask"
classpathref="project.class.path"/>
                <wadlgen destfile="IntroJaxRs.wadl" >
                        <classpath refid="project.class.path"/>
                </wadlgen>
        </target>
        <target name="wadl2java">
                <mkdir dir="jaxrs"/>
                <java classname="org.jvnet.ws.wadl2java.Main"
classpathref="project.class.path">
                        <arg line="-o jaxrs"/>
                        <arg line="-p com.mycompany.myproject"/>
                        <arg value=" IntroJaxRs.wadl"/>
                </java>
                <javac classpathref="project.class.path" destdir="build/classes"
srcdir="jaxrs"/>
        </target>
        <target name="main" depends="java2wadl,wadl2java"/>
</project>