The Source for Java Technology Collaboration

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

Thread: getter & setters wsimport

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: 11 - Last Post: Aug 18, 2008 4:40 AM by: Felipe Gaúcho
Felipe Gaúcho
getter & setters wsimport
Posted: Aug 17, 2008 3:21 AM
  Click to reply to this thread Reply

WSIMPORT generates read-only Collections attributes ... but some
frameworks based on reflection requires the setter method to be
present.

question: is there a way to force wsimport to create the setter method ?

any other workaround ?

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


Glen Mazza
Re: getter & setters wsimport
Posted: Aug 17, 2008 3:04 PM   in response to: Felipe Gaúcho
  Click to reply to this thread Reply


Hmmm...I think that is done by JAXB, not wsimport, and that rule is part is
the JAXB standard:
http://www.nabble.com/Re%3A-not-calling-collection-setters-on-unmarshalling-p18354286.html

The below apparently can do this for you, but how to activate it from
wsimport? I don't know.
https://jaxb2-commons.dev.java.net/collection-setter-injector/

Glen


Felipe Gaucho wrote:
>
> WSIMPORT generates read-only Collections attributes ... but some
> frameworks based on reflection requires the setter method to be
> present.
>
> question: is there a way to force wsimport to create the setter method ?
>
> any other workaround ?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
> For additional commands, e-mail: users-help@metro.dev.java.net
>
>
>

--
View this message in context: http://www.nabble.com/getter---setters-wsimport-tp19018886p19023774.html
Sent from the Metro - Users mailing list archive at Nabble.com.


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


Martin Grebac
Re: getter & setters wsimport
Posted: Aug 18, 2008 2:11 AM   in response to: Glen Mazza
  Click to reply to this thread Reply

You can use -B option to pass JAXB related parameters to JAXB compiler
invoked from wsimport.

https://jax-ws.dev.java.net/nonav/2.1.2m1/docs/wsimport.html

MartinG

Glen Mazza wrote:
> Hmmm...I think that is done by JAXB, not wsimport, and that rule is part is
> the JAXB standard:
> http://www.nabble.com/Re%3A-not-calling-collection-setters-on-unmarshalling-p18354286.html
>
> The below apparently can do this for you, but how to activate it from
> wsimport? I don't know.
> https://jaxb2-commons.dev.java.net/collection-setter-injector/
>
> Glen
>
>
> Felipe Gaucho wrote:
>
>> WSIMPORT generates read-only Collections attributes ... but some
>> frameworks based on reflection requires the setter method to be
>> present.
>>
>> question: is there a way to force wsimport to create the setter method ?
>>
>> any other workaround ?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
>> For additional commands, e-mail: users-help@metro.dev.java.net
>>
>>
>>
>>
>
>

--
Martin Grebac, http://blogs.sun.com/mgrebac

Web Technologies & Standards
Sun Microsystems Czech

ICQ: 93478885


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


Felipe Gaúcho
Re: getter & setters wsimport
Posted: Aug 18, 2008 2:15 AM   in response to: Martin Grebac
  Click to reply to this thread Reply

humm.. problem is: it is a XJC argument and not JAXB..

If you have the solution, please sed me en example :)

This minor issue is avoiding the integration between FLEX and the
wsimport :( and the workaround splitting my WSDL in several small
documents to run the tools separately seems too much :)


On Mon, Aug 18, 2008 at 11:11 AM, Martin Grebac <Martin.Grebac@sun.com> wrote:
> You can use -B option to pass JAXB related parameters to JAXB compiler
> invoked from wsimport.
>
> https://jax-ws.dev.java.net/nonav/2.1.2m1/docs/wsimport.html
>
> MartinG
>
> Glen Mazza wrote:
>>
>> Hmmm...I think that is done by JAXB, not wsimport, and that rule is part
>> is
>> the JAXB standard:
>>
>> http://www.nabble.com/Re%3A-not-calling-collection-setters-on-unmarshalling-p18354286.html
>>
>> The below apparently can do this for you, but how to activate it from
>> wsimport? I don't know.
>> https://jaxb2-commons.dev.java.net/collection-setter-injector/
>> Glen
>>
>>
>> Felipe Gaucho wrote:
>>
>>>
>>> WSIMPORT generates read-only Collections attributes ... but some
>>> frameworks based on reflection requires the setter method to be
>>> present.
>>>
>>> question: is there a way to force wsimport to create the setter method ?
>>>
>>> any other workaround ?
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
>>> For additional commands, e-mail: users-help@metro.dev.java.net
>>>
>>>
>>>
>>>
>>
>>
>
> --
> Martin Grebac, http://blogs.sun.com/mgrebac
>
> Web Technologies & Standards
> Sun Microsystems Czech
>
> ICQ: 93478885
>
>
> ---------------------------------------------------------------------
> 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


Martin Grebac
Re: getter & setters wsimport
Posted: Aug 18, 2008 2:37 AM   in response to: Felipe Gaúcho
  Click to reply to this thread Reply

I meant XJC compiler of course.
MartinG

Felipe Gaúcho wrote:
> humm.. problem is: it is a XJC argument and not JAXB..
>
> If you have the solution, please sed me en example :)
>
> This minor issue is avoiding the integration between FLEX and the
> wsimport :( and the workaround splitting my WSDL in several small
> documents to run the tools separately seems too much :)
>
>
> On Mon, Aug 18, 2008 at 11:11 AM, Martin Grebac <Martin.Grebac@sun.com> wrote:
>
>> You can use -B option to pass JAXB related parameters to JAXB compiler
>> invoked from wsimport.
>>
>> https://jax-ws.dev.java.net/nonav/2.1.2m1/docs/wsimport.html
>>
>> MartinG
>>
>> Glen Mazza wrote:
>>
>>> Hmmm...I think that is done by JAXB, not wsimport, and that rule is part
>>> is
>>> the JAXB standard:
>>>
>>> http://www.nabble.com/Re%3A-not-calling-collection-setters-on-unmarshalling-p18354286.html
>>>
>>> The below apparently can do this for you, but how to activate it from
>>> wsimport? I don't know.
>>> https://jaxb2-commons.dev.java.net/collection-setter-injector/
>>> Glen
>>>
>>>
>>> Felipe Gaucho wrote:
>>>
>>>
>>>> WSIMPORT generates read-only Collections attributes ... but some
>>>> frameworks based on reflection requires the setter method to be
>>>> present.
>>>>
>>>> question: is there a way to force wsimport to create the setter method ?
>>>>
>>>> any other workaround ?
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
>>>> For additional commands, e-mail: users-help@metro.dev.java.net
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>> --
>> Martin Grebac, http://blogs.sun.com/mgrebac
>>
>> Web Technologies & Standards
>> Sun Microsystems Czech
>>
>> ICQ: 93478885
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>

--
Martin Grebac, http://blogs.sun.com/mgrebac

Web Technologies & Standards
Sun Microsystems Czech

ICQ: 93478885


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


Felipe Gaúcho
Re: getter & setters wsimport
Posted: Aug 18, 2008 2:41 AM   in response to: Martin Grebac
  Click to reply to this thread Reply

my current ANT task:

<taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
<classpath refid="jaxws.classpath" />
</taskdef>

<target name="build-server-wsdl">
<wsimport debug="true" verbose="${verbose}" keep="true"
extension="false" destdir="${generated.dir}"
wsdl="${service.admin.wsdl}"
wsdllocation="${service.admin.wsdllocation}">
<produces dir="${generated.dir}"
includes="${generated.dir}/**/*.java" />
</wsimport>
..... * other lines here
</target>


So, if you can point how can I include the -B param here, please do that :)

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


Martin Grebac
Re: getter & setters wsimport
Posted: Aug 18, 2008 2:52 AM   in response to: Felipe Gaúcho
  Click to reply to this thread Reply

Oh, I see, it's the ant task. Not sure if wsimport ant task allows you
to pass JAXB options, but you can still replace it with invoking the
commandline wsimport (I understand it's quite a complication). Filing a
RFE might be worth it.
MartinG

Felipe Gaúcho wrote:
> my current ANT task:
>
> <taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
> <classpath refid="jaxws.classpath" />
> </taskdef>
>
> <target name="build-server-wsdl">
> <wsimport debug="true" verbose="${verbose}" keep="true"
> extension="false" destdir="${generated.dir}"
> wsdl="${service.admin.wsdl}"
> wsdllocation="${service.admin.wsdllocation}">
> <produces dir="${generated.dir}"
> includes="${generated.dir}/**/*.java" />
> </wsimport>
> ..... * other lines here
> </target>
>
>
> So, if you can point how can I include the -B param here, please do that :)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
> For additional commands, e-mail: users-help@metro.dev.java.net
>
>

--
Martin Grebac, http://blogs.sun.com/mgrebac

Web Technologies & Standards
Sun Microsystems Czech

ICQ: 93478885


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


Lukas Jungmann
Re: getter & setters wsimport
Posted: Aug 18, 2008 3:44 AM   in response to: Martin Grebac
  Click to reply to this thread Reply

Martin Grebac wrote:
> Oh, I see, it's the ant task. Not sure if wsimport ant task allows you
> to pass JAXB options, but you can still replace it with invoking the
> commandline wsimport (I understand it's quite a complication). Filing a
> RFE might be worth it.

Isn't it already there? I mean isn't "-B" on the command line equal to
"<xjcarg>" in the Ant task?

just looking at the last example at
https://jax-ws.dev.java.net/nonav/2.1.3/docs/wsimportant.html

--lj


> MartinG
>
> Felipe Gaúcho wrote:
>> my current ANT task:
>>
>> <taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
>> <classpath refid="jaxws.classpath" />
>> </taskdef>
>>
>> <target name="build-server-wsdl">
>> <wsimport debug="true" verbose="${verbose}" keep="true"
>> extension="false" destdir="${generated.dir}"
>> wsdl="${service.admin.wsdl}"
>> wsdllocation="${service.admin.wsdllocation}">
>> <produces dir="${generated.dir}"
>> includes="${generated.dir}/**/*.java" />
>> </wsimport>
>> ..... * other lines here
>> </target>
>>
>>
>> So, if you can point how can I include the -B param here, please do
>> that :)
>>
>> ---------------------------------------------------------------------
>> 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


Felipe Gaúcho
Re: getter & setters wsimport
Posted: Aug 18, 2008 3:54 AM   in response to: Lukas Jungmann
  Click to reply to this thread Reply

Thanks a lot Jungmann,

it finally worked:

<wsimport debug="true" verbose="${verbose}" keep="true"
extension="false" destdir="${generated.dir}"
wsdl="${service.admin.wsdl}"
wsdllocation="${service.admin.wsdllocation}">
<produces dir="${generated.dir}"
includes="${generated.dir}/**/*.java" />
<xjcarg value="-Xcollection-setter-injector"/>
</wsimport>

Now I have to decide whatever it is correct or not, but at least I can
release the FLEX developers to consume my service..

* I believe the strategy of do not expose setters for collection is
sound and much more elegant than the classical get/set pattern, but
unfortunately some other technologies don't think like that :( and
interoperability is one of our best goals :)

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


Lukas Jungmann
Re: getter & setters wsimport
Posted: Aug 18, 2008 4:01 AM   in response to: Felipe Gaúcho
  Click to reply to this thread Reply

Felipe Gaúcho wrote:
> Thanks a lot Jungmann,
>
> it finally worked:

happy to help,

regards,
--lj

>
> <wsimport debug="true" verbose="${verbose}" keep="true"
> extension="false" destdir="${generated.dir}"
> wsdl="${service.admin.wsdl}"
> wsdllocation="${service.admin.wsdllocation}">
> <produces dir="${generated.dir}"
> includes="${generated.dir}/**/*.java" />
> <xjcarg value="-Xcollection-setter-injector"/>
> </wsimport>
>
> Now I have to decide whatever it is correct or not, but at least I can
> release the FLEX developers to consume my service..
>
> * I believe the strategy of do not expose setters for collection is
> sound and much more elegant than the classical get/set pattern, but
> unfortunately some other technologies don't think like that :( and
> interoperability is one of our best goals :)
>
> ---------------------------------------------------------------------
> 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


Martin Grebac
Re: getter & setters wsimport
Posted: Aug 18, 2008 4:35 AM   in response to: Lukas Jungmann
  Click to reply to this thread Reply

Right, that's exactly it. Thanks,
MartinG

Lukas Jungmann wrote:
> Martin Grebac wrote:
>> Oh, I see, it's the ant task. Not sure if wsimport ant task allows
>> you to pass JAXB options, but you can still replace it with invoking
>> the commandline wsimport (I understand it's quite a complication).
>> Filing a RFE might be worth it.
>
> Isn't it already there? I mean isn't "-B" on the command line equal to
> "<xjcarg>" in the Ant task?
>
> just looking at the last example at
> https://jax-ws.dev.java.net/nonav/2.1.3/docs/wsimportant.html
>
> --lj
>
>
>> MartinG
>>
>> Felipe Gaúcho wrote:
>>> my current ANT task:
>>>
>>> <taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
>>> <classpath refid="jaxws.classpath" />
>>> </taskdef>
>>>
>>> <target name="build-server-wsdl">
>>> <wsimport debug="true" verbose="${verbose}" keep="true"
>>> extension="false" destdir="${generated.dir}"
>>> wsdl="${service.admin.wsdl}"
>>> wsdllocation="${service.admin.wsdllocation}">
>>> <produces dir="${generated.dir}"
>>> includes="${generated.dir}/**/*.java" />
>>> </wsimport>
>>> ..... * other lines here
>>> </target>
>>>
>>>
>>> So, if you can point how can I include the -B param here, please do
>>> that :)
>>>
>>> ---------------------------------------------------------------------
>>> 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
>

--
Martin Grebac, http://blogs.sun.com/mgrebac

Web Technologies & Standards
Sun Microsystems Czech

ICQ: 93478885


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


Felipe Gaúcho
Re: getter & setters wsimport
Posted: Aug 18, 2008 4:40 AM   in response to: Martin Grebac
  Click to reply to this thread Reply

humm.. we celebrated too early :)

It works fantastically well with Lists (maxOccurs='unbounded'), but
fail to generate setter on Maps (choice XSD elements) :(

I guess a next version of wsimport can give us an easy parameter to
switch on/off the generation of the setters without the need of
extensions.. I will open a RFE as "enhancement"

But I will wait few days to see if another good ideas comes to help :)





On Mon, Aug 18, 2008 at 1:35 PM, Martin Grebac <Martin.Grebac@sun.com> wrote:
> Right, that's exactly it. Thanks,
> MartinG
>
> Lukas Jungmann wrote:
>>
>> Martin Grebac wrote:
>>>
>>> Oh, I see, it's the ant task. Not sure if wsimport ant task allows you to
>>> pass JAXB options, but you can still replace it with invoking the
>>> commandline wsimport (I understand it's quite a complication). Filing a RFE
>>> might be worth it.
>>
>> Isn't it already there? I mean isn't "-B" on the command line equal to
>> "<xjcarg>" in the Ant task?
>>
>> just looking at the last example at
>> https://jax-ws.dev.java.net/nonav/2.1.3/docs/wsimportant.html
>>
>> --lj
>>
>>
>>> MartinG
>>>
>>> Felipe Gaúcho wrote:
>>>>
>>>> my current ANT task:
>>>>
>>>> <taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
>>>> <classpath refid="jaxws.classpath" />
>>>> </taskdef>
>>>>
>>>> <target name="build-server-wsdl">
>>>> <wsimport debug="true" verbose="${verbose}" keep="true"
>>>> extension="false" destdir="${generated.dir}"
>>>> wsdl="${service.admin.wsdl}"
>>>> wsdllocation="${service.admin.wsdllocation}">
>>>> <produces dir="${generated.dir}"
>>>> includes="${generated.dir}/**/*.java" />
>>>> </wsimport>
>>>> ..... * other lines here
>>>> </target>
>>>>
>>>>
>>>> So, if you can point how can I include the -B param here, please do that
>>>> :)
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>
>
> --
> Martin Grebac, http://blogs.sun.com/mgrebac
>
> Web Technologies & Standards
> Sun Microsystems Czech
>
> ICQ: 93478885
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
> For additional commands, e-mail: users-help@metro.dev.java.net
>
>





 XML java.net RSS