I have a web service in java that implemented on jax-ws. This web service return an generic list of User. It's working very good :).
@Stateless(name = "AdminToolSessionEJB")
@RemoteBinding(jndiBinding = "AdminToolSessionRemote")
@Remote(AdminToolSessionRemote.class)
@WebService
public class AdminToolSessionBean implements AdminToolSessionRemote {
...
@WebMethod(operationName = "GetAllUsers")
@WebResult(name = "AllUsers")
public List getAllUsers() {
return userSessionRemote.getAllUsers();
}
...
}
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "User")
public class User extends BasicDataTransferObject {
...
@XmlElement(name = "Groups")
private List groups;
...
}
But I will use this web service in .Net Applications. When I add this web service as a wcf service or web service in VS2005 or VS2008 or VS2010, VS generate array instead od generic list 'Group[] Groups'. I change 'Collection Type' in 'Configuration Service Reference ...' dialog to 'System.Collections.Generic.List' but VS generate array :(.
I need to VS generate generic list or ArrayList, what I should to do?
解决方案
I'm not sure how to define this in java. However, in my C# service, my main transaction parameter (a purchase order) contains a list of line items defined like this:
private LineItems LineItemsField;
[DataMember(Order=13, EmitDefaultValue=false)]
public LineItems LineItems {
get { return this.LineItemsField; }
set { this.LineItemsField = value; }
}
LineItems is another C# class, defined like this:
[CollectionDataContract(Namespace="")]
public class LineItems : List
{
}
LineItem is the actual class that contains the line item fields.
The LineItems appears in WSDL as:
ArrayOfLineItem is defined as:
And of course, the LineItem class itself is defined elsewhere. Hopefully that helps.