}
public VariableInfoDocument setVariable(final String scopeId, final String varName, final XmlObject value) throws ManagementException {
VariableInfoDocument ret = VariableInfoDocument.Factory.newInstance();
final TVariableInfo vinf = ret.addNewVariableInfo();
final TVariableRef sref = vinf.addNewSelf();
dbexec(new BpelDatabase.Callable<Object>() {
public Object run(BpelDAOConnection session) throws Exception {
ScopeDAO scope = session.getScope(new Long(scopeId));
if (scope == null) {
throw new InvalidRequestException("ScopeNotFound:" + scopeId);
}
sref.setSiid(scopeId);
sref.setIid(scope.getProcessInstance().getInstanceId().toString());
sref.setName(varName);
XmlDataDAO var = scope.getVariable(varName);
if (var == null) {
throw new InvalidRequestException("VarNotFound:" + varName);
}