Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » vector returns Null when invoked remotely
vector returns Null when invoked remotely [message #155242] Sat, 07 January 2006 01:40
Eclipse UserFriend
Originally posted by: reza_ameri.tiscali.co.uk

[code]Hi eveyone
I am using Eclipse 3.1
I am using stubs to read a file and display employee name but only arrary
of
Null value is returned.
I do not see anything wrong with the code.
But When I use the EmployeeRecord class in standalone application
(Non Web service) it works & I can display list of employee names
Any clues please?

kind regards

I use Static Stub Client not Dynamic calls`

----------------------- my Static Stub Client
-----------------------------
String [] employeeArrays = new String [15];
Vector empVector = new Vector ();

public static void main(String[] args) throws Exception
{
try
{
//Make a service
EmployeeRecordServiceLocator service = new
EmployeeRecordServiceLocator();
// Now use the service to get a stub
EmployeeRecord port = service.getEmployeeRecord();
// Make the actual calls
empVector = port.readEmployeeFile("employee.txt");
employeeArrays = port.getSavedEmployeeArray();

for (int k = 0; k < 15; k++)
{
System.out.print("Employee " + k + " " + employeeArrays[k] +
" \n" );
}

} // try
catch(Exception e)
{
System.out.println("Exception caught" + e);
}

------------------------ part of my Java class which is being used
------------------------------------

static int count2 = 0;
private String bufString = new String();
static final String [] employeeArrays = new String [20];

public EmployeeRecord(String readBuf, int VectorSize)
{

count2 = VectorSize ;
employeeArrays[VectorSize ] = readBuf;
addEmployeeSavedArray(employeeArrays ,count2 );
}


public final static String [] getSavedEmployeeArray()
{
return employeeArrays;
}

public void addEmployeeSavedArray( String [] employeeSavedArrayss , int
counts)
{
for(int i = 0; i < counts; i++)
{
employeeArrays[i] = employeeSavedArrayss[i];
}
// return employeeArrays;
}

public Vector ReadEmployeeFile(String fileName,String Name)
{
Vector EmployeeVector = new Vector ();
int count = 0;

try
{
File file = new File(fileName);
if (file.exists() && file.isFile())
{
FileReader fr = new FileReader(file);
BufferedReader br = new BufferedReader(fr);
String line;
while ((line = br.readLine()) != null)
{
EmployeeVector.addElement( new EmployeeRecord (
line.trim(), count++) );
} // While loop
br.close();
} // If
} catch (IOException e) {
System.err.println("Problem: " + e);
}
return (EmployeeVector);
Previous Topic:why the pulibshing is so slowly???
Next Topic:Usage of WebApp and WebArtifactEdit
Goto Forum:
  


Current Time: Sun Jun 30 12:46:10 GMT 2024

Powered by FUDForum. Page generated in 0.02885 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top