2 Replies Latest reply on May 6, 2009 1:28 PM by Alec Wadey

    Calling InDesign from .NET

    Alec Wadey Level 1

      HI all,


      We have a .NET application calling some InDesign scripts.  The application works fine across 4 out of 5 servers (and even works on the fifth server in some situations).  Anyway, sometimes we get an error "System.InvalidCastException: Unable to cast object of type 'RunScriptParameters' to type 'RunScriptParameters'. at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerialization".  This is occurring in a C# class auto generated from the WSDL.  The actual script never gets called in this instance.


      Has anyone come across this before and managed to resolve it?


      Thanks in advance.



        • 1. Re: Calling InDesign from .NET
          Olav Martin Kvern Level 3

          Hi Alec,


          I don't know of any object/method/property in the InDesign scripting object model called "'RunScriptParameters", so I'm guessing that the problem lies outside InDesign. Apart from that, I don't have a guess. Typically, .NET users connect to InDesign's object model via COM interfaces--I'm not sure where a WSDL fits into the picture?





          • 2. Re: Calling InDesign from .NET
            Alec Wadey Level 1

            Hi Ole,


            Thanks for the response!


            It was in fact as you suggest nothing to do with InDesign.  Basically I was using the InDesign web service to call into the scripting.  I generated a .NET class from the WSDL which effective provides an interface wrapper around the web service.


            The issue was that .NET serializes the data bafore it passes it to the web service (which makes sense).  However, when it has serialized the data, it needs a temporary place to hold it.  Turns out my ASP.NET web user controlling the website I was calling from didn't have permissions to write to the temporary folder.  .NET was very annoying in throwing a cast exception instead of the actual IO Exception - but hey ho!


            Anyway, thanks again!