Dynamic Web Service Developer Guide 1- DWS web service general description The DWS Web Service was created to be used by all IT applications for documents adding, retrieve and other operations related to FileNet. 2- DWS Methods: Method Name Description TokenValidate(Token ) Login to file FileNet, using encrypted token AddDocument(Token , FNDoc) UpdateDocumentmetadata (Token, FNDoc, DocId) UpdateDocument(Token, FNDoc, DocId) Add FileNetDocument (FNDoc) to filenet storage change FileNetDocument (FNDoc) properties Delete(Token, DocId) SearchDocuments(Token, Keys, Values ,Types, ReturnedList, documentClass) DownloadDocument(Token, DocId) getFileNetDoc(Token, DocId) change FileNetDocument (FNDoc) content or properties Delete FileNetDocument Query filenet to retrieve list of document or specific document Download FileNetDocument Get full object of file net document including attachment and properties Request document scan Get scan result for specific document ScanDocument(Token, filepath) GetDocumentStatus(Token, transactionID) Methods Input/ Output parameters Function Name TokenValidate(Token ) AddDocument(Token , FNDoc) UpdateDocumentmetadata (Token, FNDoc, DocId) UpdateDocument(Token, FNDoc, DocId) Delete(Token, DocId) Input Token (String) Token (String), FNDoc(FileNetDocume nt) Token (String), DocId (String), FNDoc (FileNetDocumentUpd ateSet) Token (String), DocId (String), FNDoc (FileNetDocumentUpd ateSet) Token (String) DocId (String) Output ActionResultBoolean ActionResultDocumen tUploadStatus Exceptions DWSExceptio n DWSExceptio n ActionResultBoolean DWSExceptio n ActionResultDocumen tUploadStatus DWSExceptio n ActionResultBoolean DWSExceptio n SearchDocuments(Token, Keys, Values ,Types, ReturnedList, documentClass) DownloadDocument(Token, DocId) getFileNetDoc(Token, DocId) ScanDocument(Token, filepath) GetDocumentStatus(Token, transactionID) Token (String), Keys (list), Values (list), Types (list), ReturnedList, documentClass (String), Token (String) DocId (String) Token (String) DocId (String) Token (String) filepath (String) Token (String) transactionID (int) ActionResultFileNetDo cumentDetailsList DWSExceptio n ActionResultContent DWSExceptio n DWSExceptio n DWSExceptio n DWSExceptio n ActionResultFileNetDo cumenttDetails ScanningDocumentSta tus ScanningDocumentSta tus Input parameters: Function Name Input Description TokenValidate(Token ) Token (String) AddDocument(FNDoc) FNDoc (FileNetDocument) UpdateDocumentmetadata (Token, FNDoc, DocId) DocId (string) Encrypted toke for username and password The FileNet Document object contain all the document Information (Class Name, Properties, Main File Path , mime type, attachments , security group) Filenet document ID for the document that should be updated The FileNet Document object contain all the document Information (Class Name, Properties, , security group) Filenet document ID for the document that should be updated The FileNet Document object contain all the document Information (Class Name, Properties, Main File Path , mime type, attachments , security group) Filenet document ID for the document that should be Deleted List of properties name that will be used in specifying criteria FNDoc(FileNetDocument) UpdateDocument(Token, FNDoc, DocId) DocId (string) FNDoc(FileNetDocument) Delete(Token, DocId) DocId (string) SearchDocuments(Token, Keys, Values ,Types, ReturnedList, documentClass) Keys (list) Values (list) Types (list) ReturnedList(list) documentClass (String) DownloadDocument (Token, DocId) DocId (string) getFileNetDoc (Token, DocId) DocId (string) ScanDocument(Token, filepath) filepath (string) GetDocumentStatus(Token, transactionID) transactionID (int) List of values that are in the same order to its corresponding key List of datatype that are in the same order to its corresponding key List of properties name that will be returned Document class which required documents belong to it Filenet document ID for the document that needed to be downloaded Filenet document ID for the document that needed to be get it’s details Filepath of document to be scanned Integer returned when document submitted using ScanDocument Output parameters: Function Name Output Description TokenValidate(Token ) ActionResultBoolean Contain status code and result of type boolean AddDocument(Token , FNDoc) ActionResultDocumentUploadStatus Contain status code of uploaded document and document identifier VSID UpdateDocumentmetadata (Token, FNDoc, DocId) ActionResultBoolean Contain status code and result of type boolean indicate update status UpdateDocument(Token, FNDoc, DocId) ActionResultDocumentUploadStatus Contain status code of uploaded document and document identifier VSID Delete(Token, DocId) ActionResultBoolean Contain status code and result of type boolean indicate deletion status SearchDocuments(Token, Keys, Values ,Types, ReturnedList, documentClass) ActionResultList Contain status code and result of type list of string for filenet id’s for result document DownloadDocument (Token, DocId) ActionResultContent Contain status code and result of type DocumentContent that condain document byte array in addition to it’s filename in content path getFileNetDoc (Token, DocId) ActionResultFileNetDocumentDetails Contain status code and result of type FileNetDocumentDetails for all document properties ,content and attachment ScanDocument(Token, filepath) ScanningDocumentStatus GetDocumentStatus(Token, transactionID) ScanningDocumentStatus Contain status code and transaction id of submitted document Contain status code and transaction id of submitted document DWS Objects: FileNetDocument object Details: Field Name Type Description Class_Name String FileNet Class Name FilePath String Path of the main document file FNProperty FNProperty object array of the filenet properties(Name, Value) Attachment FileNetAttachment object array of FileNetAttachment object SecurityGroups List List of active directory group MimeType String MimeType of main document file FileNetDocumentDetails object Details: Field Name Type Description Class_Name String FileNet Class Name DocumentContent DocumentContent object of type DocumentContent FNProperty FNProperty object array of the filenet properties(Name, Value) FileNetAttachments List array of FileNetAttachments filenet id FileNetDocumentUpdateSet object Details: Field Name Type Description Class_Name String FileNet Class Name FilePath String Path of the main document file FNProperty FNProperty object array of the filenet properties(Name, Value) SecurityGroups List List of active directory group MimeType String MimeType of main document file FileNetAttachment object Details: Field Name Type Description Class_Name String FileNet Class Name FilePath String Path of the Attachment document file FNProperty FNProperty object array of the filenet properties(Name, Value) SecurityGroups List List of active directory group MimeType String MimeType of main document file AddedDocument object Details: Field Name Type Description DocumentClass String FileNet Document Class of added document DocID String FileNet ID of added Document FilePath String File path of added document Field Name Type Description Name String FileNet Property Name Value String FileNet Property Value FNProperty object Details: DocumentContent object Details: Field Name Type Description Document_Content List Array of byte contains document content FileName String File name in shared physical location FileExtension String File extension ActionResultBoolean object Details: Field Name Type Description StatusCode String DWSOK if success / Error Code if Fail Result Boolean Operation output (true - false) Description String Error message if any ActionResultString object Details: Field Name Type Description StatusCode String DWSOK if success / Error Code if Fail Result String Operation output string (ex: FileNet DocID) Description String Error message if any ActionResultList object Details: Field Name Type Description StatusCode String DWSOK if success / Error Code if Fail Result List Operation output list of string Description String Error message if any ActionResultContent object Details: Field Name Type Description StatusCode String DWSOK if success / Error Code if Fail Operation output object of type DocumentContent Result DocumentContent Contain byte array of required document And also download file to the content path Description String ActionResultFileNetDocument object Details: Error message if any Field Name Type Description StatusCode String DWSOK if success / Error Code if Fail Result FileNetDocument Description String Operation output object of type FileNetDocument Error message if any ActionResultAddedDocuments object Details: Field Name Type Description StatusCode String DWSOK if success / Error Code if Fail Result List Operation output list of object type AddedDocument Description String Error message if any ActionResultFileNetDocumentDetailsList object Details: Field Name Type Description StatusCode String DWSOK if success / Error Code if Fail Result List Operation output list of object type FileNetDocumentDetails Description String Error message if any ActionResultFileNetDocumentDetailsList object Details: Field Name Type Description StatusCode String DWSOK if success / Error Code if Fail Result List Operation output list of object type FileNetDocumentDetails Description String Error message if any ActionResultDocumentUploadStatus object Details: Field Name Type Description String DWSOK if success / Error Code if Fail StatusCode UploadStatus [Enumeration] In Progress. DocumentStatus String Passed Scanning. Added to FileNet. Rejected. Deleted. VSID String Filenet Document Identifier TransctionID int Transaction id to check status of uploaded document Description String Error message if any ScanningDocumentStatus object Details: Field Name Type Description String DWSOK if success / Error Code if Fail StatusCode UploadStatus [Enumeration] In Progress. DocumentStatus String Passed Scanning. Added to FileNet. Rejected. Deleted. TransctionID int Transaction id to check status of uploaded document Description String Error message if any Error Codes Error Code Description DWS00 Add attachment Failed DWS10 Property Is required DWS20 Main Document File Path is not exist DWS30 Move Document to Folder Failed DWS40 Main Document is not exist DWS01 Failed to get the Failed Attachments DWS21 Attachment File Path is not exist DWSOK Operation Success DWS1001 Failed to login using Token DWS1002 Failed to add document DWS1003 Failed to update document DWS1004 Failed to Delete document DWS1005 Failed to Query document DWS1006 Failed to Download document DWS1007 Failed to Get FNDocument DWS1008 Failed to Get FNDocument Status DWS1009 Failed to Get Custom property list Status DWS1010 Error Add Attachment DWS1011 Error in adding security 3- Connection Info File Details: Parameter Name Sample Description LogFileFolderPath C:\Logs\HR The full path for the logs folder FileNet Connections information FNServerName fnTest The FileNet server Name or IP Library OS01 The FileNet Library Name will save the document on it UserName admin FileNet User Name Password rzRufD4Gy/O9t01ARI+Z2Q== FileNet User Password Encrypted by Ebla Encryption EXE DB log Connection information for the DWS_Audit_Log Table The DataBase Type DBType SQLServer SQLServer/ Oracle DBServerName DBTest DataBase Server Name DBName DWSTDB DataBase Name DBLogTable DWS_Audit_Log Main Document Status table Name DBAttachmentLogTable DWS_Audit_Log_Attachment Attachment status table Name DBUserName Sa DataBase User Name DBPassword Kf7BG0GlV1rXNuvlnbJQhw== Database User Password Encrypted by Ebla Encryption EXE 4- Audit log Table Structure: CREATE TABLE [dbo].[DWS_Audit_Log]( [ID] [decimal](18, 0) IDENTITY(1,1) NOT NULL, [Status] [smallint] NOT NULL, [Message] [nvarchar](400) NULL, [DocID] [nvarchar] (400) NULL, [AttachmentNO] [int] NULL, ) ON [PRIMARY] CREATE TABLE [dbo].[DWS_Audit_Log_Attachments]( [JobID] [decimal](18, 0) NOT NULL, [AttachmentNo] [int] NOT NULL, [AttachmentID] [nvarchar] (400) NULL, [Status] [smallint] NOT NULL, [Message] [nvarchar](400) NULL, ) ON [PRIMARY] 5- Sample code: (VB.NET Code) Sample code to TokenValidate: ‘Import Dll namespace Imports EncyptionDll ‘ instance of Encryption class Dim Encryp As EncyptionDll.Encyption = New EncyptionDll.Encyption ‘ define variabled Dim UserName As String = "testUser" Dim Password As String = "testpass" ‘call encrypt method and it will return token as string Dim Token As String = Encryp.Encrypt(UserName, Password) 'Create Istance of the DynamicWebSwevices Private DWS As New DWSFileNet.DynamicWebSwevices 'Call the TokenValidate web method to check token validty Dim Result As ActionResultBoolean = DWS.TokenValidate(Token) ‘ extract result from the output If Result.Result Then MessageBox.Show(Result.StatusCode) Else MessageBox.Show(Result.StatusCode) End If Sample code to Add Document: 'Create Istance of the DynamicWebSwevices Private DWS As New DWSFileNet.DynamicWebSwevices Dim Doc As New FileNetDocument Doc.Class_Name = "Document" 'file system path Doc.FilePath = "D:\DWS_Log\1.tif" 'set document MimeType Doc.MimeType = "image/tiff" Dim DocumentPropertiesList As New List(Of FileNetProperty) Dim prop As New FileNetProperty '1st FileNet Property Name prop.Name = "DocumentTitle" '1st FileNet Property Value prop.Value = "Doc1" 'add the first property to the FileNetProperty array DocumentPropertiesList.Add(prop) prop = New FileNetProperty '2nd FileNet Property Name prop.Name = "requestid" '2nd FileNet Property Value prop.Value = "5" 'add the second property to the FileNetProperty array DocumentPropertiesList.Add(prop) 'DocumentPropertiesList the FileNetProperty array object to the FileNetDocument Doc.FileNetProperty = DocumentPropertiesList.ToArray() 'list of security group Dim Usergroups As New List(Of String) Usergroups.Add("group1@pp.gov.qa") Usergroups.Add("group2@pp.gov.qa") Usergroups.Add("group3@pp.gov.qa") Usergroups.Add("group4@pp.gov.qa") 'set scurity group to document Doc.SecurityGroups = Usergroups.ToArray() Dim atts As New List(Of FileNetAttachment) Dim att As New FileNetAttachment 'the attachment filenet document class name att.Class_Name = "Document" 'the attachment file system path att.FilePath = "D:\DWS_Log\2.tif" 'set attachment MimeType att.MimeType = "image/tiff" 'set scurity group to attachment att.SecurityGroups = Usergroups.ToArray() 'instance of the FileNetProperty array object Dim AttProps As New List(Of FileNetProperty) Dim AttProp As New FileNetProperty '1st FileNet Property Name AttProp.Name = "DocumentTitle" '1st FileNet Property Value AttProp.Value = "Att1" 'add the first property to the FileNetProperty array AttProps.Add(AttProp) '2nd FileNet Property Name AttProp = New FileNetProperty AttProp.Name = "requestid" '2nd FileNet Property Value AttProp.Value = "15" 'add the second property to the FileNetProperty array AttProps.Add(AttProp) 'Pass the FileNetProperty array object to the FileNetAttachment att.FileNetProperty = AttProps.ToArray() 'add the first FileNetAttachment to the FileNetAttachment array atts.Add(att) 'Pass the FileNetAttachment array object to the FileNetDocument Doc.FileNetAttachments = atts.ToArray() Try Dim Encryp As EncyptionDll.Encyption = New EncyptionDll.Encyption Dim UserName As String = "testusername" Dim Password As String = "testpass " Dim Token As String = Encryp.Encrypt(UserName, Password) Dim ActionResultList As ActionResultDocumentUploadStatus = DWS.AddDocument(Token, Doc) If (ActionResultList.StatusCode = "DWSOK") Then MessageBox.Show("Done") Else MessageBox.Show(ActionResultList.Description) End If Catch ex As Exception MessageBox.Show(ex.Message) End Try Sample code to Add Attachment:- '----- Add attachment ------------------------------------------------Dim NewAtt As New DWSFileNet.FileNetAttachment NewAtt.Class_Name = "Document" 'the attachment file system path NewAtt.FilePath = "D:\DWS_Log\3.tif" 'set document MimeType NewAtt.MimeType = "image/tiff" Dim DocumentPropertiesList As New List(Of FileNetProperty) Dim prop As New FileNetProperty '1st FileNet Property Name prop.Name = "DocumentTitle" '1st FileNet Property Value prop.Value = "Doc1" 'add the first property to the FileNetProperty array DocumentPropertiesList.Add(prop) prop = New FileNetProperty '2nd FileNet Property Name prop.Name = "requestid" '2nd FileNet Property Value prop.Value = "5" 'Pass the FileNetProperty array object to the FileNetAttachment NewAtt.FileNetProperty = DocumentPropertiesList.ToArray() 'list of security group Dim Usergroups As New List(Of String) Usergroups.Add("group1@pp.gov.qa") Usergroups.Add("group2@pp.gov.qa") Usergroups.Add("group3@pp.gov.qa") Usergroups.Add("group4@pp.gov.qa") 'set scurity group to document NewAtt.SecurityGroups = Usergroups.ToArray() Try Dim Dim Dim Dim Encryp As EncyptionDll.Encyption = New EncyptionDll.Encyption UserName As String = "testuser" Password As String = "testpass" Token As String = Encryp.Encrypt(UserName, Password) Dim MainDocID As String = "{F6602787-0D47-4519-B4AD-5A9742C5782E}" Dim ActionResultString As ActionResultString = DWS.AddAttachment(Token, MainDocID, NewAtt) If (ActionResultString.StatusCode = "DWSOK") Then MessageBox.Show(ActionResultString.Result) Else MessageBox.Show(ActionResultString.Description) End If Catch ex As Exception MessageBox.Show(ex.Message) End Try Sample code to Update Document:Dim Doc As New FileNetDocument Doc.Class_Name = "Document" 'file system path Doc.FilePath = "D:\DWS_Log\5.tif" 'set document MimeType Doc.MimeType = "image/tiff" Dim DocumentPropertiesList As New List(Of FileNetProperty) Dim prop As New FileNetProperty '1st FileNet Property Name prop.Name = "DocumentTitle" '1st FileNet Property Value prop.Value = "Doc50" 'add the first property to the FileNetProperty array DocumentPropertiesList.Add(prop) prop = New FileNetProperty '2nd FileNet Property Name prop.Name = "requestid" '2nd FileNet Property Value prop.Value = "50" 'add the second property to the FileNetProperty array DocumentPropertiesList.Add(prop) 'DocumentPropertiesList the FileNetProperty array object to the FileNetDocument Doc.FileNetProperty = DocumentPropertiesList.ToArray() Try Dim Dim Dim Dim Encryp As EncyptionDll.Encyption = New EncyptionDll.Encyption UserName As String = "testUser" Password As String = "TestPass" Token As String = Encryp.Encrypt(UserName, Password) Dim MainDocID As String = "{F6602787-0D47-4519-B4AD-5A9742C5782E}" Dim ActionResultString As ActionResultString = DWS.UpdateDocument(Token, Doc, MainDocID) If (ActionResultString.StatusCode = "DWSOK") Then MessageBox.Show(ActionResultString.Result) Else MessageBox.Show(ActionResultString.Description) End If Catch ex As Exception MessageBox.Show(ex.Message) End Try Sample code to Delete Document:Try Dim Dim Dim Dim Encryp As EncyptionDll.Encyption = New EncyptionDll.Encyption UserName As String = "user" Password As String = "pass " Token As String = Encryp.Encrypt(UserName, Password) Dim DocID As String = "{7E23293A-30F4-4040-BDA6-9E3EAC4B44BB}" Dim ActionResultBoolean As ActionResultBoolean = DWS.Delete(Token, DocID) If (ActionResultBoolean.StatusCode = "DWSOK") Then MessageBox.Show(ActionResultBoolean.Result) Else MessageBox.Show(ActionResultBoolean.Description) End If Catch ex As Exception MessageBox.Show(ex.Message) End Try Sample code Search Document:Try Dim Keys(0) As String Dim Values(0) As String Dim Types(0) As String Keys(0) = "DocumentTitle" Values(0) = "Doc50" Types(0) = "String" Dim ReturnList As New List(Of String) ReturnList.Add("DocumentTitle") ReturnList.Add("ID") ReturnList.Add("requestid") Dim Dim Dim Dim Encryp As EncyptionDll.Encyption = New EncyptionDll.Encyption UserName As String = "user" Password As String = "pass " Token As String = Encryp.Encrypt(UserName, Password) Dim DocID As String = "{7E23293A-30F4-4040-BDA6-9E3EAC4B44BB}" Dim ActionResultList As ActionResultFileNetDocumentDetailsList = DWS.SearchDocuments(Token, Keys, Values, Types, ReturnList.ToArray, "Document") If (ActionResultList.StatusCode = "DWSOK") Then MessageBox.Show("Done") Else MessageBox.Show(ActionResultList.Description) End If Catch ex As Exception MessageBox.Show(ex.Message) End Try Sample code Download Document:Try Dim Dim Dim Dim Encryp As EncyptionDll.Encyption = New EncyptionDll.Encyption UserName As String = "user" Password As String = "pass " Token As String = Encryp.Encrypt(UserName, Password) Dim DocID As String = "{F6602787-0D47-4519-B4AD-5A9742C5782E}" Dim ActionResultContent As ActionResultContent = DWS.DownloadDocument(Token, DocID) If (ActionResultContent.StatusCode = "DWSOK") Then MessageBox.Show(ActionResultContent.Description) Else MessageBox.Show(ActionResultContent.Description) End If Catch ex As Exception MessageBox.Show(ex.Message) End Try Sample code getFileNetDoc Document:Try Dim Dim Dim Dim Encryp As EncyptionDll.Encyption = New EncyptionDll.Encyption UserName As String = "user" Password As String = "pass " Token As String = Encryp.Encrypt(UserName, Password) Dim DocID As String = "{F6602787-0D47-4519-B4AD-5A9742C5782E}" Dim ActionResultFileNetDocumentDetails As ActionResultFileNetDocumentDetails = DWS.getFileNetDoc(Token, DocID) If (ActionResultFileNetDocumentDetails.StatusCode = "DWSOK") Then MessageBox.Show(ActionResultFileNetDocumentDetails.Result.Class_Name) Else MessageBox.Show(ActionResultFileNetDocumentDetails.Description) End If Catch ex As Exception MessageBox.Show(ex.Message) End Try Sample code to Update Document Content and MetaData:Dim Doc As New FileNetDocument Doc.Class_Name = "Document" 'file system path Doc.FilePath = "D:\DWS_Log\5.tif" 'set document MimeType Doc.MimeType = "image/tiff" Dim DocumentPropertiesList As New List(Of FileNetProperty) Dim prop As New FileNetProperty '1st FileNet Property Name prop.Name = "DocumentTitle" '1st FileNet Property Value prop.Value = "Doc50" 'add the first property to the FileNetProperty array DocumentPropertiesList.Add(prop) prop = New FileNetProperty '2nd FileNet Property Name prop.Name = "requestid" '2nd FileNet Property Value prop.Value = "50" 'add the second property to the FileNetProperty array DocumentPropertiesList.Add(prop) 'DocumentPropertiesList the FileNetProperty array object to the FileNetDocument Doc.FileNetProperty = DocumentPropertiesList.ToArray() Try Dim Dim Dim Dim Encryp As EncyptionDll.Encyption = New EncyptionDll.Encyption UserName As String = "testUser" Password As String = "TestPass" Token As String = Encryp.Encrypt(UserName, Password) Dim MainDocID As String = "{F6602787-0D47-4519-B4AD-5A9742C5782E}" Dim ActionResultString As ActionResultString = DWS.UpdateDocument(Token, Doc, MainDocID) If (ActionResultString.StatusCode = "DWSOK") Then MessageBox.Show(ActionResultString.Result) Else MessageBox.Show(ActionResultString.Description) End If Catch ex As Exception MessageBox.Show(ex.Message) End Try Sample code to Update Document Meta Data:Dim Doc As New FileNetDocument Doc.Class_Name = "Document" 'file system path Doc.FilePath = "D:\DWS_Log\5.tif" 'set document MimeType Doc.MimeType = "image/tiff" Dim DocumentPropertiesList As New List(Of FileNetProperty) Dim prop As New FileNetProperty '1st FileNet Property Name prop.Name = "DocumentTitle" '1st FileNet Property Value prop.Value = "Doc50" 'add the first property to the FileNetProperty array DocumentPropertiesList.Add(prop) prop = New FileNetProperty '2nd FileNet Property Name prop.Name = "requestid" '2nd FileNet Property Value prop.Value = "50" 'add the second property to the FileNetProperty array DocumentPropertiesList.Add(prop) 'DocumentPropertiesList the FileNetProperty array object to the FileNetDocument Doc.FileNetProperty = DocumentPropertiesList.ToArray() Try Dim Dim Dim Dim Encryp As EncyptionDll.Encyption = New EncyptionDll.Encyption UserName As String = "testUser" Password As String = "TestPass" Token As String = Encryp.Encrypt(UserName, Password) Dim MainDocID As String = "{F6602787-0D47-4519-B4AD-5A9742C5782E}" Dim ActionResultList As ActionResultDocumentUploadStatus = DWS.UpdateDocument(Token, Doc, MainDocID) If (ActionResultList.StatusCode = "DWSOK") Then MessageBox.Show("Done") Else MessageBox.Show(ActionResultList.Description) End If Catch ex As Exception MessageBox.Show(ex.Message) End Try