InDesign Server restarts when running scripts via SOAP Calls
Hello. I have been working with InDesign Server. I was using Load Balance Queue for commucation between our apps and IDS. Now, we are shifting to SOAP calls to interact with IDS.
I am able to establish the connection, send my params and start running my initial script.
Now, the issue comes when running my scripts. For some reason, the scripts make the server to restart, and I can't find a way to do a full execution.
If the script is simple (just some alerts, or placing a document) it works OK, but when I try do some kind of manipulation, the instance reboots. This is problematic because I can't find a way to fully execute all the processes that were working fine with LBQ approach.
Adding an example. Whenever I run the ApplyStyles.jsx script the instance reboots, making my workflow to not complete. (This happens with many scripts, different templates and word documents)
//Recovering params
var word = app.scriptArgs.get("wordFile");
var template = app.scriptArgs.get("template");
var bookId = app.scriptArgs.get("bookId");
var country = app.scriptArgs.get("country");
alert("wf: " + app.scriptArgs.get('wordFile'));
alert("bookId: " + app.scriptArgs.get('bookId'));
alert("templateFile : " + app.scriptArgs.get('templateFile'));
alert("country: " + app.scriptArgs.get('country'));
args = [word, template, bookId, country];
app.doScript("ApplyStyles.jsx",ScriptLanguage.javascript, args);
//ApplyStyles.jsx
try {
AplicarEstilo(); //THis is for example a script that "fails" and restarts the service
} catch (e){
alert("error");
}
function AplicarEstilo() {
var doc = app.documents[0];
for (var i = 0; i < doc.paragraphStyles.length; i++) {
try {
var pStyle = doc.paragraphStyles[i];
findChange("","", pStyle, pStyle, "", "");
} catch (e) {}
}
}
function findChange(findWhat, changeTo, findStyle, changeStyle, findChrStyle, changeChrStyle) {
var doc = app.documents[0];
try {
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
if (findWhat) app.findTextPreferences.findWhat = findWhat;
if (changeTo) app.changeTextPreferences.changeTo = changeTo;
if (findStyle) app.findTextPreferences.appliedParagraphStyle = findStyle;
if (changeStyle) app.changeTextPreferences.appliedParagraphStyle = changeStyle;
if (findChrStyle) app.findTextPreferences.appliedCharacterStyle = findChrStyle;
if (changeChrStyle) app.changeTextPreferences.appliedCharacterStyle = changeChrStyle;
doc.changeText();
} catch (e) {}
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
}
The event viewer log:
THe message when the instance restart:
[server] Initializing [5740] [8090]
[server] Loading the application [5740] [8090]
[server] Scanning for plug-ins [5740] [8090]
[server] Registering 114 plug-ins [5740] [8090]
[server] Completing Object Model [5740] [8090]
[server] Saving Object Model [5740] [8090]
[server] Initializing plug-ins [5740] [8090]
[server] Calling Early Initializers [5740] [8090]
[server] Starting up Service Registry [5740] [8090]
[server] Executing startup services [5740] [8090]
[server] Using configuration configuration_8090 [5740] [8090]
[server] Initializing Application [5740] [8090]
[server] Completing Initialization [5740] [8090]
[server] Calling Late Initializers [5740] [8090]
[server] Image previews are off [5740] [8090]
[server] Server Running [5740] [8090]
[javascript] Executing File: C:\Program Files\Adobe\Adobe InDesign CC Server 2019\Scripts\startup scripts\ConnectInstancesToESTK.js [5740] [8090]
[javascript] Executing File: C:\Program Files\Adobe\Adobe InDesign CC Server 2019\Scripts\converturltohyperlink\startup scripts\ConvertURLToHyperlinkMenuItemLoader.jsx [5740] [8090]
[soap] Servicing SOAP requests on port 8090 [5740] [8090]
How can I overcome this? I'm quite lost because almost anything I do with scripst just fails. And these scripts worked both on InDesign Desktop (with their respective modifications), and worked in the same InDesign Server Instance, but just with a different way of calling them (LQB = OK, SOAP Call = Wrong). The params are the same, the server is the same, the same machine, no changes except removing LBQ.
