シナリオ: Web サービスを @Stateless Bean として作成し、ejb jar としてパッケージ化します。結果 - wsdl ファイルにアクセスできません。
目標: Web からアクセス可能な wsdl ファイルを含む ejb jar パッケージを使用して、@WebServices を @Stateless セッションとして使用したいと考えています。
ウェブサービス:
@Stateless
@WebService(serviceName = "ws.isp.SecurityService", wsdlLocation = "META-INF/wsdl/SecurityService.wsdl")
public class SecurityService{
@EJB
private Kerberos factory;
@EJB
private UsersServiceBean uService;
public SecurityService() {
}
@WebMethod
@WebResult(name = "SimpleResponse")
public SimpleResponse LogOut(
@WebParam(name = "sessionUUID", targetNamespace = "https://secure.co.ua/ws/")
String sessionUUID
) {
SimpleResponse resp = new SimpleResponse();
try{
factory.removeSession(sessionUUID);
resp.setError(WSErrorCodes.SUCCESS);
}catch (Exception e){
e.printStackTrace();
resp.setError(WSErrorCodes.UNRELOSVED_ERROR);
}
return resp;
}
@WebMethod
public MySession logIn(
@WebParam(name = "username", targetNamespace = "https://secure.co.ua/ws/")
String username,
@WebParam(name = "password", targetNamespace = "https://secure.co.ua/ws/")
String password){
MySession result = new MySession();
try {
UserSession us = factory.creatSession(uService.getUser(username, password).getId());
result.setSessionID(us.getSessionUUID().toString());
result.setError(WSErrorCodes.SUCCESS);
} catch (NullPointerException e){
e.printStackTrace();
result.setError(WSErrorCodes.UNRELOSVED_USER);
} catch (Exception e){
e.printStackTrace();
result.setError(WSErrorCodes.UNRELOSVED_ERROR);
}
return result;
}
}
この場合、私は得る
無効な wsdl リクエスト http://192.168.44.48:8181/ws.isp.SecurityService/SecurityService
wsdl にアクセスしようとすると、wsdlLocation の説明を使用しないと、空白のページが表示されます。
それ自体がうまく機能するWebサービス。
Q1: Web サービスの wsdl ファイルの場所を ejb jar でステートレスとして記述する規則は何ですか?
Q2: Maven のパッケージング中に wsdl ファイルを生成することは可能ですか?
Q3: @Stateless や @EJB などのアノテーションを持つ Web サービスの wsdl ファイルを生成する方法 (現在、これらのアノテーションをコメントすることによってのみ生成できます)
環境: mave 2、ejb 3.1、glassfish v3、jax-ws 2.x
ありがとうございました!