p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

java_webservices thread: Need help to understand a command line


Message #1 by yuet_niswee@h... on Sun, 8 Dec 2002 11:22:39
 am trying to invoke service in Server, get a data back from the server 
also.
i need help to understand the command line of :

Object[] list =(java.lang.Object[])org.apache.axis.utils.JavaUtils.convert
(FlghList,java.lang.Object[].class);

the full coding where the command line appears is as follow:

public ArrayList getFlight(String destination, String arrive, String 
FrDate, String ToDate, String type, String clas, String adult, String 
child) throws Exception{
try{
String methodName = "getFlightInfo";
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endPointURL));
call.setOperationName(new QName("FlightService",methodName));
call.addParameter("destination", 
XMLType.XSD_STRING,ParameterMode.PARAM_MODE_IN);
call.addParameter("arrive", 
XMLType.XSD_STRING,ParameterMode.PARAM_MODE_IN);
call.addParameter("FrDate", 
XMLType.XSD_STRING,ParameterMode.PARAM_MODE_IN);
call.addParameter("ToDate", 
XMLType.XSD_STRING,ParameterMode.PARAM_MODE_IN);
call.addParameter("type", XMLType.XSD_STRING,ParameterMode.PARAM_MODE_IN);
call.addParameter("clas", XMLType.XSD_STRING,ParameterMode.PARAM_MODE_IN);
call.addParameter("adult", XMLType.XSD_STRING,ParameterMode.PARAM_MODE_IN);
call.addParameter("child", XMLType.XSD_STRING,ParameterMode.PARAM_MODE_IN);

QName qname = new QName("FlightService", "Flight");
Class cls = com.client.entity.Flight.class;
call.registerTypeMapping(cls, qname, BeanSerializerFactory.class, 
BeanDeserializerFactory.class);
call.setReturnType(XMLType.SOAP_ARRAY);

Object[] params = new Object[]{destination, 
arrive,FrDate,ToDate,type,clas,adult,child};
Object FlghList = call.invoke(params);
Object[] list =(java.lang.Object[])org.apache.axis.utils.JavaUtils.convert
(FlghList,java.lang.Object[].class);
ArrayList FlghArrayList = new ArrayList();
for(int i = 0; i<list.length; i++) {
Flight flgh = (Flight) list;
FlghArrayList.add(flgh);
}
return FlghArrayList;
}//try
catch(Exception e){
throw e;
}//catch

}//getFlight

  Return to Index