Quick Start (MTOM): Modifying a watermark using the web service API

The following C# web service code example modifies a watermark named Confidential by modifying the value of the opacity attribute to 80.

???/** 
    * Ensure that you create a .NET project that uses  
    * MS Visual Studio 2008 and version 3.5 of the .NET 
    * framework. This is required to invoke a  
    * LiveCycle service using MTOM. 
    *      
    * For information, see "Invoking LiveCycle using MTOM" in Programming with LiveCycle   
    */ 
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.ServiceModel; 
using System.IO; 
using ModifyWatermark.ServiceReference1; 
 
namespace ModifyWatermark 
{ 
       class Program 
       { 
           static void Main(string[] args) 
           { 
               try 
               { 
                   //Create a RightsManagementServiceClient object 
                   RightsManagementServiceClient rmClient = new RightsManagementServiceClient(); 
                   rmClient.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://hiro-xp:8080/soap/services/RightsManagementService?blob=mtom"); 
 
                   //Enable BASIC HTTP authentication 
                   BasicHttpBinding b = (BasicHttpBinding)rmClient.Endpoint.Binding; 
                   b.MessageEncoding = WSMessageEncoding.Mtom; 
                   rmClient.ClientCredentials.UserName.UserName = "administrator"; 
                   rmClient.ClientCredentials.UserName.Password = "password"; 
                   b.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; 
                   b.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; 
 
                    //Set the watermark properties 
                   ModifyWatermark.ServiceReference1.MyArrayOf_xsd_anyType myCollectionObject = new ModifyWatermark.ServiceReference1.MyArrayOf_xsd_anyType(); 
 
                   //Define the key/value pairs required by the Rights Management service 
                   MyMapOf_xsd_string_To_xsd_anyType_Item valueMapSpec = new MyMapOf_xsd_string_To_xsd_anyType_Item(); 
                   valueMapSpec.key = "WaterBackCmd:IS_USERID_ENABLED"; 
                   valueMapSpec.value = "true"; 
 
                   //Set the text enabled property 
                   MyMapOf_xsd_string_To_xsd_anyType_Item valueMapSpec1 = new MyMapOf_xsd_string_To_xsd_anyType_Item(); 
                   valueMapSpec1.key = "WaterBackCmd:IS_CUSTOMTEXT_ENABLED"; 
                   valueMapSpec1.value = "True"; 
 
                   //Set the opacity property 
                   MyMapOf_xsd_string_To_xsd_anyType_Item valueMapSpec2 = new MyMapOf_xsd_string_To_xsd_anyType_Item(); 
                   valueMapSpec2.key = "WaterBackCmd:OPACITY"; 
                   valueMapSpec2.value = ".80"; 
 
                   //Set the text property 
                   MyMapOf_xsd_string_To_xsd_anyType_Item valueMapSpec3 = new MyMapOf_xsd_string_To_xsd_anyType_Item(); 
                   valueMapSpec3.key = "WaterBackCmd:SRCTEXT"; 
                   valueMapSpec3.value = "Confidential"; 
 
                   //Add each MyMapOf_xsd_string_To_xsd_anyType_Item instance to the 
                   //the MyMapOf_xsd_string_To_xsd_anyType object 
                   myCollectionObject.Add(valueMapSpec); 
                   myCollectionObject.Add(valueMapSpec1); 
                   myCollectionObject.Add(valueMapSpec2); 
                   myCollectionObject.Add(valueMapSpec3); 
 
                   //Create a WatermarkSpec object and set its watermarks attributes 
                   //Retrieve the watermark named Confidential 
                   WatermarkSpec watermark = rmClient.getWatermarkByName("Confidential"); 
                   watermark.values = myCollectionObject; 
 
                   //Update the watermark 
                   rmClient.updateWatermark(watermark); 
               } 
 
               catch (Exception ee) 
               { 
                   Console.WriteLine(ee.Message); 
               } 
           } 
       } 
} 

// Ethnio survey code removed