1 Reply Latest reply on Oct 4, 2013 7:34 AM by gkaiseril

    NotAllowedError: Security settings prevent access to this property or method.

    Sumith20051979

      While calling a SOAP method to send PDF document stream, I am getting NotAllowedError: Security settings prevent access to this property or method. error. I am able to connect to webservices successfully and able to get data from that. But while trying to send data from adobe acrobat 9 pro to webservice using Javascript, I am getting this error.

       

      I have given the sample code which I am using.

       

      //Function which I am calling from a menu click

       

      var convertToXMl = app.trustedFunction(function() {

      app.beginPriv();

      try {

      var adocs=app.activeDocs;

      var curDoc=adocs[0];

           curDoc.saveAs("/C/Temp/adobe/abc_tmp.xml","com.adobe.acrobat.xml-1-00");

      } catch (e) {

           app.alert("An error occured during saving! " + e);

      }

      var service=SOAP.connect("http://localhost:92/Service1.svc?wsdl");

      var documentStream = Collab.documentToStream(curDoc);

      var encodedStream = Net.streamEncode(documentStream, "base64");

      var utfencodedStream = util.stringFromStream(encodedStream, "utf-8");

      var base64String = {soapType: "xsd:string",soapValue: utfencodedStream};

      var result = service.SaveMyDoc({docStream:base64String}); // Getting NotAllowedError on this line

      app.endPriv();

      });

       

       

      My Webservices (C#.NET) code looks like this.

       

      public void SaveMyDoc(string docStream)

      {

      if (docStream.Length > 0)

      {

      string path = @"C://Temp1//adobe_save_files";

      try

      {

      byte[] pdf = Convert.FromBase64String(docStream);

           File.WriteAllBytes(path + "//mydoc.pdf", pdf);

      }

      catch (Exception ex)

      {

      throw ex;

      }

      }

      }

       

      Please help me on this as I am very new in adobe acrobat Javascript programming. It would be great if anyone can give sample code also to achieve this.