tags:

views:

35

answers:

0

I have a POJO I'm returning from a RPC using Axis2. For some reason the POJO returning works great unless there's an array or Collection as a member. My POJO is:

public class MyResponse implements Serializable {
private int type;
private Object myData;

public RpcResponse() {}

public int getType() {
 return type;
}
public void setType(int type) {
  this.type = type;
}

public Object getMyData() {
  return myData;
}

public void setMyData(Object myData) {
  this.myData = myData;
}
}

On the server side I have a service with the method:

public MyResponse getMyStuff() {
  // code to create array and pojo and return it
}

If I setMyData with an array or Collection it just shows up as null on the other side. Odd thing is if at the browser I type in:

http://localhost:8080/myServer/services/myService/getMyStuff

It shows the xml response and HAS all of the pojo's data including each item in the array. This tells me it might be an issue with my client code which is:

QName opGetMyStuff = new QName("", "getMyStuff");

Object[] opGetMyStuffArgs = new Object[] { };
Class[] returnTypes = new Class[] { MyResponse.class };

Object[] response = serviceClient.invokeBlocking(opGetMyStuff, opGetMyStuffArgs, returnTypes);
MyResponse result = (MyResponse) response[0];

if (result == null) {
  System.out.println("didn't initialize!");
  return;
}else{
  System.out.println("-->   "+result);
}

Object[] list = (Object[]) result.getResponseData();
System.out.println("list[]: "+list);

Anyone have any ideas why adding an array or collection causes issues with returned data?