You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Julio Arias <ju...@rbxglobal.com> on 2007/07/24 17:29:23 UTC
Generics using JAXB data binding
Hi -
I have a method that returns or has a param of List<String> when I
generate the WSDL and then the client from that WSDL I get a strange
namespace for that type and therefore strange pakage name when the
client is generated, is there a why to customize this to be in the
appropriate namespace we tried the @WebResult and @WebParam
annotations to specified the target namespace but it didn't work.
Then namespace is: http://jaxb.dev.java.net/array
Julio Arias
Java Developer
Roundbox Global : enterprise : technology : genius
---------------------------------------------------------------------
Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
email: julio.arias@rbxglobal.com | www.rbxglobal.com
---------------------------------------------------------------------
Re: Generics using JAXB data binding
Posted by Julio Arias <ju...@rbxglobal.com>.
Thanks Dan -
I have another problem with List<String> as a parameter I get a type
mismatch, I'm still using JAXB binding. StringArray is the wrapper
created for List<String> by wsdl2java. We debug CXF code and we found
that the actual parameter for the invocation is just a the string
"hola" instead of the List<String>, I'm doing anything wrong??
---------Client code-----------------
StringArray keywords = new StringArray();
keywords.getItem().add("hola");
com.rbxglobal.reactor.ws.model.DocumentArray
_getDocumentsByKeywords_documents = port.getDocumentsByKeywords
(keywords);
----------Exception-------------------
Jul 25, 2007 9:28:30 AM org.apache.cxf.phase.PhaseInterceptorChain
doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: argument type mismatch
at org.apache.cxf.service.invoker.AbstractInvoker.invoke
(AbstractInvoker.java:88)
at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke
(JAXWSMethodInvoker.java:82)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke
(AbstractInvoker.java:56)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run
(ServiceInvokerInterceptor.java:56)
at org.apache.cxf.workqueue.SynchronousExecutor.execute
(SynchronousExecutor.java:37)
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage
(ServiceInvokerInterceptor.java:87)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept
(PhaseInterceptorChain.java:206)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage
(ChainInitiationObserver.java:67)
at
org.apache.cxf.transport.servlet.ServletDestination.doMessage
(ServletDestination.java:100)
at
org.apache.cxf.transport.servlet.ServletController.invokeDestination
(ServletController.java:224)
at org.apache.cxf.transport.servlet.ServletController.invoke
(ServletController.java:137)
at org.apache.cxf.transport.servlet.CXFServlet.invoke
(CXFServlet.java:261)
at org.apache.cxf.transport.servlet.CXFServlet.doPost
(CXFServlet.java:239)
On Jul 25, 2007, at 8:21 AM, Dan Diephouse wrote:
> Much to all of our general disdain here, I believe this is a
> limitation of
> JAXB. You in essence have two options:
> 1. Define a wrapper type. For instance, if you were going to return a
> collection of customers you would create a Customers class with a
> List of
> customers on it
> 2. Use Aegis - http://cwiki.apache.org/CXF20DOC/aegis-
> databinding.html - if
> you go this route, you may want to use the snapshot builds we've been
> producing as they have several fixes in it. We'll be releasing
> 2.0.1 soon
> with the relevant fixes.
>
> Hopefully they'll remedy this in a future spec revision for JAXB,
> but I'm
> sure thats a little bit off yet.
>
> - Dan
>
> On 7/24/07, Julio Arias <ju...@rbxglobal.com> wrote:
>>
>> Hi -
>>
>> I have a method that returns or has a param of List<String> when I
>> generate the WSDL and then the client from that WSDL I get a strange
>> namespace for that type and therefore strange pakage name when the
>> client is generated, is there a why to customize this to be in the
>> appropriate namespace we tried the @WebResult and @WebParam
>> annotations to specified the target namespace but it didn't work.
>>
>> Then namespace is: http://jaxb.dev.java.net/array
>>
>>
>> Julio Arias
>> Java Developer
>> Roundbox Global : enterprise : technology : genius
>> ---------------------------------------------------------------------
>> Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
>> tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
>> email: julio.arias@rbxglobal.com | www.rbxglobal.com
>> ---------------------------------------------------------------------
>>
>>
>
>
> --
> Dan Diephouse
> Envoi Solutions
> http://envoisolutions.com | http://netzooid.com/blog
Julio Arias
Java Developer
Roundbox Global : enterprise : technology : genius
---------------------------------------------------------------------
Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
email: julio.arias@rbxglobal.com | www.rbxglobal.com
---------------------------------------------------------------------
Re: Generics using JAXB data binding
Posted by Julio Arias <ju...@rbxglobal.com>.
Daniel -
I notice that, we test the latest SVN code and we are very happy on
how it works.
Thanks again for all the help.
On Jul 25, 2007, at 4:15 PM, Daniel Kulp wrote:
>
> Dan, (and Julio)
>
> Actually, if you use the latest SVN code, and the service is set to
> wrapped doc/lit, you may not get the funky package named thing. For
> the top level types in wrapped/doc lit, I now remove the arrays since
> we'll handle those ourselves. Thus, they won't appear as schemas
> in the
> wsdl.
>
> Dan
>
> On Wednesday 25 July 2007 10:21, Dan Diephouse wrote:
>> Much to all of our general disdain here, I believe this is a
>> limitation of JAXB. You in essence have two options:
>> 1. Define a wrapper type. For instance, if you were going to return a
>> collection of customers you would create a Customers class with a
>> List
>> of customers on it
>> 2. Use Aegis - http://cwiki.apache.org/CXF20DOC/aegis-
>> databinding.html
>> - if you go this route, you may want to use the snapshot builds we've
>> been producing as they have several fixes in it. We'll be releasing
>> 2.0.1 soon with the relevant fixes.
>>
>> Hopefully they'll remedy this in a future spec revision for JAXB, but
>> I'm sure thats a little bit off yet.
>>
>> - Dan
>>
>> On 7/24/07, Julio Arias <ju...@rbxglobal.com> wrote:
>>> Hi -
>>>
>>> I have a method that returns or has a param of List<String> when I
>>> generate the WSDL and then the client from that WSDL I get a strange
>>> namespace for that type and therefore strange pakage name when the
>>> client is generated, is there a why to customize this to be in the
>>> appropriate namespace we tried the @WebResult and @WebParam
>>> annotations to specified the target namespace but it didn't work.
>>>
>>> Then namespace is: http://jaxb.dev.java.net/array
>>>
>>>
>>> Julio Arias
>>> Java Developer
>>> Roundbox Global : enterprise : technology : genius
>>> --------------------------------------------------------------------
>>> - Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
>>> tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
>>> email: julio.arias@rbxglobal.com | www.rbxglobal.com
>>> --------------------------------------------------------------------
>>> -
>
> --
> J. Daniel Kulp
> Principal Engineer
> IONA
> P: 781-902-8727 C: 508-380-7194
> daniel.kulp@iona.com
> http://www.dankulp.com/blog
Julio Arias
Java Developer
Roundbox Global : enterprise : technology : genius
---------------------------------------------------------------------
Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
email: julio.arias@rbxglobal.com | www.rbxglobal.com
---------------------------------------------------------------------
Re: Generics using JAXB data binding
Posted by Daniel Kulp <dk...@apache.org>.
Dan, (and Julio)
Actually, if you use the latest SVN code, and the service is set to
wrapped doc/lit, you may not get the funky package named thing. For
the top level types in wrapped/doc lit, I now remove the arrays since
we'll handle those ourselves. Thus, they won't appear as schemas in the
wsdl.
Dan
On Wednesday 25 July 2007 10:21, Dan Diephouse wrote:
> Much to all of our general disdain here, I believe this is a
> limitation of JAXB. You in essence have two options:
> 1. Define a wrapper type. For instance, if you were going to return a
> collection of customers you would create a Customers class with a List
> of customers on it
> 2. Use Aegis - http://cwiki.apache.org/CXF20DOC/aegis-databinding.html
> - if you go this route, you may want to use the snapshot builds we've
> been producing as they have several fixes in it. We'll be releasing
> 2.0.1 soon with the relevant fixes.
>
> Hopefully they'll remedy this in a future spec revision for JAXB, but
> I'm sure thats a little bit off yet.
>
> - Dan
>
> On 7/24/07, Julio Arias <ju...@rbxglobal.com> wrote:
> > Hi -
> >
> > I have a method that returns or has a param of List<String> when I
> > generate the WSDL and then the client from that WSDL I get a strange
> > namespace for that type and therefore strange pakage name when the
> > client is generated, is there a why to customize this to be in the
> > appropriate namespace we tried the @WebResult and @WebParam
> > annotations to specified the target namespace but it didn't work.
> >
> > Then namespace is: http://jaxb.dev.java.net/array
> >
> >
> > Julio Arias
> > Java Developer
> > Roundbox Global : enterprise : technology : genius
> > --------------------------------------------------------------------
> >- Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
> > tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
> > email: julio.arias@rbxglobal.com | www.rbxglobal.com
> > --------------------------------------------------------------------
> >-
--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727 C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog
Re: Generics using JAXB data binding
Posted by Dan Diephouse <da...@envoisolutions.com>.
Much to all of our general disdain here, I believe this is a limitation of
JAXB. You in essence have two options:
1. Define a wrapper type. For instance, if you were going to return a
collection of customers you would create a Customers class with a List of
customers on it
2. Use Aegis - http://cwiki.apache.org/CXF20DOC/aegis-databinding.html - if
you go this route, you may want to use the snapshot builds we've been
producing as they have several fixes in it. We'll be releasing 2.0.1 soon
with the relevant fixes.
Hopefully they'll remedy this in a future spec revision for JAXB, but I'm
sure thats a little bit off yet.
- Dan
On 7/24/07, Julio Arias <ju...@rbxglobal.com> wrote:
>
> Hi -
>
> I have a method that returns or has a param of List<String> when I
> generate the WSDL and then the client from that WSDL I get a strange
> namespace for that type and therefore strange pakage name when the
> client is generated, is there a why to customize this to be in the
> appropriate namespace we tried the @WebResult and @WebParam
> annotations to specified the target namespace but it didn't work.
>
> Then namespace is: http://jaxb.dev.java.net/array
>
>
> Julio Arias
> Java Developer
> Roundbox Global : enterprise : technology : genius
> ---------------------------------------------------------------------
> Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
> tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
> email: julio.arias@rbxglobal.com | www.rbxglobal.com
> ---------------------------------------------------------------------
>
>
--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog