@WebServices as @Stateless session bean in ejb jar
Posted
by kislo_metal
on Stack Overflow
See other posts from Stack Overflow
or by kislo_metal
Published on 2010-05-13T09:16:17Z
Indexed on
2010/05/23
10:20 UTC
Read the original article
Hit count: 322
Hi!
Scenario: Creating some web service as @Stateless bean, package it as ejb jar. Result - can`t access to wsdl file.
Goal: I want to use @WebServices as @Stateless session using ejb jar packaging with accessible wsdl file form web.
Web service:
@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;
}
}
In this case I getting
Invalid wsdl request http://192.168.44.48:8181/ws.isp.SecurityService/SecurityService
when I try to access to wsdl and if do not use description of wsdlLocation I getting blank page.
Web service as it self working good.
Q1: what is the rule of describing wsdl file location for web services as stateless in ejb jar.
Q2: is it possible to generate wsdl file during maven packaging ?
Q3: how to generate wsdl file for web service where we have such annotation as @Stateless and @EJB (currently I can generate it only by commenting those annotations)
environment: mave 2, ejb 3.1, glassfish v3, jax-ws 2.x
Thank you!
© Stack Overflow or respective owner