public void callCloseOnProtocol(XDIMEContextInternal context)
throws XDIMEException {
try {
VolantisProtocol protocol = getProtocol(context);
ResponseValidationAttributes validationAttributes = getValidationAttributes();
// Open script element
ScriptAttributes scriptAttributes = new ScriptAttributes();
scriptAttributes.setLanguage("JavaScript");
scriptAttributes.setType("text/javascript");
protocol.writeOpenScript(scriptAttributes);
StringWriter scriptWriter = new StringWriter();
// Write script content
scriptWriter.write("Widget.processValidatorResponse(");
boolean validationPassed = validationAttributes.getResult().equals("passed");
scriptWriter.write(validationPassed ? "true" : "false");
if (!validationPassed) {
// Write failure message (if not specified, write default message.