cancel
Showing results for 
Search instead for 
Did you mean: 

Array as output in Webservice

Former Member
0 Kudos

Hi ,

I have written a method and the return type of the method if array . Somehow I am not able to see any output on webserivce navigator. But when I run the same program as standalone application it works. Here is the code -

	public String[] postGRData() {

		String[] AUFNR = new String[20];
		
		
		for (int i = 0; i < AUFNR.length; i++) {
			AUFNR<i> = new String();
		}
			
		try {
			Connection conn;
			InitialContext ctx = new InitialContext();
			DataSource dataSource =
				(DataSource) ctx.lookup(readPropertyFiles());
			conn = dataSource.getConnection();

			ResultSet rs;
			PreparedStatement stmt =
				conn.prepareStatement(
					"select * from zae_prod_grtable where status = ?");
			stmt.setInt(1, 1);
			rs = stmt.executeQuery();

			int i = 0;
			while (rs.next()) {
		        AUFNR<i> = rs.getString("AUFNR");
				i = i + 1;
			}
			stmt.close();
			conn.close();		
			return AUFNR;
		} catch (Exception ex) {

		}

		return AUFNR;
	}

Accepted Solutions (1)

Accepted Solutions (1)

siarhei_pisarenka3
Active Contributor
0 Kudos

Hi David,

It might appear that an exception occurs in the case and the output array is just array of empty strings.

Try to log an exception in the catch section, not to swallow it. Then you will understand what is the problem:

} catch (Exception ex) {

e.printStackTrace();

}

Then check the default server logs (defaultTrace).

BR, Sergei

Answers (0)