Reputation: 3607
I have a Java service that has the following method signature:
@WebMethod(operationName = "getContactList")
public MyListClass getContactList(@WebParam(name = "myList") MyListClass myList) throws IllegalArgumentException {
return myList;
}
public class MyListClass implements Serializable{
List<ContactOD> innerList;
public List<ContactOD> getInnerList() {
if(innerList == null){
innerList = new ArrayList<ContactOD>();
}
return innerList;
}
public void setInnerList(List<ContactOD> innerList) {
this.innerList = innerList;
}
}
When i generate the proxy in C# for this Java service, i get the method signature like this:
public ContactOD[] getContactList(ContactOD[] myList)
I see nowhere in my generated proxy MyListClass that wraps this List<ContactOD>
.
What do i need to do to the java web service or to the C# generation of proxy so i can see in the proxy class the method like this:
public MyListClass getContactList(MyListClass myList)
Thank you so much, Adriana
Upvotes: 0
Views: 332
Reputation: 26109
When you generate the WCF proxy, you can choose what collection type to use.
From the command-line, the appropriate option is /collection:"<type>"
where is the fully-qualified type name.
From the Add Service Reference UI, there is a drop-down under the advanced options.
Upvotes: 0
Reputation: 2724
The proxy generator within Visual Studio will not directly map Java List to C# List instead it is treating it as an array. The easiest thing to do on the C# side, if you wish to work with Generic collections is to simply use List elsewhere and then create to/from T[] when using the web service method.
ie.
List<ContactOD> contacts = new List<ContactOD>();
contacts.Add(New ContactOD("Tim", "0123456789"));
List<ContactOD> returnValue = new List<ContactOD>(ProxyHolder.getContactList(contacts.ToArray());
Upvotes: 1