16 Replies Latest reply on Jul 11, 2013 9:38 PM by Dinesh Amarasekara

    Cannot start multiple sessions in CS6

    martin_rohart Level 1

      Hi,

       

      I am trying the new multi threads feature from IDS CS6 (contra using multiple instances).

      But I seem unable to start several sessions from the same client.

       

      I do have a machine with 4 core processors (even a multi-instances license), so I should be able to start 4 sessions in parallel.

      I start a single IDS instance with SOAP on port 12345.

       

      Using SoapUI:

      - I make a call to "BeginSession": it returns successfully (for example sessionID 2)

      - If I make a second call to "BeginSession", it returns a SOAP fault telling me that the call is already part of a session...

      - If I make a third call, it returns successfully (sessionID 3)

      - And so on, every second call will fail

      - Furthermore, it seems that the failing call triggers the end of the previous session, because I am unable to call EndSession after that. It would explain why every second call will succeed.

      - if I call BeginSession, then EndSession, BeginSession, EndSession... it works without problem.

       

      I also tried using two different clients running from two different computers, against the same InDesign Server:

      - Call BeginSession from client 1: success

      - Call BeginSession from client 2: success

      - Call EndSession from client 1: success

      - Call EndSession from client 2: success

      - If a client tries to open a two sessions in a row (without callind EndSession on the first one), it fails as I described in the first case above.

      - If a client tries to close the session opened by the other client, I get a SOAP fault too.

       

       

      So in conclusion, are we limited to open only one session per client???

      Does IDS CS6 retain information on which client opened which session, and then ensure to have a maximum of one session per client?

       

      This is a big problem, as I want a unique controller opening the sessions and running all server script calls... It should definitely need to open several sessions in parallel, else there would be no point in using multi-sessions instead of multi-instances.

       

      Thanks for your help,

      Martin

        • 1. Re: Cannot start multiple sessions in CS6
          Bart Devos Level 1

          We can also reproduce what you say.

          We opened a support case @ adobe, but have no solution yet

           

          For the moment, the session implementation is useless.

           

          I tried this on Adobe Indesign Server CS6 Win and Mac.

          • 2. Re: Cannot start multiple sessions in CS6
            martin_rohart Level 1

            I also opened a support case two weeks ago and am awaiting an answer there.

            • 3. Re: Cannot start multiple sessions in CS6
              emerasoft.srl Level 1

              We opened a support case too!!

              • 4. Re: Cannot start multiple sessions in CS6
                martin_rohart Level 1

                I got an answer from Adobe support, with a modified sample-client java code demonstrating how to achieve that. I guess the key difference in their sample was that they were using Axis1 and not Axis2. They were also manually adding the session id in a SOAP header.

                 

                I tried that in my own application and got it working, yet it was annoying to have to downgrade from Axis2 to Axis1.

                 

                Maybe there is a way to configure Axis2 correctly, I didn't manage it yet. It seems that in a lower layer, maybe at the transport layer, Axis2 can only support one call at a time to the same URL endpoint, even if I create different stubs.

                It must be the same implementation issue in SoapUI.

                 

                If anybody succeed implementing this in anything else than Axis1, let me know!

                 

                (And if some of you are interested, I wrote a little analysis of the multi-sessions feature after getting it working: http://www.ctrlpublishing.com/en/home/blog/102-ids-cs6-multiple-instances-vs-multiple-sess ions. Let me hear your thoughts.)

                • 5. Re: Cannot start multiple sessions in CS6
                  emerasoft.srl Level 1

                  Martin,

                   

                  I don't think it's a Axis1 related solution; we just finished a test by generating a Java client with Axis2 and it works as expected. The only thing to be done to have everything working is to have the "service" object to be instantiated every time you need to call a "BeginSession" method; the question seems you can only have a BeginSession call inside a "service" object.

                   

                  But it works with Axis as well.

                   

                  Best,

                  Luca

                  • 6. Re: Cannot start multiple sessions in CS6
                    martin_rohart Level 1

                    Ok thanks.

                     

                    Isn't it an expensive operation to instantiate a service each time?

                    • 7. Re: Cannot start multiple sessions in CS6
                      emerasoft.srl Level 1

                      Hello Martin,

                       

                      what do you mean by expensive? Isn't it true the same is done by the example furnished by Adobe even if they are using Axis1?

                       

                      Best,

                      Luca

                      • 8. Re: Cannot start multiple sessions in CS6
                        martin_rohart Level 1

                        I meant time expensive to recreate the Axis service for each session start.

                        In my case with Axis1, one service instance is created at bootstrap per "parallel session" I will need, for example I'll create 4 services on a 4 cores machines, but then I'll simply create new sessions with the same service, without needing to destroy and recreate all Axis objects.

                         

                        But maybe this doesn't have a big impact on the execution time.

                        • 9. Re: Cannot start multiple sessions in CS6
                          santino cusimano

                          Hi,

                           

                          I'm not able to use session with ID server.

                          I use php and SOAP.

                           

                          I call BeginSession, RunScript and EndSession, but

                          it seems to me that IDS does not accept any SOAP request until EndSession is executed.

                          The script runs for about 4 minutes so we want to exec more scripts in parallel.

                           

                          I try to copy the SOAP xml and send it with telnet, but it is the same.

                           

                          If we launch IDS on 4 ports (12345, 12346, ...) we can execute 1 script on each port.

                           

                          Is there a tutorial about sessions with IDS?

                          • 10. Re: Cannot start multiple sessions in CS6
                            Dinesh Amarasekara

                            Hi Martin,

                             

                            Can you pls post the code of sample-client.java which you got from Adobe support. I tried with the axis1 to run multiple sessions as you explained but could not get the expected results.

                             

                            Best Regards,

                            Dinesh

                            • 12. Re: Cannot start multiple sessions in CS6
                              Dinesh Amarasekara Level 1

                              Thank you very much Martin.

                               

                              Best Regards,

                              Dinesh.

                              • 13. Re: Cannot start multiple sessions in CS6
                                styn88

                                Hi,

                                 

                                I have a related question, I don't think i should start a new thread for it.

                                I have expanded the C sharp SOAP example to start a few scripts simultaneously. But it appears like it isn't working.

                                 

                                My first change was to start every script from a different thread

                                 

                                                    Parallel.ForEach<Script>(scripts, script =>

                                                        {

                                                            Console.WriteLine("Starting script '" + script.ToString() + "' on thread: " + Thread.CurrentThread.ManagedThreadId.ToString());

                                                            script.Run(proxy);

                                                        });

                                This starts all scripts but it seems that they don't get executed at the same time.

                                 

                                I then changed the RunScript in script.cs to RunScriptAsync (proxy.RunScriptAsync(mParams);)

                                this however doesn't seem to actually execute the scripts.

                                 

                                Can anyone point me in the right direction?

                                • 14. Re: Cannot start multiple sessions in CS6
                                  Dinesh Amarasekara Level 1

                                  Hi Martin,

                                   

                                  I just thought to get some input from you regarding the following matter. I tried to execute the sample code and it gave me the following error. I have used the axis 1 also.

                                   

                                  Java Console Output

                                   

                                  Session A: Creating New Doc 1

                                  begin session : 2

                                  Using session : 2

                                  Script success

                                  : Script reported no errors

                                  Session B: Creating New Doc 2

                                  begin session : 3

                                  Using session : 3

                                  Script success

                                  : Script reported no errors

                                  Session A: Add Text Frame To Doc 1

                                  Using session : 2

                                  Session B: Add Text Frame To Doc 2

                                  ; nested exception is:

                                            org.w3c.dom.DOMException: WRONG_DOCUMENT_ERR: A node is used in a different document than the one that created it.

                                  Using session : 3

                                  Script success

                                  : Script reported no errors

                                  Session A: Save and Close Doc 1

                                  Using session : 2

                                  ; nested exception is:

                                            org.w3c.dom.DOMException: WRONG_DOCUMENT_ERR: A node is used in a different document than the one that created it.

                                  Session B: Save and Close Doc 2

                                  Using session : 3

                                  Script success

                                  : Script reported no errors

                                   

                                  InDesign Server Output

                                   

                                  Mon Jul  8 14:34:48 2013 INFO[javascript] Executing Script
                                  Mon Jul  8 14:34:48 2013 INFO[server] Creating New Doc 1
                                  Mon Jul  8 14:37:53 2013 INFO[javascript] Executing Script
                                  Mon Jul  8 14:37:53 2013 INFO[server] Creating New Doc 2

                                  SOAP 1.1 fault: SOAP-ENV:Server [no subcode]

                                  "Client opened session with ID 1 but the SOAP header targets session with ID 2!"

                                  Detail: None

                                  Mon Jul  8 14:37:54 2013 INFO[javascript] Executing Script
                                  Mon Jul  8 14:37:54 2013 INFO[server] Add Text Frame To Doc 2

                                  SOAP 1.1 fault: SOAP-ENV:Server [no subcode]

                                  "Client opened session with ID 1 but the SOAP header targets session with ID 2!"

                                  Detail: None

                                  Mon Jul  8 14:37:54 2013 INFO[javascript] Executing Script
                                  Mon Jul  8 14:37:54 2013 INFO[server] Save and Close Doc 2

                                   

                                  Do you have any clue about this, any input is highly appreciated.

                                   

                                  Thanks And Best Regards,

                                  Dinesh.

                                  • 15. Re: Cannot start multiple sessions in CS6
                                    martin_rohart Level 1

                                    Hi Dinesh,

                                     

                                    I must admit I didn't tried the example, I just got inspiration from the SampleClient.java code in order to write my own mutlithread code...

                                     

                                    But after a quick look, it seems that the problem is because a script tries to refer to a document created in another thread.

                                    I think the problem is because all scripts in the example (addtextFrame1, addtextFrame2, saveclose1, saveclose2) refer to app.documents[0].

                                    But app.documents[0] is created in thread 1...

                                    Try to change to app.documents[1] for the scripts addtextFrame2 and saveclose2.

                                     

                                    In general, it is your responsibility to verify that you access the proper document, I would advise sending the document name as a script argument to be sure, and never use app.documents[x]

                                     

                                    I hope that will solve your problem,

                                    /Martin

                                    • 16. Re: Cannot start multiple sessions in CS6
                                      Dinesh Amarasekara Level 1

                                      Hi Martin,

                                       

                                      Thanks for the reply and explanation. However I am still unable to run this. It created the session 2 but it took about 3-5 min to create the session 3. I am thinking why it takes such a time to create the session 3. Any hint for this ?

                                       

                                      Thanks for your help too.

                                       

                                      Best Regards,

                                      Dinesh.