12 Replies Latest reply on Dec 5, 2008 7:39 AM by (fivan79)

    SOAP Returns from IDS

      Is anybody getting any type of return from IDS through and [java] axis interface? I can send a request and it is executed but I get no return from IDS?
        • 1. Re: SOAP Returns from IDS
          You should be getting a RunScriptResult in the returned XML packet.  Something like...

             words in story = 3

          Are you not seeing this (with a packet sniffer) or is your axis client's deserializer simply not being called?  - or are you trying to return something specific, but getting something else?  (IDServer packages up, as the return data, the result of the last call in your javascript.)
          • 2. Re: SOAP Returns from IDS
            Level 1
            This is what I'm getting:<br /><br /><?xml version="1.0".encoding="UTF-8"?><br /><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:IDSP="http://ns.adobe.com/InDesign/soap/"><br />     <SOAP-ENV:Body><br />          <IDSP:RunScriptResult><br />               <errorNumber><br />                    0<br />               </errorNumber><br />               <scriptResult><br />               </scriptResult><br />          </IDSP:RunScriptResult><br />     </SOAP-ENV:Body><br /></SOAP-ENV:Envelope><br /><br />I would like to get actual data returned. On the other InDesign forum it was stated that IDS would return the last command in the script. however I have not seen anything other than the error number returned.
            • 3. Re: SOAP Returns from IDS
              Level 1
              There is a 'loophole' in the way IDS handles javascript that you can take advantage of if you want to return something specific (and relatively uncomplicated). The 'app' object defines a method called 'consoleout' for displaying messages in the console. If you instead call this as if it were a property the string passed to it will be returned to your soap client in the 'scriptResult' tag. For example...

              app.consoleout = "words in story = "+theCount;

              .. will return the result I show above.
              • 4. Re: SOAP Returns from IDS
                Level 1
                PS. the call of app.consoleout needs to be the last line in your javascript.
                • 5. Re: SOAP Returns from IDS
                  Level 1
                  After making a bad js file I realize that it's my axis that for some reason is either not deserializing or receiving the response IDS is sending stuff back but I can't see it.
                  • 6. Re: SOAP Returns from IDS
                    For some reason, app.consoleout didn't work for me but I figured out an alternative.

                    Wrap the code in a function and have the function return a value. Then call that function. Here's an example.

                    function main()
                    app.consoleout("SOAP test started!");
                    app.consoleout("SOAP test finished!");
                    return "MY-RETURN-VALUE";

                    You should see, "MY-RETURN-VALUE" in scriptResult.data.

                    Good luck,
                    Sunny Judo
                    Silicon Publishing
                    • 7. Re: SOAP Returns from IDS
                      Hi folks,

                      we have here exactly the problem, that tom described. the return value arrives correctly on the network interface (checked with a packet sniffer) within the following soap message:

                      <data xsi:type="xsd:string">-262</data>

                      but the problem is now, that this value can't be read from the java application. if i debug the code, i receive the errorNumber but the scriptResult --> data is alway NULL?

                      does anybody have an idea?

                      best wishes
                      • 8. Re: SOAP Returns from IDS
                        There is a sample client in the InDesign CS3 Server SDK that demonstrates how to interact with InDesign Server through SOAP via Java, using Apache Axis 1.2.1. It's in the samples/sampleclient-java-soap folder.

                        Basically, Axis is used to generate the SOAP wrapper. One of the classes it creates is DataHolder. When runScript returns, the DataHolder object will hold the return value which can be accessed from the "value" field: myDataHolder.value.getData()

                        To note however, your JavaScript will only return a value if that value is specified in the last executed line in the script. A couple examples:

                        * As above, return a value from the main method, and make sure main is the last function you call:

                        function main()
                        return "MY-RETURN-VALUE";

                        * Access the return value in the last statement in the script:

                        var theStrokeWeight = myRectangle.strokeWeight;
                        // ... do more stuff ...

                        Susan Doan
                        • 9. Re: SOAP Returns from IDS
                          I Have Prepared a Client Which Attaches & sends XML file To Web Service,
                          I Got Exception:exception occuredjava.io.FileNotFoundException:
                          Wld U Pls Help me To Solve This Error.
                          • 10. Re: SOAP Returns from IDS
                            Hi All,

                            I have some problem reading response from IDS.
                            I use Flex 3.0 and actionscript.

                            I run a js and it works correctly.
                            The script ends with app.consoleout command and I can see the result in the terminal but I can not read the response in "scriptResult.data".
                            Flex debugger tell me "data" is not defined.

                            I try to read the response from RunScriptResponse, from scriptResult and also from event.result but without success.

                            Is it possible that the problem is in the WSDL file?

                            Can you help me?
                            • 11. Re: SOAP Returns from IDS
                              Level 1
                              Change your javascript so the last line returns the data you want to get back. app.consoleout() won't do it. This will work:

                              var myReturnData = "hello there";
                              // ... more stuff here

                              • 12. Re: SOAP Returns from IDS
                                Level 1
                                Hi, SusanDoan

                                Is it possible to read from the terminal also during the execution of a script, or only at the end?

                                I would like to trace the progress of my scripts and show a progress bar.