Quick Start (Base64): Reading a resource using the web service API

The following C# code example reads a resource called Loan.xdp from the repository. The XDP file is located in /Applications/FormsApplication/1.0/FormsFolder/. (See Reading Resources.)

/* 
    * Ensure that you create a .NET client assembly that uses  
    * base64 encoding. This is required to populate a BLOB  
    * object with data or retrieve data from a BLOB object. 
    *  
    * For information, see "Invoking LiveCycle using Base64 Encoding"  
    * in Programming with LiveCycle 
    */ 
using System; 
using System.Collections; 
using System.ComponentModel; 
using System.Data; 
using System.IO; 
 
namespace RepositoryWebService 
{ 
       class ReadFile 
       { 
           [STAThread] 
           static void Main(string[] args) 
           { 
               //This quick start retrieves Loan.xdp from Applications/FormsApplication/1.0/FormsFolder 
               //Ensure that you create a LiveCycle application named FormsApplication using Workbench 
               try 
               { 
                   //Create a RepositoryServiceService object 
                   RepositoryServiceService repositoryClient = new RepositoryServiceService(); 
                   repositoryClient.Credentials = new System.Net.NetworkCredential("administrator", "password"); 
 
                   // Specify the path to the Loan.xdp 
                   String resourceUri = "/Applications/FormsApplication/1.0/FormsFolder/Loan.xdp"; 
 
                   // Retrieve the resource  
                   Resource r = repositoryClient.readResource(resourceUri, null, null); 
 
                   // Print the resource verification message 
                   Console.WriteLine( 
                       "Resource " + 
                       resourceUri + 
                       " was successfully retrieved." 
                   ); 
               } 
               catch (Exception e) 
               { 
                   Console.WriteLine( 
                       "Exception thrown while trying to read the file" + 
                       e.Message 
                   ); 
               } 
 
           } 
       } 
}