The Source for Java Technology Collaboration

Home » java.net Forums » GlassFish » Metro and JAXB

Thread: APT request beans: WS parameter names "arg0, arg1" instead of names
from src code

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 4 - Last Post: May 7, 2009 6:45 AM by: lena_asche
Lena Asche
APT request beans: WS parameter names "arg0, arg1" instead of names
from src code

Posted: Jan 10, 2008 2:15 AM
  Click to reply to this thread Reply

Hi all,

I'm trying to integrate the JAX-WS 2.1.2 framework starting from java.
I've managed to generate all required artifacts, created and
successfully deployed the .war archive. Everything works just fine, BUT
the parameter names of the generated WS request beans get lost ans I get
arg0, arg1 instead.
I was using the APT tool instead of Wsgen only to ensure the parameter
names will be kept. The JAX-WS documentation says "... it is recommended
that the portable artifacts be generated from source using apt. This
because the JAX-WS tools will then have full access to the source code
and will be able to utilize parameter names that are otherwise not
available through the Java reflection APIs".
If I use the @WebParam annotation, the name of the web service
parameters is taken, but since I have ca. 400 existing web services, I
just want apt to get the parameter names from source code.
Do I have to add special options to my Apt Ant task?

<apt fork="true" debug="true" verbose="${verbose}"
destdir="${build.classes.home}" sourcedestdir="${build.src.home}"
sourcepath="${src.dir}" nocompile="true">
<classpath>
<path refid="project.path" />
<pathelement location="${build.src.home}" />
</classpath>
<option key="r" value="${build.src.home}" />
<source dir="${src.dir}">
<include name="**/*.java" />
</source>
</apt>
Does someone have any ideas?
Many thanks in advance!

Lena

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
For additional commands, e-mail: users-help@metro.dev.java.net


kohsuke

Posts: 3,962
Re: APT request beans: WS parameter names "arg0, arg1" instead of names
fr

Posted: Jan 10, 2008 11:37 AM   in response to: Lena Asche
  Click to reply to this thread Reply

IIRC, this is because the spec required semantics that the absence of @WebParam defaults to "arg0", "arg1"... and etc. Otherwise we can't guarantee the consistent semantics.

We do regret the fact that default parameter names are poorly chosen, and we are working with the JavSE team to improve the situation, but in the mean time, I don't think we can make you happy in a portable way.

What we might be able to do, instead, is to have the vendor extension of Metro where we capture the parameter names from APT (in a non-portable way) and use it at the runtime. If you like that, please consider filing an issue on http://metro.dev.java.net/issues/

Lena Asche
Re: APT request beans: WS parameter names "arg0, arg1" instead of
names fr

Posted: Jan 11, 2008 12:59 AM   in response to: kohsuke
  Click to reply to this thread Reply

Thanks for your reply!
I ended up writing a small parser which parses the specified java class
file and adds the @WebParam(name="<parameterName>") annotation to every
parameter of public methods.This way I don't have to alter ca. 400 WS
manually.

Thanks again for your help!
Lena


metro@javadesktop.org schrieb:
> IIRC, this is because the spec required semantics that the absence of @WebParam defaults to "arg0", "arg1"... and etc. Otherwise we can't guarantee the consistent semantics.
>
> We do regret the fact that default parameter names are poorly chosen, and we are working with the JavSE team to improve the situation, but in the mean time, I don't think we can make you happy in a portable way.
>
> What we might be able to do, instead, is to have the vendor extension of Metro where we capture the parameter names from APT (in a non-portable way) and use it at the runtime. If you like that, please consider filing an issue on http://metro.dev.java.net/issues/
> [Message sent by forum member 'kohsuke' (kohsuke)]
>
> http://forums.java.net/jive/thread.jspa?messageID=253259
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
> For additional commands, e-mail: users-help@metro.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
For additional commands, e-mail: users-help@metro.dev.java.net


tsshungary

Posts: 4
Re: APT request beans: WS parameter names "arg0, arg1" instead of
Posted: Mar 1, 2008 12:46 PM   in response to: Lena Asche
  Click to reply to this thread Reply

Can you upload this parser somewhere ?

lena_asche

Posts: 6
Re: APT request beans: WS parameter names "arg0, arg1" instead of
Posted: May 7, 2009 6:45 AM   in response to: tsshungary
  Click to reply to this thread Reply

Sorry, I've apparently missed your message. I'll attach the source anyway - perhaps it can be useful for someone else...
The parser is VERY quick&dirty, so please don't stone me for the poor error handling and very basic processing. :)
Lena




 XML java.net RSS