Quick Start (MTOM): Retrieve content from Content Services using the web service API (Deprecated)

The following C# code example retrieves a PDF file named MortgageForm.pdf from /Company Home. The PDF file is saved to the local file system and is named UpdatedMortgageForm.pdf. (See Retrieving Content from Content Services (deprecated).)

???/** 
    * 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 RetrieveContent.ServiceReference1; 
 
namespace RetrieveContent 
{ 
       class Program 
       { 
           static void Main(string[] args) 
           { 
               try 
               { 
                   //Specify the name of the store and node 
                   String storeName = "SpacesStore"; 
                   String nodeName = "/Company Home/MortgageForm.pdf"; 
 
                   //Create a DocumentManagementServiceClient object 
                   DocumentManagementServiceClient docManagement = new DocumentManagementServiceClient(); 
                   docManagement.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://localhost:8080/soap/services/DocumentManagementService"); 
 
                   //Enable BASIC HTTP authentication 
                   BasicHttpBinding b = (BasicHttpBinding)docManagement.Endpoint.Binding; 
                   b.MessageEncoding = WSMessageEncoding.Mtom; 
                   docManagement.ClientCredentials.UserName.UserName = "administrator"; 
                   docManagement.ClientCredentials.UserName.Password = "password"; 
                   b.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; 
                   b.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; 
 
                   //Prepare output values 
                   CRCResult content; 
                   String outVal; 
                   BLOB outDoc; 
                   RetrieveContent.ServiceReference1.Map nodeAttributes; 
 
                   //Retrieve /Company Home/MortgageForm.pdf 
                   docManagement.retrieveContent(storeName, 
                       nodeName, 
                       "", 
                       out outVal, 
                       out outDoc, 
                       out nodeAttributes, 
                       out content); 
     
                   //Populate a byte array with BLOB data 
                   byte[] outByteArray = outDoc.MTOM; 
 
                   //Create a new PDF file 
                   FileStream fs2 = new FileStream("C:\\Adobe\UpdatedMortgageForm.pdf", FileMode.OpenOrCreate); 
 
                   //Create a BinaryWriter object 
                   BinaryWriter w = new BinaryWriter(fs2); 
                   w.Write(outByteArray); 
                   w.Close(); 
                   fs2.Close(); 
               } 
               catch (Exception ee) 
               { 
                   Console.WriteLine(ee.Message); 
               } 
 
           } 
       } 
} 

// Ethnio survey code removed