You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Zarar Siddiqi <za...@gmail.com> on 2007/12/11 18:02:52 UTC

Returning Collections using Aegis broken when going from 2.0.1 to 2.0.3

The title says it all, I had this interface and service implementation that
was working fine in 2.0.1 and is not working in 2.0.3 with the stacktrace
below.  Debugging this further I noticed that the collection never really
figures out what generic type it's using.  Here's the SEI and
implementation:

@WebService(targetNamespace="http://arsenalist.com")
public interface SportsService {
    public Collection<Team> getTeams() throws WebServiceException;
}

@WebService(serviceName="SportsService",
targetNamespace="http://arsenalist.com",
        endpointInterface="com.arsenalist.SportsService")
public class SportsServiceImpl implements SportsService {

    public Collection<Team> getTeams() throws WebServiceException {
       // impl
    }
}

org.apache.cxf.aegis.DatabindingException: Error initializing parameters for
operation
{http://service.ws.sis.utoronto.ca/1_0_0/RegistrationService}getFincaPosts: 
	at
org.apache.cxf.aegis.type.DefaultTypeCreator.createCollectionType(DefaultTypeCreator.java:59)
	at
org.apache.cxf.aegis.type.java5.Java5TypeCreator.createCollectionType(Java5TypeCreator.java:137)
	at
org.apache.cxf.aegis.type.XMLTypeCreator.createCollectionType(XMLTypeCreator.java:236)
	at
org.apache.cxf.aegis.type.AbstractTypeCreator.createTypeForClass(AbstractTypeCreator.java:114)
	at
org.apache.cxf.aegis.databinding.AegisDatabinding.getParameterType(AegisDatabinding.java:448)
	at
org.apache.cxf.aegis.databinding.AegisDatabinding.initializeMessage(AegisDatabinding.java:257)
	at
org.apache.cxf.aegis.databinding.AegisDatabinding.initializeOperation(AegisDatabinding.java:221)
	at
org.apache.cxf.aegis.databinding.AegisDatabinding.initialize(AegisDatabinding.java:154)
	at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:293)


Any idea what happened?

Thanks,
Zarar Siddiqi
-- 
View this message in context: http://www.nabble.com/Returning-Collections-using-Aegis-broken-when-going-from-2.0.1-to-2.0.3-tp14278215p14278215.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Returning Collections using Aegis broken when going from 2.0.1-SNAPSHOT to 2.0.3

Posted by Zarar Siddiqi <za...@gmail.com>.
Small correction, the last time I tested this was using the 2.0.1-SNAPSHOT
and it was working perfectly.  Now when I use 2.0.3, I'm getting this error.

Can someone post an example of how to return a collection using java-first
aegis bindings?  

Thanks.




Zarar Siddiqi wrote:
> 
> The title says it all, I had this interface and service implementation
> that was working fine in 2.0.1 and is not working in 2.0.3 with the
> stacktrace below.  Debugging this further I noticed that the collection
> never really figures out what generic type it's using.  Here's the SEI and
> implementation:
> 
> @WebService(targetNamespace="http://arsenalist.com")
> public interface SportsService {
>     public Collection<Team> getTeams() throws WebServiceException;
> }
> 
> @WebService(serviceName="SportsService",
> targetNamespace="http://arsenalist.com",
>         endpointInterface="com.arsenalist.SportsService")
> public class SportsServiceImpl implements SportsService {
> 
>     public Collection<Team> getTeams() throws WebServiceException {
>        // impl
>     }
> }
> 
> org.apache.cxf.aegis.DatabindingException: Error initializing parameters
> for operation
> {http://service.ws.sis.utoronto.ca/1_0_0/RegistrationService}getFincaPosts: 
> 	at
> org.apache.cxf.aegis.type.DefaultTypeCreator.createCollectionType(DefaultTypeCreator.java:59)
> 	at
> org.apache.cxf.aegis.type.java5.Java5TypeCreator.createCollectionType(Java5TypeCreator.java:137)
> 	at
> org.apache.cxf.aegis.type.XMLTypeCreator.createCollectionType(XMLTypeCreator.java:236)
> 	at
> org.apache.cxf.aegis.type.AbstractTypeCreator.createTypeForClass(AbstractTypeCreator.java:114)
> 	at
> org.apache.cxf.aegis.databinding.AegisDatabinding.getParameterType(AegisDatabinding.java:448)
> 	at
> org.apache.cxf.aegis.databinding.AegisDatabinding.initializeMessage(AegisDatabinding.java:257)
> 	at
> org.apache.cxf.aegis.databinding.AegisDatabinding.initializeOperation(AegisDatabinding.java:221)
> 	at
> org.apache.cxf.aegis.databinding.AegisDatabinding.initialize(AegisDatabinding.java:154)
> 	at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:293)
> 
> 
> Any idea what happened?
> 
> Thanks,
> Zarar Siddiqi
> 

-- 
View this message in context: http://www.nabble.com/Returning-Collections-using-Aegis-broken-when-going-from-2.0.1-to-2.0.3-tp14278215p14281722.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Returning Collections using Aegis broken when going from 2.0.1 to 2.0.3

Posted by Zarar Siddiqi <za...@gmail.com>.
You're a lifesaver! It worked. Thanks!



dkulp wrote:
> 
> On Tuesday 11 December 2007, Zarar Siddiqi wrote:
>> Yeah, I did some more research and the problem is with..........take a
>> guess.....c'mon, take a guess......yup, with auto-proxying, more
>> specifically when using BeanNameAutoProxyCreator.  However, this was
>> working with 2.0.1-SNAPSHOT as I said, I'll try upgrading to Spring
>> 2.5 and see if that fixes it.
> 
> Lovely.   The Spring proxy stuff keeps breaking things.....
> 
> One thing to try.....
> 
> In your spring config, the jaxws:endpoint thing now supports both 
> an "implementor" and "implementorClass" attributes.   If you specify the 
> implementorClass in addition to the implementor (the proxified bean), it 
> SHOULD use the information from the implementorClass class to determine 
> things.   Thus, it may get the generics fine from that.
> 
> Dan
> 
> 
> 
>> I also noticed that when the ReflectionServiceFactoryBean is creating
>> the bean, it calls method.getGenericReturnType() which if you use
>> auto-proxying returns java.util.Collection but if you don't use
>> autoproxying returns java.util.Collection<java.lang.String> which is
>> the desired value (I'm doing a toString() on the return values).  This
>> is happening in the method with the signature:
>>
>> protected void createMessageParts(InterfaceInfo intf, OperationInfo
>> op, Method method);
>>
>> If I find out more, I'll post it.
>>
>> Thanks,
>> Zarar
>>
>> dkulp wrote:
>> > I've tried to reproduce this issue, but failed.   We do have a
>> > system test that tests a method like:
>> >     java.util.List<String> getRoles(String sid);
>> > with Aegis and that is working fine.    I might need to ask you for
>> > a sample project that demonstrates the problem as the system tests
>> > that look very similar behave fine.
>> >
>> > That said, I DID have issues trying to use Aegis+JAXWS along with a
>> > wsdl on the client side.   That ended up throwing a NPE at init
>> > time.   I'm fixing that now.
>> >
>> > Dan
>> >
>> > On Tuesday 11 December 2007, Zarar Siddiqi wrote:
>> >> The title says it all, I had this interface and service
>> >> implementation that was working fine in 2.0.1 and is not working in
>> >> 2.0.3 with the stacktrace below.  Debugging this further I noticed
>> >> that the collection never really figures out what generic type it's
>> >> using. Here's the SEI and implementation:
>> >>
>> >> @WebService(targetNamespace="http://arsenalist.com")
>> >> public interface SportsService {
>> >>     public Collection<Team> getTeams() throws WebServiceException;
>> >> }
>> >>
>> >> @WebService(serviceName="SportsService",
>> >> targetNamespace="http://arsenalist.com",
>> >>         endpointInterface="com.arsenalist.SportsService")
>> >> public class SportsServiceImpl implements SportsService {
>> >>
>> >>     public Collection<Team> getTeams() throws WebServiceException {
>> >>        // impl
>> >>     }
>> >> }
>> >>
>> >> org.apache.cxf.aegis.DatabindingException: Error initializing
>> >> parameters for operation
>> >> {http://service.ws.sis.utoronto.ca/1_0_0/RegistrationService}getFin
>> >>caP osts: at
>> >> org.apache.cxf.aegis.type.DefaultTypeCreator.createCollectionType(D
>> >>efa ultTypeCreator.java:59) at
>> >> org.apache.cxf.aegis.type.java5.Java5TypeCreator.createCollectionTy
>> >>pe( Java5TypeCreator.java:137) at
>> >> org.apache.cxf.aegis.type.XMLTypeCreator.createCollectionType(XMLTy
>> >>peC reator.java:236) at
>> >> org.apache.cxf.aegis.type.AbstractTypeCreator.createTypeForClass(Ab
>> >>str actTypeCreator.java:114) at
>> >> org.apache.cxf.aegis.databinding.AegisDatabinding.getParameterType(
>> >>Aeg isDatabinding.java:448) at
>> >> org.apache.cxf.aegis.databinding.AegisDatabinding.initializeMessage
>> >>(Ae gisDatabinding.java:257) at
>> >> org.apache.cxf.aegis.databinding.AegisDatabinding.initializeOperati
>> >>on( AegisDatabinding.java:221) at
>> >> org.apache.cxf.aegis.databinding.AegisDatabinding.initialize(AegisD
>> >>ata binding.java:154) at
>> >> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildSe
>> >>rvi ceFromClass(ReflectionServiceFactoryBean.java:293)
>> >>
>> >>
>> >> Any idea what happened?
>> >>
>> >> Thanks,
>> >> Zarar Siddiqi
>> >
>> > --
>> > J. Daniel Kulp
>> > Principal Engineer
>> > IONA
>> > P: 781-902-8727    C: 508-380-7194
>> > daniel.kulp@iona.com
>> > http://www.dankulp.com/blog
> 
> 
> 
> -- 
> J. Daniel Kulp
> Principal Engineer
> IONA
> P: 781-902-8727    C: 508-380-7194
> daniel.kulp@iona.com
> http://www.dankulp.com/blog
> 
> 

-- 
View this message in context: http://www.nabble.com/Returning-Collections-using-Aegis-broken-when-going-from-2.0.1-to-2.0.3-tp14278215p14283973.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Returning Collections using Aegis broken when going from 2.0.1 to 2.0.3

Posted by Daniel Kulp <dk...@apache.org>.
On Tuesday 11 December 2007, Zarar Siddiqi wrote:
> Yeah, I did some more research and the problem is with..........take a
> guess.....c'mon, take a guess......yup, with auto-proxying, more
> specifically when using BeanNameAutoProxyCreator.  However, this was
> working with 2.0.1-SNAPSHOT as I said, I'll try upgrading to Spring
> 2.5 and see if that fixes it.

Lovely.   The Spring proxy stuff keeps breaking things.....

One thing to try.....

In your spring config, the jaxws:endpoint thing now supports both 
an "implementor" and "implementorClass" attributes.   If you specify the 
implementorClass in addition to the implementor (the proxified bean), it 
SHOULD use the information from the implementorClass class to determine 
things.   Thus, it may get the generics fine from that.

Dan



> I also noticed that when the ReflectionServiceFactoryBean is creating
> the bean, it calls method.getGenericReturnType() which if you use
> auto-proxying returns java.util.Collection but if you don't use
> autoproxying returns java.util.Collection<java.lang.String> which is
> the desired value (I'm doing a toString() on the return values).  This
> is happening in the method with the signature:
>
> protected void createMessageParts(InterfaceInfo intf, OperationInfo
> op, Method method);
>
> If I find out more, I'll post it.
>
> Thanks,
> Zarar
>
> dkulp wrote:
> > I've tried to reproduce this issue, but failed.   We do have a
> > system test that tests a method like:
> >     java.util.List<String> getRoles(String sid);
> > with Aegis and that is working fine.    I might need to ask you for
> > a sample project that demonstrates the problem as the system tests
> > that look very similar behave fine.
> >
> > That said, I DID have issues trying to use Aegis+JAXWS along with a
> > wsdl on the client side.   That ended up throwing a NPE at init
> > time.   I'm fixing that now.
> >
> > Dan
> >
> > On Tuesday 11 December 2007, Zarar Siddiqi wrote:
> >> The title says it all, I had this interface and service
> >> implementation that was working fine in 2.0.1 and is not working in
> >> 2.0.3 with the stacktrace below.  Debugging this further I noticed
> >> that the collection never really figures out what generic type it's
> >> using. Here's the SEI and implementation:
> >>
> >> @WebService(targetNamespace="http://arsenalist.com")
> >> public interface SportsService {
> >>     public Collection<Team> getTeams() throws WebServiceException;
> >> }
> >>
> >> @WebService(serviceName="SportsService",
> >> targetNamespace="http://arsenalist.com",
> >>         endpointInterface="com.arsenalist.SportsService")
> >> public class SportsServiceImpl implements SportsService {
> >>
> >>     public Collection<Team> getTeams() throws WebServiceException {
> >>        // impl
> >>     }
> >> }
> >>
> >> org.apache.cxf.aegis.DatabindingException: Error initializing
> >> parameters for operation
> >> {http://service.ws.sis.utoronto.ca/1_0_0/RegistrationService}getFin
> >>caP osts: at
> >> org.apache.cxf.aegis.type.DefaultTypeCreator.createCollectionType(D
> >>efa ultTypeCreator.java:59) at
> >> org.apache.cxf.aegis.type.java5.Java5TypeCreator.createCollectionTy
> >>pe( Java5TypeCreator.java:137) at
> >> org.apache.cxf.aegis.type.XMLTypeCreator.createCollectionType(XMLTy
> >>peC reator.java:236) at
> >> org.apache.cxf.aegis.type.AbstractTypeCreator.createTypeForClass(Ab
> >>str actTypeCreator.java:114) at
> >> org.apache.cxf.aegis.databinding.AegisDatabinding.getParameterType(
> >>Aeg isDatabinding.java:448) at
> >> org.apache.cxf.aegis.databinding.AegisDatabinding.initializeMessage
> >>(Ae gisDatabinding.java:257) at
> >> org.apache.cxf.aegis.databinding.AegisDatabinding.initializeOperati
> >>on( AegisDatabinding.java:221) at
> >> org.apache.cxf.aegis.databinding.AegisDatabinding.initialize(AegisD
> >>ata binding.java:154) at
> >> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildSe
> >>rvi ceFromClass(ReflectionServiceFactoryBean.java:293)
> >>
> >>
> >> Any idea what happened?
> >>
> >> Thanks,
> >> Zarar Siddiqi
> >
> > --
> > J. Daniel Kulp
> > Principal Engineer
> > IONA
> > P: 781-902-8727    C: 508-380-7194
> > daniel.kulp@iona.com
> > http://www.dankulp.com/blog



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: Returning Collections using Aegis broken when going from 2.0.1 to 2.0.3

Posted by Zarar Siddiqi <za...@gmail.com>.
Yeah, I did some more research and the problem is with..........take a
guess.....c'mon, take a guess......yup, with auto-proxying, more
specifically when using BeanNameAutoProxyCreator.  However, this was working
with 2.0.1-SNAPSHOT as I said, I'll try upgrading to Spring 2.5 and see if
that fixes it.  

I also noticed that when the ReflectionServiceFactoryBean is creating the
bean, it calls method.getGenericReturnType() which if you use auto-proxying
returns java.util.Collection but if you don't use autoproxying returns
java.util.Collection<java.lang.String> which is the desired value (I'm doing
a toString() on the return values).  This is happening in the method with
the signature:

protected void createMessageParts(InterfaceInfo intf, OperationInfo op,
Method method);

If I find out more, I'll post it.

Thanks,
Zarar


dkulp wrote:
> 
> 
> I've tried to reproduce this issue, but failed.   We do have a system 
> test that tests a method like:
>     java.util.List<String> getRoles(String sid);
> with Aegis and that is working fine.    I might need to ask you for a 
> sample project that demonstrates the problem as the system tests that 
> look very similar behave fine. 
> 
> That said, I DID have issues trying to use Aegis+JAXWS along with a wsdl 
> on the client side.   That ended up throwing a NPE at init time.   I'm 
> fixing that now. 
> 
> Dan
> 
> 
> 
> On Tuesday 11 December 2007, Zarar Siddiqi wrote:
>> The title says it all, I had this interface and service implementation
>> that was working fine in 2.0.1 and is not working in 2.0.3 with the
>> stacktrace below.  Debugging this further I noticed that the
>> collection never really figures out what generic type it's using. 
>> Here's the SEI and implementation:
>>
>> @WebService(targetNamespace="http://arsenalist.com")
>> public interface SportsService {
>>     public Collection<Team> getTeams() throws WebServiceException;
>> }
>>
>> @WebService(serviceName="SportsService",
>> targetNamespace="http://arsenalist.com",
>>         endpointInterface="com.arsenalist.SportsService")
>> public class SportsServiceImpl implements SportsService {
>>
>>     public Collection<Team> getTeams() throws WebServiceException {
>>        // impl
>>     }
>> }
>>
>> org.apache.cxf.aegis.DatabindingException: Error initializing
>> parameters for operation
>> {http://service.ws.sis.utoronto.ca/1_0_0/RegistrationService}getFincaP
>>osts: at
>> org.apache.cxf.aegis.type.DefaultTypeCreator.createCollectionType(Defa
>>ultTypeCreator.java:59) at
>> org.apache.cxf.aegis.type.java5.Java5TypeCreator.createCollectionType(
>>Java5TypeCreator.java:137) at
>> org.apache.cxf.aegis.type.XMLTypeCreator.createCollectionType(XMLTypeC
>>reator.java:236) at
>> org.apache.cxf.aegis.type.AbstractTypeCreator.createTypeForClass(Abstr
>>actTypeCreator.java:114) at
>> org.apache.cxf.aegis.databinding.AegisDatabinding.getParameterType(Aeg
>>isDatabinding.java:448) at
>> org.apache.cxf.aegis.databinding.AegisDatabinding.initializeMessage(Ae
>>gisDatabinding.java:257) at
>> org.apache.cxf.aegis.databinding.AegisDatabinding.initializeOperation(
>>AegisDatabinding.java:221) at
>> org.apache.cxf.aegis.databinding.AegisDatabinding.initialize(AegisData
>>binding.java:154) at
>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServi
>>ceFromClass(ReflectionServiceFactoryBean.java:293)
>>
>>
>> Any idea what happened?
>>
>> Thanks,
>> Zarar Siddiqi
> 
> 
> 
> -- 
> J. Daniel Kulp
> Principal Engineer
> IONA
> P: 781-902-8727    C: 508-380-7194
> daniel.kulp@iona.com
> http://www.dankulp.com/blog
> 
> 

-- 
View this message in context: http://www.nabble.com/Returning-Collections-using-Aegis-broken-when-going-from-2.0.1-to-2.0.3-tp14278215p14283248.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Returning Collections using Aegis broken when going from 2.0.1 to 2.0.3

Posted by Daniel Kulp <dk...@apache.org>.
I've tried to reproduce this issue, but failed.   We do have a system 
test that tests a method like:
    java.util.List<String> getRoles(String sid);
with Aegis and that is working fine.    I might need to ask you for a 
sample project that demonstrates the problem as the system tests that 
look very similar behave fine. 

That said, I DID have issues trying to use Aegis+JAXWS along with a wsdl 
on the client side.   That ended up throwing a NPE at init time.   I'm 
fixing that now. 

Dan



On Tuesday 11 December 2007, Zarar Siddiqi wrote:
> The title says it all, I had this interface and service implementation
> that was working fine in 2.0.1 and is not working in 2.0.3 with the
> stacktrace below.  Debugging this further I noticed that the
> collection never really figures out what generic type it's using. 
> Here's the SEI and implementation:
>
> @WebService(targetNamespace="http://arsenalist.com")
> public interface SportsService {
>     public Collection<Team> getTeams() throws WebServiceException;
> }
>
> @WebService(serviceName="SportsService",
> targetNamespace="http://arsenalist.com",
>         endpointInterface="com.arsenalist.SportsService")
> public class SportsServiceImpl implements SportsService {
>
>     public Collection<Team> getTeams() throws WebServiceException {
>        // impl
>     }
> }
>
> org.apache.cxf.aegis.DatabindingException: Error initializing
> parameters for operation
> {http://service.ws.sis.utoronto.ca/1_0_0/RegistrationService}getFincaP
>osts: at
> org.apache.cxf.aegis.type.DefaultTypeCreator.createCollectionType(Defa
>ultTypeCreator.java:59) at
> org.apache.cxf.aegis.type.java5.Java5TypeCreator.createCollectionType(
>Java5TypeCreator.java:137) at
> org.apache.cxf.aegis.type.XMLTypeCreator.createCollectionType(XMLTypeC
>reator.java:236) at
> org.apache.cxf.aegis.type.AbstractTypeCreator.createTypeForClass(Abstr
>actTypeCreator.java:114) at
> org.apache.cxf.aegis.databinding.AegisDatabinding.getParameterType(Aeg
>isDatabinding.java:448) at
> org.apache.cxf.aegis.databinding.AegisDatabinding.initializeMessage(Ae
>gisDatabinding.java:257) at
> org.apache.cxf.aegis.databinding.AegisDatabinding.initializeOperation(
>AegisDatabinding.java:221) at
> org.apache.cxf.aegis.databinding.AegisDatabinding.initialize(AegisData
>binding.java:154) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServi
>ceFromClass(ReflectionServiceFactoryBean.java:293)
>
>
> Any idea what happened?
>
> Thanks,
> Zarar Siddiqi



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog