I know I should probably post this in Web Services of Web Development, but this may be beneficial to others that are trying to lean something about it too.

I'm getting lot of strange behaviour from this assignment that at this point I'm willing to throw it away and never work on it.
I have class that run various queries with database. With use of Axis2 plug-in I was able to generate WSDL (This has some red sections which I'm not able to work out). Here is small section of two methods out of it to demonstrate some errors I'm getting

public Employee logEmployee(String usr, String pass) {
        System.out.println("Username = "+ usr+" Password = "+pass);
        Employee e = new Employee();
        Connection conn = cm.getConnection();
        if (conn != null) {
            ResultSet rs = null;
            PreparedStatement preparedStatement = null;
            try {
                String strQuery =
                        "SELECT employee_id, branch_id, password, firstName, lastName "
                                + "FROM employee WHERE employee_id=? AND password=?";

                preparedStatement = conn.prepareStatement(strQuery);
                preparedStatement.setString(1, usr);
                preparedStatement.setString(2, pass);
                rs = preparedStatement.executeQuery();

                while (rs.next()) {
                    e.setEmployeeID(rs.getString("employee_id"));
                    e.setBranchID(rs.getString("branch_id"));
                    e.setPassword(rs.getString("password"));
                    e.setFirstName(rs.getString("firstName"));
                    e.setLastName(rs.getString("lastName"));
                }
            }
            catch (SQLException ex) {
                ex.printStackTrace();
            }
            finally {
                try {
                    rs.close();
                    preparedStatement.close();
                }
                catch (SQLException sqle) {
                    sqle.printStackTrace();
                }
                catch (NullPointerException npe) {
                    npe.printStackTrace();
                }
                cm.putConnection(conn);
            }
        }
        return e;
    }

    public ArrayList<Employee> viewEmployees() {
        ArrayList<Employee> employee = new ArrayList<Employee>();
        Connection conn = cm.getConnection();
        if (conn != null) {
            ResultSet rs = null;
            PreparedStatement preparedStatement = null;
            Employee emp;
            try {
                String strQuery =
                        "SELECT employee_id, branch_id, firstName, lastName "
                                + "FROM employee ORDER BY lastName,firstName";

                preparedStatement = conn.prepareStatement(strQuery);
                rs = preparedStatement.executeQuery();

                while (rs.next()) {
                    emp = new Employee();
                    emp.setEmployeeID(rs.getString("employee_id"));
                    emp.setBranchID(rs.getString("branch_id"));
                    emp.setFirstName(rs.getString("firstName"));
                    emp.setLastName(rs.getString("lastName"));
                    employee.add(emp);
                }
            }
            catch (SQLException ex) {
                ex.printStackTrace();
            }
            finally {
                try {
                    rs.close();
                    preparedStatement.close();
                }
                catch (SQLException sqle) {
                    sqle.printStackTrace();
                }
                catch (NullPointerException npe) {
                    npe.printStackTrace();
                }
                cm.putConnection(conn);
            }
        }
        return employee;
    }

I was able to use this WSDL to create client side and get automated files Service, ServiceLocator, _PortType, SoapBindingStub.
To communicate with service I use following code

try{
            EmployeeQueriesServiceLocator locator = new EmployeeQueriesServiceLocator();
            EmployeeQueries_PortType service = locator.getEmployeeQueries();

            //execution of any service method here
        }
        catch(ServiceException ex){
            ex.printStackTrace();
        }
        catch(RemoteException re){
            re.printStackTrace();
        }

However for example when I'm trying to log in through logEmployee(String usr, String pass) method server side receive only user name string and password is lost. (I found solution to this in sending these strings in array)
Secondly when I tried to retrieve list of all employees through viewEmployees() method that is supposed to return ArrayList<Employee> I'm getting warning or error that found return is actually Object[].
Can somebody shed some light into this darkness? :?:

first issue sounds really strange, the system out doesn't print pass?
with the second, are you importing Employee?

A piece of advice: use a debugger, given that we have no way of reproducing the scenario and the code posted so far looks OK.

BTW, why are you catching a NullPointerException ? Catching unchecked exceptions without any kind of processing is *always* a bad practice and screams of a pre-condition check. Instead put null checks before closing the database resources [like result sets and statements].

Connection conn = null;
Statement stmt = null;
try {
  try {
    // do something
  } finally {
    if(stmt != null) stmt.close();
    if(conn != null) conn.close();
  }
} catch(Exception e) {
  e.printStackTrace();
}

Yeah NullPointerException is one of many small things I need to battle through as many of the things I pick up either from IDE suggestions (which is not always best to do) or following other people code and often miss the reason of the use. Hopefully with all this technical reading I'm doing I will loose some bad habits ;)

Right now I'm "cracking" through Service-Oriented Architecture with Java Web Services by Mark Hansen and found nice quote

Unfortunately, if you are like me, you may have found the Java Web Services learning curve a little steep. It seems that lots of powerful and complex machinery is required just to deploy a Java class as a Web service or create a simple client to consume such services. Sure, you can get the simple "Hello World" application from the Java EE 5 tutorial to work. However, when you need to deploy your purchase ordering system, things suddenly seem to get much more complicated. Either the WSDL you start with gets compiled into myriad bizarre classes that have to be manually wrapped and mapped into your real purchasing system, or, if you start from your Java classes, the WSDL that gets produced doesn't turn out the way you need it to. If you have been frustrated by problems like these, I sympathize with you.

This assignment is already submitted, it is only my stubbornness that push now to find out why it did not worked in first place and in doing so learn something new and maybe help somebody in the future with insufficient resources and support from tutor/teacher

This article has been dead for over six months. Start a new discussion instead.