1 Reply Latest reply on Jan 21, 2010 9:33 AM by m.p.programmer

    return value from Indesign SErver CS4 using SOAP

    Discipline4ever666

      does anybody have a complete example on how to send a script to indesign server and get a response using SOAP in ASP.NET

       

      I've already read the post http://forums.adobe.com/message/2255207#2255207 and all links within this post, but I can't seem to get it working.

       

      I'm running on a widows 7 ultimate x64with a Q6600 processor and 4Gb of memory (so I meet the system requrements )

       

      I can send a script to the server, butI always get a response of null. I use the folloing script to test this function(javascript)

       

         function main(){return 'test';}main();
      /*function main() {
      var doc = app.open(File('C:/Users/Wesley/Desktop/myTestDocument.indd'));
      doc = doStuff(doc);
      doc.exportFile(ExportFormat.PDF_TYPE,new File('C:/Users/Wesley/Desktop/test.pdf'));
      var pages=doc.pages.length;
      pages=app.configuration;
      pages=app.scriptPreferences.version;
      doc.close();
      return pages;
      }

      function doStuff(doc) {
      // do some stuff
      return doc;
      }

      main(); // the return statement in this function actually gets returned*/

       

      when I run this code in ExtendScript CS4, the script runs fine, but I found out that ES4 sends the script through COM.

       

      Are there any know issues with IndesignServer x64 or it's related IndesignServerService?

       

      all help is welcome

       

      kidn regards,

       

      Wesley

        • 1. Re: return value from Indesign SErver CS4 using SOAP
          m.p.programmer

           

           

           

          I forget where I read it in the documentation, but somewhere it said that the return value from a SOAP call will be the last variable which is referenced.  It struck me as very strange, as it would seem more reasonable/intuitive to have the value come from a “return” statement.  At any rate, here is a very basic example in C#:

           

          Contents of basic.jsx:

           

          var verybasic = "Cs4 server has returned a value";

          verybasic;

           

          C# method call:

           

          //setup a new RunScript call

          InDesignServer.Service indsRs = new InDesignServer.Service();

          InDesignServer.RunScriptParameters myParams = new InDesignServer.RunScriptParameters();

           

          //set the general attributes

          myParams.scriptLanguage = "javascript";

          myParams.scriptFile = @"D:\CS4Scripts\Conversion\basic.jsx";

           

          string errorString = "";

          InDesignServer.Data scriptResults = null;

           

          //Make the call

          int rsRet = indsRs.RunScript(myParams, out errorString, out scriptResults);

          if (rsRet != 0)

          {

                      throw new Exception("Error with InDesign Server Script");

          }

          else

          {

                      //you can replace this with an asp.net specific call like Response.Write() or whatever else

                    // and you should see the text "Cs4 server has returned a value" displayed

                      MessageBox.Show(scriptResults.data.ToString());

          }