tags:

views:

80

answers:

2

Hi,

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

+1  A: 

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());
Tim
Yes i noticed that, but my list is wrapped in another class (MyListClass). I want to see that class also in proxy, and the method signature to be like one in java.C# see that the list is wrapped and only show me the content of MyListClass which is array of ContactOD.
Adrya
A: 

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.

Brannon
Problem is that i don't see MyListClass at generation and instead i see array of ContactOD (the content of the class)
Adrya