Request request = session.newAdhocQuery (queryString);
for (QName name : params.keySet()) {
XSString value = ValueFactory.newXSString (params.get(name));
XName xname = new XName(name.getNamespaceURI(), name.getLocalName());
XdmVariable myVariable = ValueFactory.newVariable (xname, value);
request.setVariable (myVariable);
}
ResultSequence rs = session.submitRequest (request);