hey,
i am working on a web services (WS) program. i have a method in the server that reads text file and store every line of text in to a string array.
on the client side, when i call the method it shows me that the value being retuned is String but not a string array (String[])
help why am i unable to return array from the server to the client
thank you!!!!
SERVER
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import java.io.*;
import java.lang.String;
@WebService()
public class Customer {
/**
* Web service operation
*/
@WebMethod(operationName = "openFile")
public String[] openFile(@WebParam(name = "fileName")
String fileName) {
int num = 0;
int i =0;
String str="";
String[] name=new String[200];
try {
BufferedReader bufeinp = new BufferedReader( new FileReader("customers/"+fileName+".txt"));
while ((str = bufeinp.readLine()) !=null){
name[i] =str;
i++;
++num;
}
bufeinp.close();
}
catch(IOException e)
{
System.err.println("Exception: " + e.getMessage());
System.exit(1);
}
return name;
}
}
CLIENT
private cust.CustomerService service = new cust.CustomerService();
private cust.Customer port = service.getCustomerPort();
//this part gives me error
String[] array = port.displayNames();