It appears that I am the only one who has succeeded in automating uploading Agnostic Documents. I have just developed and implemented this application for Uploading Agnostic Documents at a major client in Dulles, VA.
I have used Visual Basic and WICOM Object Model and am running on the WEBI Server machine. The application is set to run as a Service. Here is the logic of the program:
Read a parameter file for all the variable info required
Look for existence of files to be uploaded in a predefined folder
Start a WEBI server object
Create a WEBI session and log in
For each file to be uploaded, get a list of groups and categories o be published from an oracle database table
Upload the document to the repository with a date stamp
Search the repository of older versions more than nn versions older and delete it
Move the file to a processed folder
Repeat until all files have been processed
Sleep for nn minutes
Wakeup and start from the beginning.
This logs messages to both a text file and to a table in the database.
As you can see, this is very elaborate and not easy to post on the forum. i will also need to check on any copyright issues. However, I can post code snippets to do just the upload. How should this be done ? Should I email the code to a forum administrator ?
Steve Krandel, Dave Rathburn, Cindy Clayton, if any of you see this, please let me know how I should distribute this.
It is BusinessObjects term for any non-BusinessObjects document loaded into the repository. For example, if proper permissions are granted, Webi users can store XLS, PPT, DOC, or other file types as personal or corporate documents. Since these are not BusinessObjects documents (WID, WQY, REP) they are called “agnostic” documents.
I believe any file that is not a Business Objects file (Business Objects document *.rep, WebI document *.wqy or *.wid, or Business Query document *.bqy) is considered an agnostic file.
'
' Sample working code to automate Uploading Agnostic Documents
' Author: P. S. Mohan (poluvan_mohan@hotmail.com)
'
' This code must run on the WEBI server machine ( Cluster Manager or Node )
'
' Include WebIntelligence 6.0 Object Model (wicom250.dll)
'
Option Explicit
Private Sub Form_Load()
' WEBI variables
Dim wiserv As WIServer
Dim wisess As WISession
Dim wicont As WIObjectContext
Dim widoc As WIDocument
' Binary contents variable
Dim vTemp As Variant
Dim rawData As Variant
Dim retval As Variant
' Miscellaneous variables
Dim sfile As String
Dim FileLength As Long
Dim FileNo As Long
Dim aBytes() As Byte
Dim ii As Integer
' Create the webi server
Set wiserv = CreateObject("Webi.Server")
If wiserv.IsRunning = False Then
MsgBox " *** ERROR *** WEBI Server may not be running."
End
End If
' Create the webi session
' ***
' *** specify the userid & password here
' ***
Set wisess = wiserv.OpenSession("BOUSERID", "BOPASSWORD")
If wisess.UserProfile.Count = 0 Then
MsgBox " *** ERROR *** Unable to create WEBI session "
End
End If
' Create a document context
Set wicont = wisess.CreateContext()
' Read the file as binary.
' ***
' *** specify the file name here
' ***
sfile = "TESTFILE.PDF"
FileNo = FreeFile()
On Error GoTo ReadBinaryError
Open sfile For Binary Access Read As #FileNo
FileLength = FileLen(sfile)
ReDim aBytes(FileLength)
Get #FileNo, , aBytes
Close #FileNo
rawData = aBytes
GoTo Exit_ReadBinary
ReadBinaryError:
On Error GoTo 0
MsgBox "ReadBinaryFile ERROR reading binary file"
End
Exit_ReadBinary:
On Error GoTo 0
' Create a new document
Set widoc = wicont.NewDocument()
' Set the binary contents of the document
' ***
' *** specify the filename and ext here
' ***
Call widoc.SetBinaryContent(rawData, "TESTFILE", "PDF")
'
retval = widoc.Upload("this parameter means nothing")
widoc.Comments = "SPECIFY THE DOCUMENT COMMENTS HERE"
widoc.Keywords = "SPECIFY THE DOCUMENT KEYWORDS HERE"
widoc.RefreshOnOpen = False ' You do not want to refresh Agnostic docs on open
' detach all categories first ( This is needed if you are re-uploading )
vTemp = widoc.CategoryList
If UBound(vTemp) > 0 Then
For ii = 0 To UBound(vTemp)
widoc.DetachCategory (vTemp(ii))
Next ii
End If
' ***
' *** specify all the categories here
' ***
widoc.AttachCategory ("CATEGORY1")
widoc.AttachCategory ("CATEGORY1/SUB-CATEGORY2")
' Now Publish the document
' ***
' *** parameters are document_title, document_domain, overwrite, group_list
' ***
retval = widoc.Publish("TITLE OF DOCUMENT", "Document", True, "GROUP1; GROUP2")
' do all the cleanup
Set widoc = Nothing
Set wicont = Nothing
wisess.Close
Set wisess = Nothing
Set wiserv = Nothing
End Sub
One question: I have this vb in a report that I will send to the BCA for it to be run once a week. Is it possible to avoid hardcoding the user name and password? Possibly by passing through the username and password that is used to send the doc to the BCA?
How are you ? I am new member of this forum and have an experience of almost 2 years in Business Objects. So far I have had an opportunity to play with BO SDK (VBA) but never with Webi SDK.
Recently my company came with the requirement to Publish Agnostic Documents to Repository. As per the documentation I have gone through here, I will either need ASP/JSP coding to do this. I have never used ASP/JSP programming.
I will appreciate if someone could tell me where exaclty do you write ASP (Since we have IIS) code ? I mean for VBA we have Macro in Full client but how do we write ASP code in Webi as we are only using Browser?
Do we need to download certain API from Business Objects for WICOM model? If so, do we need to have license for that or it is free if you have webI Licenses? Also, where do we get this WICOM API’s from ?
So basically , I wanted to know for Publishing Agnostic Document in CORP Docs what all I need in terms of WebI SDK , so I can brief my Manager on this.
Please pardon me for trivialness of the questions. I will appreciate if someone could please help me on this.
Before writing ASP code, having a look at “ASP Document Viewer Sample” in Developer Suite should help you.
And with WICOM you do NOT have to use ASP unless you are writing a web application. You can reference WICOM from a VB / VBA application as well (as demonstrated in attached code).
How are you ? Thanks so much for your prompt reply. I will highly appreciate your help on the folowings:
If I am to Publish Agnostic Document as recommended by MOHAN in his article , Do I need the Developer suite for this or only Full client SDK (VBA) will suffice the needs? Also I will not need any WICOM API’s right? All I need to do is to REFERENCE the Webi 6.5 Object MOdel / Webi 6.0 Object Model in FC SDK…right ???
How do you get the Developer Suite ? Is it free or you need to buy license for this ? Or you get it free if you have Webi Licenses?
If I have the Developer Suite do I automatically get the WICOM API’s or I still will have to Download them?
I’m not sure that it made it into the BOB downloads.
However, I gave this as a presentation at the 2004 IUC at Grapevine. There should be downloads available from the BO site.
I got it from there…I’m just trying to figure out how to make it work (if I can…) and trying to understand how to put it into use. If it had been uploaded to BOB I was hoping that there would be a discussion…and I could get a clue!
I have tried to implement the solution and it is not working for some weird reason. I don’t suppose anybody has run into any trouble using the code on 6.5.2? We are also using a JSP version of Webi.
When testing the code it creates the webi server object and detects it is running and does everything else up to and including creating the widocument object. However, I do not see the category attaching under the category list. Also, when setting the binary content, nothing under that property is changed but the document size property does change. I get a return value of -1 when using the upload method and a return value of 1 when using the publish method. The object model description of those methods is limited. I am not getting any error messages.
The problem was with the Publish method. I was using the Title property for the document name, which was blank. No error was being thrown. Anyway, it should have a return value of 0.
Another thing I ran into - when using a capital extension type (using SetBinaryContent), such as PDF, Infoview will not associate it to an acrobat document. You must use lower case, such as pdf.