class SoapDocumentService extends AbstractService implements DocumentService {

	@Override
	public WSDocument[] getVersions(String sid, long docId) throws Exception {
		User user = validateSession(sid);
		DocumentDAO docDao = (DocumentDAO) Context.get().getBean(DocumentDAO.class);
		Document doc = docDao.findById(docId);
		if (doc == null)
			throw new Exception("unexisting document " + docId);

		checkReadEnable(user, doc.getFolder().getId());

		doc = docDao.findDocument(docId);
		checkPublished(user, doc);

		VersionDAO versDao = (VersionDAO) Context.get().getBean(VersionDAO.class);
		List<Version> versions = versDao.findByDocId(doc.getId());
		WSDocument[] wsVersions = new WSDocument[versions.size()];
		for (int i = 0; i < versions.size(); i++) {
			versDao.initialize(versions.get(i));
			wsVersions[i] = WSUtil.toWSDocument(versions.get(i));
			wsVersions[i].setComment(versions.get(i).getComment());
		}

		return wsVersions;
	}

}