Link to home
Start Free TrialLog in
Avatar of Abdul Jalil Abou Alzahab
Abdul Jalil Abou AlzahabFlag for Canada

asked on

Applying RMS on Word document by using .net web service

Problem Description:
==================

If I run web service directly after running it from visual studio: the calling of web service applying correctly and RMS policy can be applied on document.

                BUT, After publish web service on IIS and calling it, the RMS policy couldn’t be applied on word document and it causing crash in MS word.
                Other Word automation functions work correctly, only “ApplyPolicy” not working

                I’ve changed security in:
-       “DefaultAppPool” in IIS
-      DCOM objects
-      Create folder “Desktop” under Windows\sysWOW64\config\systemProfile”

Problem only if we applying RMS via web service, if we open normal word documents and try to protect, RMS working fine.

Additional Information:
=====================

RMS server: 2008

RMS client operation system:

-      Windows server 2008 R2
-      Office 2007
-      IIS 7.0
-      .Net framework 2.0

Web Service simple code for web method:
=====================================
 //OBJECT OF MISSING "NULL VALUE"
        Object oMissing = System.Reflection.Missing.Value;

        //OBJECTS OF FALSE AND TRUE
        Object oTrue = true;
        Object oFalse = false;

        Microsoft.Office.Interop.Word.Application oWord;
        Microsoft.Office.Interop.Word.Document oWordDoc;

       oWord = new Microsoft.Office.Interop.Word.Application();
       oWordDoc = new Microsoft.Office.Interop.Word.Document();
            
            //MAKING THE APPLICATION VISIBLE
            oWord.Visible = false;

           //ADDING A NEW DOCUMENT TO THE APPLICATION
oWordDoc = oWord.Documents.Add(ref filePath, ref oMissing, ref oMissing, ref oMissing);
oWordDoc.Permission.ApplyPolicy(“template.xml”);

oWordDoc.SaveAs(ref filePath, ref oMissing, ref oMissing, ref oMissing,
            ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
            ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
            ref oMissing, ref oMissing);

            //CLOSING THE FILE
oWordDoc.Close(ref oFalse, ref oMissing, ref oMissing);

           //QUITTING THE APPLICATION
oWord.Quit(ref oMissing, ref oMissing, ref oMissing);

Open in new window

Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

which error do u get?
ASKER CERTIFIED SOLUTION
Avatar of Abdul Jalil Abou Alzahab
Abdul Jalil Abou Alzahab
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Abdul Jalil Abou Alzahab

ASKER

I solve the issue by excluding specific URL's from IE proxy settings