Passing secure documents to invoke processes using Remoting

You can pass secure documents to LiveCycle when invoking a process that requires one or more documents. By passing a secure document, you are protecting business information and confidential documents. In this situation, a document can refer to a PDF document, an XML document, a Word document, and so on. Passing a secure document to LiveCycle from a client application written in Flex is required when LiveCycle is configured to allow secure documents. (See Configuring LiveCycle to accept secure and unsecure documents.)

When passing a secure document, use single sign-on and specify a LiveCycle user who has the Document Upload Application User role. Without this role, the user cannot upload a secure document. You can programmatically assign a role to a user. (See Managing Roles and Permissions.)

Hinweis: When you create a new role and you want members of that role to upload secure documents, ensure that you specify the Document Upload permission.

LiveCycle supports an operation named getFileUploadToken that returns a token that is passed to the upload servlet. The DocumentReference.constructRequestForUpload method requires a URL to LiveCycle along with the token returned by the LC.FileUploadAuthenticator.getFileUploadToken method. This method returns a URLRequest object that is used in the invocation to the upload servlet. The following code demonstrates this application logic.

    ... 
        private function startUpload():void 
        {     
            fileRef.addEventListener(Event.SELECT, selectHandler); 
            fileRef.addEventListener("uploadCompleteData", completeHandler); 
            try  
            { 
        var success:Boolean = fileRef.browse(); 
            }  
            catch (error:Error)  
            { 
                trace("Unable to browse for files."); 
            } 
 
        } 
 
         private function selectHandler(event:Event):void 
            { 
            var authTokenService:RemoteObject = new RemoteObject("LC.FileUploadAuthenticator"); 
            authTokenService.addEventListener("result", authTokenReceived); 
            authTokenService.channelSet = cs; 
            authTokenService.getFileUploadToken(); 
            } 
     
        private function authTokenReceived(event:ResultEvent):void 
            { 
            var token:String = event.result as String; 
            var request:URLRequest = DocumentReference.constructRequestForUpload("http://localhost:8080", token); 
             
            try 
            { 
          fileRef.upload(request); 
            } 
            catch (error:Error) 
            { 
            trace("Unable to upload file."); 
            }                               
            } 
 
        private function completeHandler(event:DataEvent):void  
        { 
             
            var params:Object = new Object(); 
            var docRef:DocumentReference = new DocumentReference(); 
            docRef.url = event.data as String; 
            docRef.referenceType = DocumentReference.REF_TYPE_URL; 
        } 
        ...

)