Skip to main content
Known Participant
February 18, 2022
Question

InDesign Server restarts when running scripts via SOAP Calls

  • February 18, 2022
  • 1 reply
  • 1313 views

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.

This topic has been closed for replies.

1 reply

SumitKumar
Inspiring
February 19, 2022

Hi @DiegoNicolas22255510o71u,

 

As I understand you are finding paragraph with para style and appling same style.

So, at which line soap reboot IDS instance?

 

-Sumit
Known Participant
February 24, 2022

Hello @SumitKumar , Yes. The script just does that. I also have others that also fails.

 

The server reboots after:

if (findStyle) app.findTextPreferences.appliedParagraphStyle = findStyle;

 

The strage part is that this script wasn't failing when I run it via LBQ (and I can run it with InDesign Desktop with no problems). 

It this helps, we first place a Word document on a template with the script  (this works ok).

 

Any help is appreciated, thanks!

Thanks!

Known Participant
July 11, 2022

Hi @user2690963 ,

 

Kindly save the document between word doc placement and findText.

 

Regards,

Sumit


Hello @SumitKumar ,

Sorry for my late response, I am reviewing this issue again.

I have checked saving the document prior to the search, but still the same problem.

 

function findChange(findWhat, changeTo, findStyle, changeStyle, findChrStyle, changeChrStyle) {
    var doc = app.documents[0];    
    doc = doc.save(File("preFindChange.indd"));
    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;
}