Skip to main content

getter & setters wsimport

12 replies [Last post]
Anonymous

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

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
taruntyagi25
Offline
Joined: 2012-07-02
Points: 0

I am trying to generate the setter for collection from command line wsimport.
My command is :
wsimport -d C:\Users\admin\workspace\8.0\Test\bin -p com.web.service.client -keep -B-classpath Bcollection-setter-injector-0.5.0-1.jar -B-extension -B-Xcollection-setter-injector http://localhost:8080/WebServiceProject/services/TestWebService?wsdl

I am getting:
no such JAXB option: -Xcollection-setter-injector

not sure where I am doing mistake.

Please help

Thanks
Tarun

Martin Grebac

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
> "" 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:
>>>
>>>
>>>
>>>

>>>
>>>
>>> >>> extension="false" destdir="${generated.dir}"
>>> wsdl="${service.admin.wsdl}"
>>> wsdllocation="${service.admin.wsdllocation}">
>>>
>>> includes="${generated.dir}/**/*.java" />
>>>

>>> ..... * other lines here
>>>

>>>
>>>
>>> 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

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 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
>> "" 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:
>>>>
>>>>
>>>>
>>>>

>>>>
>>>>
>>>> >>>> extension="false" destdir="${generated.dir}"
>>>> wsdl="${service.admin.wsdl}"
>>>> wsdllocation="${service.admin.wsdllocation}">
>>>>
>>>> includes="${generated.dir}/**/*.java" />
>>>>

>>>> ..... * other lines here
>>>>

>>>>
>>>>
>>>> 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
>
>

Glen Mazza

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-unmarshall...

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

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-unmarshall...
>
> 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

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 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-unmarshall...
>>
>> 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

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 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-unmarshall...
>>>
>>> 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

my current ANT task:




extension="false" destdir="${generated.dir}"
wsdl="${service.admin.wsdl}"
wsdllocation="${service.admin.wsdllocation}">

includes="${generated.dir}/**/*.java" />

..... * other lines here

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

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:
>
>
>
>

>
>
> > extension="false" destdir="${generated.dir}"
> wsdl="${service.admin.wsdl}"
> wsdllocation="${service.admin.wsdllocation}">
>
> includes="${generated.dir}/**/*.java" />
>

> ..... * other lines here
>

>
>
> 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

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
"" 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:
>>
>>
>>
>>

>>
>>
>> >> extension="false" destdir="${generated.dir}"
>> wsdl="${service.admin.wsdl}"
>> wsdllocation="${service.admin.wsdllocation}">
>>
>> includes="${generated.dir}/**/*.java" />
>>

>> ..... * other lines here
>>

>>
>>
>> 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

Thanks a lot Jungmann,

it finally worked:

extension="false" destdir="${generated.dir}"
wsdl="${service.admin.wsdl}"
wsdllocation="${service.admin.wsdllocation}">

includes="${generated.dir}/**/*.java" />

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

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

happy to help,

regards,
--lj

>
> > extension="false" destdir="${generated.dir}"
> wsdl="${service.admin.wsdl}"
> wsdllocation="${service.admin.wsdllocation}">
>
> includes="${generated.dir}/**/*.java" />
>
>

>
> 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