Hi and thanks you for your help.
My code is the following.
<%@ page import="xtk:server/jsspcontext.js,xtk:dashboard.js"%>
<%@ page import="xtk:common.js,nms:operation.js,xtk:server/jssphelper.js,xtk:shared/nl.js"%>
<%
// Headers to disable cache
response.setContentType("text/html;charset=utf-8");
logon("TOTO", "TOTO");
var newContext = logonEscalation('webapp'); // i had add this since your answer
var contacts = JSON.parse(request.getBodyAsString());
var vCnx = application.getConnection();
try{
vCnx.begin();// Début Transaction
// Insertion des recipients
createRecipients(contacts.List,dateInsertion);
createFilter(contacts.projet,dateInsertion); // here i have created an error to test my rollback
...
// End
vCnx.commit();
}catch(e){
vCnx.rollback();
}finally {
vCnx.dispose();
}
function createRecipients(recipientArray,dateInsertion){
var doc = new DOMDocument("recipient-collection");
var root = doc.root;
root.setAttribute("_operation","insertOrUpdate");
root.setAttribute("xtkschema","nms:recipient");
for(var i = 0 ; i < recipientArray.length;i++){
var insert = doc.createElement("recipient");
insert.setAttribute("lastName",recipientArray[i].lastName);
insert.setAttribute("firstName",recipientArray[i].firstName);
insert.setAttribute("salutation",recipientArray[i].salutation);
insert.setAttribute("email", unescape(recipientArray[i].email));
insert.setAttribute("address_1",recipientArray[i].address1);
...
root.appendChild(insert);
}
xtk.session.WriteCollection(doc.root);
}
function CreateAssocProfileFilterGroup(profileId,filterId,groupId,nbClients){
try{
var doc = new DOMDocument("profile_filter_association");
var root = doc.root;
root.setAttribute("_operation","insert");
root.setAttribute("xtkschema","wal:XOXO");
root.setAttribute("queryFilter-id",98085980); // FORCED ERROR HERE
root.setAttribute("profile-id",97290529);
root.setAttribute("idGroup",groupId);
root.setAttribute("nbrClients",nbClients);
xtk.session.Write(doc.root);
}catch(e){
throw e;
}
}