How to get array of object using RPCServiceClient
-------------------------------------------------
Key: AXIS2-4971
URL: https://issues.apache.org/jira/browse/AXIS2-4971
Project: Axis2
Issue Type: Bug
Reporter: Asit Jaiswal
Hi,
I tried the following code to get array of object, but all the time I get only
one object.
RPCServiceClient serviceClient = new RPCServiceClient();
Options options = serviceClient.getOptions();
EndpointReference targetEPR = new
EndpointReference("http://localhost:8080/Module/services/SearchService");
options.setTo(targetEPR);
QName qname1 = new QName("http://search.status.com", "getResult");
Object[] args1 = new Object[] {"page" };
Class[] types1 = new Class[] { Result.class};
Object[] response1 = serviceClient.invokeBlocking(qname1, args1,
types1);
System.out.println("Lenght of response is "+response1.length);
Result u1 = (Result) response1[0];
if (u1 == null) {
System.out.println("u1 was null");
return;
}
for(int i=0;i<response1.length;i++){ u1 = (Result)response1[i];
System.out.println(u1.getTitle()); System.out.println(u1.getName());
System.out.println(u1.getMetatag()); } The above code is ok if we have to get
only one object at client side, but if I want to get two or more objects in
response, I have to modify above line (the line which is in bold fonts) by <b>
Class[] types1 = new Class[] {
Result.class,Result.class,Result.class,Result.class};
In which I have to repeat Result.class number of time at the number of object I
want, but How I come to know that how many objects will be there in response,
Please suggest me some Idea.
Thanks in advance
Asit Jaiswal
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]