The XFire client generated using wsgen (default jaxb binding) has trouble binding the returned SOAP message to Java objects when using a Collection as a return type. It works for all other cases but as soon as I try to return a Collection or an array, the binding fails. The correct soap message is returned from the server but when I use the API to print the values the list size is always zero even though the soap message contained multiple items corresponding to the collection:
ArrayOfUser users = service.getUsers(..); System.out.println(users.getUser().size()); // always prints 0 I've annotated one of my domain objects (User) with an Aegis annotation to prevent the properties being wrapped around the JAXBElement type, aside from that nothing "weird" is going on. The docs say that I don't need to specify a .aegis.xml file if I'm using Java5 Generics and that the binding should happen normally. http://xfire.codehaus.org/Mapping+collections I'm not making any changes to the generated code. Any help is appreciated. I'm running XFire 1.2.4 with JDK 1.5.0_11 and have the following service exposed using JSR 181 annotations. @WebService public interface UserService { public Collection<User> getUsers(String authority) throws WebServiceException; } @WebService(serviceName="UserSoapService", endpointInterface = "com.arsenalist.UserService") @InHandlers (handlers={ // my in-handlers }) @OutHandlers (handlers={ // my out-handlers }) public class UserSoapService implements UserService { public Collection<User> getUsers(String authority) throws WebServiceException { // return a list of users } } public class User { private String username; @XmlElement(minOccurs="1") public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } } My spring configuration is as follows: <bean id="webAnnotations" class="org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations"/> <bean id="handlerMapping" class="org.codehaus.xfire.spring.remoting.Jsr181HandlerMapping"> <property name="typeMappingRegistry"> <ref bean="xfire.typeMappingRegistry"/> </property> <property name="xfire"> <ref bean="xfire"/> </property> <property name="webAnnotations"> <ref bean="webAnnotations"/> </property> </bean> <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="urlMap"> <map> <entry key="/"> <ref bean="handlerMapping"/> </entry> </map> </property> </bean> <bean id="userSoapService" class="com.arsenalist.UserSoapService"/> -- View this message in context: http://www.nabble.com/Problem-returning-a-Collection-or-an-array-using-generics-tf3364015.html#a9359145 Sent from the XFire - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email
