Erro webservice nullPointerException - AxisFault

0 respostas
C

Olá gente,

eu to mexendo no webservice do projeto que participo, e como não tenho muita experiencia… :frowning:

assim,o q quero fazer é tratar erros de banco, tipo quando eu violo uma FK, etc… eu criei um metodo main dentro do webservice … chamei meu metodo e passei os parametros para dar um erro de " java.sql.SQLException: Foreign key constraint violation occurred …"

beleza, eu pego essa string com esse erro …

so que se eu crio um cliente e acesso esse mesmo metodo por fora do webservice com os mesmos parametros, para gerar a mesma exception, me da um NUllPointer Exception… AxisFault…
eu nao entendo o pq disso… pq é diferente quando chamo o metodo de dentro do webservice

public static String autorizarpin(String pin, int usuario, String ip, 
         int nr_cliente_en_shv, int cd_distribuidora, String ds_return, 
         String user, String password, int server) throws SQLException, Exception{ 
      String retorno = null; 
       

      // CRIA A CONEXACAO COM O BANCO DE DADOS 
      Connection connection = ConnectionFactory.getConnection(user, password, 
            server); 

      Statement stmt = connection.createStatement(); 

      CallableStatement cs; 

      // Call a procedure with more than one IN/OUT parameter 
      cs = connection.prepareCall("{call sp_vg_autoriza_pin(?,?,?,?,?,?)}"); 

      // Register the type of the OUT parameter 
      cs.registerOutParameter(6, Types.VARCHAR); 

      // Set the value for the IN parameter 
      cs.setString(1, pin); 

      // Set the value for the IN parameter 
      cs.setInt(2, usuario); 

      // Set the value for the IN parameter 
      cs.setString(3, ip); 

      // Set the value for the IN parameter 
      cs.setInt(4, nr_cliente_en_shv); 

      // Set the value for the IN parameter 
      cs.setInt(5, cd_distribuidora);    

      try { 
         // Execute the stored procedure and retrieve the IN/OUT value 
         cs.execute(); 
         retorno = cs.getString(6);       
         stmt.close(); 
      }catch (SQLException e) { 
         retorno = e.getNextException().getMessage();             
          
         return retorno;          
      }       
      return retorno; 
   }

alguem pode me dar um mão!?

Agradeço desde já…

Criado 8 de agosto de 2006
Respostas 0
Participantes 1