2013-01-08 3 views
0

데이터베이스에서 사용자 정보를 얻기 위해 웹 서비스를 작업하고 있습니다. 나는 예외를 던지고 처리하는 것을 알지 못한다.soap 기반 웹 서비스에서 예외 메시지가 발생했습니다.

@WebMethod(operationName ="My operataion") 
    @WebResult(name="Some Type") 
    public UserDetails getUserInfo(@WebParam(name="mailID")int mailID) throws SQLException{ 
     UserDetails user= new UserDetails(); 
     User umanager= new User(); 
     user= umanager.getUserInfo(custID); 
     return user; 


    } 

나는 클라이언트 측의 예외를 잡으려면 내가 "Unable to connect to Database" 같은 오류 메시지를 수정하려는.

아무에게도이를 수행하고 맞춤 예외를 보내는 방법을 알릴 수 있습니까?

미리 감사드립니다. 당신이

public UserDetails getUserInfo(@WebParam(name="mailID")int mailID) throws SQLException{ 
    // if your connection not established then 
    throw new SQLException("Unable to connect to Database"); 
} 

답변

1

은 다음 튜토리얼을 살펴보십시오.
+0

처럼 쓸 수있는 함수에 대한

  1. throwing exceptions

응답 해 주셔서 감사합니다 : – Patan

+0

환영합니다 :) –

관련 문제