WEB开发网
开发学院软件开发Java 用 Apache Geronimo 和 Axis2 实现在线银行,第 2... 阅读

用 Apache Geronimo 和 Axis2 实现在线银行,第 2 部分: 服务:填充内容(下)

 2010-03-19 00:00:00 来源:WEB开发网   
核心提示:查看贷款申请表的状态客户总是迫切希望查看他们的贷款申请是否已被接受,更新查看贷款申请表状态操作,用 Apache Geronimo 和 Axis2 实现在线银行,第 2 部分: 服务:填充内容(下),如 清单 23 所示,清单 23. 查看贷款申请表状态publiccom.example.www.onlinebanki

查看贷款申请表的状态

客户总是迫切希望查看他们的贷款申请是否已被接受。更新查看贷款申请表状态操作,如 清单 23 所示。

清单 23. 查看贷款申请表状态

  public com.example.www.onlinebanking.xsd. 
      ViewLoanApplicationStatusResponseDocument 
        ViewLoanApplicationStatus 
    (com.example.www.onlinebanking.xsd. 
     ViewLoanApplicationStatusDocument param4 ) 
      throws AxisFault{ 
 
    ViewLoanApplicationStatusDocument. 
      ViewLoanApplicationStatus req = 
      param4.getViewLoanApplicationStatus(); 
 
    ViewLoanApplicationStatusResponseDocument res = 
      ViewLoanApplicationStatusResponseDocument. 
        Factory.newInstance(); 
    ViewLoanApplicationStatusResponseDocument. 
      ViewLoanApplicationStatusResponse res2 = 
      res.addNewViewLoanApplicationStatusResponse(); 
 
    String username = matchUserNameToToken(req.getToken()); 
    if(username == null) throw new AxisFault("Invalid token!"); 
 
    ArrayList statuses = new ArrayList(); 
    try{ 
      String sql = "select * from loanapplications "+ 
             "where username=?"; 
      PreparedStatement statement = conn.prepareStatement(sql); 
      statement.setString(1, username); 
      ResultSet results = statement.executeQuery(); 
      while(results.next()){ 
        LoanApplicationStatus l = LoanApplicationStatus. 
                     Factory.newInstance(); 
        l.setLoanNumber(Integer.toString 
                (results.getInt("loannumber"))); 
        String val = results.getString("approved"); 
        if(val.equals("true")) 
          l.setApproved(true); 
        else 
          l.setApproved(false); 
        val = results.getString("denied"); 
        if(val.equals("true")) 
          l.setDenied(true); 
        else 
          l.setDenied(false); 
        statuses.add(l); 
      } 
    } catch(Exception e){ 
      e.printStackTrace(); 
    } 
    LoanApplicationStatus statusesA[] = 
      new LoanApplicationStatus[statuses.size()]; 
    for(int i = 0; i < statuses.size(); i++){ 
      statusesA[i] = (LoanApplicationStatus)statuses.get(i); 
    } 
 
    res2.setStatusArray(statusesA); 
    return res; 
  } 

1 2 3 4 5 6  下一页

Tags:Apache Geronimo Axis

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接