public String getInvitationHash(final String username,
final String password, final String displayedName, final String RoomID)
throws Exception
{
final SOAPMessage soapMessage = getSoapMessage();
final SOAPBody soapBody = soapMessage.getSOAPBody();
final SOAPElement requestElement =
soapBody.addChildElement("getInvitationHash", NAMESPACE_PREFIX);
logger.info(username + ":" + displayedName);
String sid = getSID(username, password);
String error_id = null;
try
{
error_id = login(sid, username, password);
}
catch (Exception e)
{
logger.info(e.getMessage());
}
if (!error_id.equals("1"))
{
logger.info("User cant login!");
return null;
}
String room_id = RoomID;
if ((room_id == null) || (room_id.trim().isEmpty()))
room_id = getAvailableRooms(sid);
if (room_id == null)
{
logger.error("No rooms available in openmeetings");
return null;
} else
{
room_id = room_id.trim();
logger.info("Found openmeetings conference room ID " + room_id);
}
requestElement.addChildElement("SID", NAMESPACE_PREFIX)
.addTextNode(sid);
requestElement.addChildElement("username", NAMESPACE_PREFIX)
.addTextNode(displayedName);
requestElement.addChildElement("room_id", NAMESPACE_PREFIX)
.addTextNode(room_id);
soapMessage.saveChanges();
final SOAPBody soapResponseBody = getSOAPResponseBody(soapMessage, getJabberServiceUrl());
final String textContent = soapResponseBody.getFirstChild().getTextContent();
logger.info("INVITATION RESPONSE = " + textContent);
return textContent;
}