use of javax.jws.WebMethod in project openmeetings by apache.
the class RoomWebService method close.
/**
* Method to remotely close rooms. If a room is closed all users
* inside the room and all users that try to enter it will be redirected to
* the redirectURL that is defined in the Room-Object.
*
* Returns positive value if authentication was successful.
*
* @param sid
* The SID of the User. This SID must be marked as Loggedin
* @param id
* the room id
*
* @return - 1 in case of success, -2 otherwise
*/
@WebMethod
@GET
@Path("/close/{id}")
public ServiceResult close(@WebParam(name = "sid") @QueryParam("sid") String sid, @WebParam(name = "id") @PathParam("id") long id) {
return performCall(sid, User.Right.Soap, sd -> {
Long userId = sd.getUserId();
Room room = roomDao.get(id);
room.setClosed(true);
roomDao.update(room, userId);
WebSocketHelper.sendRoom(new RoomMessage(room.getId(), userDao.get(userId), RoomMessage.Type.roomClosed));
return new ServiceResult("Closed", Type.SUCCESS);
});
}
use of javax.jws.WebMethod in project openmeetings by apache.
the class UserWebService method login.
/**
* @param user - login or email of Openmeetings user with admin or SOAP-rights
* @param pass - password
*
* @return - {@link ServiceResult} with error code or SID and userId
*/
@WebMethod
@GET
@Path("/login")
public ServiceResult login(@WebParam(name = "user") @QueryParam("user") String user, @WebParam(name = "pass") @QueryParam("pass") String pass) {
try {
log.debug("Login user");
User u = userDao.login(user, pass);
if (u == null) {
return new ServiceResult("error.bad.credentials", Type.ERROR);
}
Sessiondata sd = sessionDao.create(u.getId(), u.getLanguageId());
log.debug("Login user: {}", u.getId());
return new ServiceResult(sd.getSessionId(), Type.SUCCESS);
} catch (OmException oe) {
return oe.getKey() == null ? UNKNOWN : new ServiceResult(oe.getKey(), Type.ERROR);
} catch (Exception err) {
log.error("[login]", err);
return UNKNOWN;
}
}
use of javax.jws.WebMethod in project openmeetings by apache.
the class UserWebService method getRoomHash.
/**
* Description: sets the SessionObject for a certain SID, after setting this
* Session-Object you can use the SID + a RoomId to enter any Room. ...
* Session-Hashs are deleted 15 minutes after the creation if not used.
*
* @param sid
* The SID from getSession
* @param user
* user details to set
* @param options
* room options to set
*
* @return - secure hash or error code
*/
@WebMethod
@POST
@Path("/hash")
public ServiceResult getRoomHash(@WebParam(name = "sid") @QueryParam("sid") String sid, @WebParam(name = "user") @FormParam("user") ExternalUserDTO user, @WebParam(name = "options") @FormParam("options") RoomOptionsDTO options) {
return performCall(sid, User.Right.Soap, sd -> {
RemoteSessionObject remoteSessionObject = new RemoteSessionObject(user.getLogin(), user.getFirstname(), user.getLastname(), user.getProfilePictureUrl(), user.getEmail(), user.getExternalId(), user.getExternalType());
log.debug(remoteSessionObject.toString());
String xmlString = remoteSessionObject.toXml();
log.debug("xmlString " + xmlString);
String hash = soapDao.addSOAPLogin(sid, options.getRoomId(), options.isModerator(), options.isShowAudioVideoTest(), options.isAllowSameURLMultipleTimes(), options.getRecordingId(), options.isAllowRecording());
if (hash != null) {
if (options.isAllowSameURLMultipleTimes()) {
sd.setPermanent(true);
}
sd.setXml(xmlString);
sessionDao.update(sd);
return new ServiceResult(hash, Type.SUCCESS);
}
return UNKNOWN;
});
}
use of javax.jws.WebMethod in project quickstarts by jboss-switchyard.
the class AirportService method order.
/**
* Order flight ticket defined by fltid for a user identified by name.
* @param name username
* @param fltid flight identifier
*/
@WebMethod
public void order(@WebParam(name = "name") String name, @WebParam(name = "fltid") String fltid) {
log.info("AirportService:order");
UserBusinessActivity uba = UserBusinessActivity.getUserBusinessActivity();
if (uba != null) {
log.info("Transaction ID = " + uba.toString());
if (uba.toString().compareTo("Unknown") == 0) {
log.info("JBoss AS is badly configured. (Enable XTS)");
return;
}
// Create order participant (fly ticket)
OrderParticipant op = new OrderParticipant(uba.toString(), fltid);
try {
// Enlist order participant to the transaction
BusinessActivityManager.getBusinessActivityManager().enlistForBusinessAgreementWithCoordinatorCompletion(op, "org.switchyard.quickstarts.bpel.xts.wsba.ws:AirportService:" + name + ":" + fltid);
} catch (Exception e) {
log.log(Level.SEVERE, e.getMessage());
e.printStackTrace();
}
}
}
use of javax.jws.WebMethod in project quickstarts by jboss-switchyard.
the class AirportService method getFLTID.
/**
* Get flight identifier for the parameters.
* @param from place (city)
* @param to place (city)
* @param date of flight
* @return format [from/to/month/day]
*/
@WebMethod
@WebResult(name = "fltid")
public String getFLTID(@WebParam(name = "from") String from, @WebParam(name = "to") String to, @WebParam(name = "date") Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return from + "/" + to + "/" + String.valueOf(c.get(Calendar.MONTH) + 1) + "/" + String.valueOf(c.get(Calendar.DAY_OF_MONTH));
}
Aggregations