Skip to Content

how to upload an external file to BO CMS via API

Nov 09, 2016 at 04:10 PM


avatar image

Hi all,

our customer wants to upload files (PDF, PowerPoint, Word and Excel documents) programmatically into the BO CMS. The aim is to use this as a publish feature, i.e. to make the files available in an authorized folder. All users with the role to Access the folder can view the file.

So far we have implemented the startUpload - oploadFile - finishImportUpload methods of the com.businessobjects.dsws.biplatform.BIPlatform object as described here:

Unfortunately, we get an "couldn't find END tag" error in the finishImportUpload metohd (full exception see below). However, the file in the TEMP folder can be opened without problems.

Is the finishImportUpload method the right one to upload files to the CMS?

Thanks for your Input!


CallStackTrace= at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at BusinessObjects.DSWS.BIPlatform.ConsumerBIPlatform.FinishImportUpload(String SessionID, String UploadID, String DestinationFolderCUID, ImportOptions Options)
at BusinessObjects.DSWS.BIPlatform.BIPlatform.FinishImportUpload(String uploadID, String importFolderCUID, ImportOptions options)
CauseMessage=Input/output exception occurred : 'Open failed for file 'C:\Windows\TEMP\28826JQDWk1z2nz0Xrt0VJgwvJbM%2CSI_TENANT_ID%3D0\AecVnIjVo3VHkz1QgoH8Ub4' with error message 'couldn't find 'END' tag'.' (FWM 04013)

Message=FinishImportUpload exception (Error: WBP 99999)
Source=DSWS Web Service Consumer
at BusinessObjects.DSWS.BIPlatform.BIPlatform.FinishImportUpload(String uploadID, String importFolderCUID, ImportOptions options)
at com.biexcellence.openbi.DesignStudioExport.DesignStudioExportHandler.plublish2BO(IHttpResponse& iresponse, openbiExportSettings isettings)

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
avatar image
Former Member Nov 10, 2016 at 09:15 PM

Thanks Karthik for the hints, we figured it out using the .NET API:

Dim lfilename = "test.pdf"
Dim lcontentType = "application.pdf"
Dim lstream As New FileStream(lfilename, FileMode.Open)

Dim lsession As BusinessObjects.DSWS.Session.Session = ...
Dim biPlatformURL As String() = lsession.GetAssociatedServicesURL("BIPlatform")

Dim lbi = BusinessObjects.DSWS.BIPlatform.BIPlatform.GetInstance(lbo.SessionObject, biPlatformURL(0))

Dim lresponseHolder As BusinessObjects.DSWS.BIPlatform.ResponseHolder = lbi.Get("path://InfoObjects/" & lpath, Nothing)
Dim lfolder = lresponseHolder.InfoObjects
Dim lparentCuid As String = lfolder.InfoObject(0).CUID
Dim lcuid As String = lbi.GenerateCuids(1)(0)

Dim lfileInfoObject As BusinessObjects.DSWS.BIPlatform.Desktop.InfoObject
Select Case Path.GetExtension(lfilename).ToLower
    Case ".pdf"
        lfileInfoObject = New BusinessObjects.DSWS.BIPlatform.Desktop.Pdf
    Case ".xls", ".xlsx"
        lfileInfoObject = New BusinessObjects.DSWS.BIPlatform.Desktop.Excel
    Case ".ppt", ".pptx"
        lfileInfoObject = New BusinessObjects.DSWS.BIPlatform.Desktop.Powerpoint
    Case ".doc", ".docx"
        lfileInfoObject = New BusinessObjects.DSWS.BIPlatform.Desktop.Word
    Case Else
        lfileInfoObject = New BusinessObjects.DSWS.BIPlatform.Desktop.Agnostic
        DirectCast(lfileInfoObject, BusinessObjects.DSWS.BIPlatform.Desktop.Agnostic).MimeType = lcontentType
End Select
lfileInfoObject.CUID = lcuid
lfileInfoObject.Name = lfilename
lfileInfoObject.ParentCUID = lparentCuid

Dim luploadStatus As BusinessObjects.DSWS.BIPlatform.UploadStatus = New BusinessObjects.DSWS.BIPlatform.UploadStatus()
luploadStatus.UploadID = lbi.StartUpload()

Dim lbuffSize = 32768
Dim lbyteCount = 0
Dim lnumBytes = lstream.Length
While lbyteCount < lnumBytes
    If ((lnumBytes - lbyteCount) < lbuffSize) Then
        lbuffSize = lnumBytes - lbyteCount
    End If

    Dim ldata As Byte() = New Byte(lbuffSize - 1) {}
    lstream.Read(ldata, 0, lbuffSize)

    luploadStatus = lbi.UploadFile(luploadStatus.UploadID, Nothing, ldata)
    lbyteCount += lbuffSize
End While

Dim linfoobjects As New BusinessObjects.DSWS.BIPlatform.Desktop.InfoObjects
linfoobjects.InfoObject = {lfileInfoObject}
luploadStatus = lbi.FinishUploadWithObject(luploadStatus.UploadID, lfilename, linfoobjects, Nothing)
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member
Nov 10, 2016 at 05:26 AM

Hi Thilo, I suggest you can consume the RESTful web service which is already available starting BI 4.2 SP2 . RESTful web sevices which are available are easier to consume and you can upload not just BOE documents but including agnostic documents . A simple RESTful call for uploading your document would look like this :


RESTful Service URL : http://<baseURL>/infostore/folder/<folder_id>/file

Replace <baseURL> with the base URL for RESTful web service requests.

Replace <folder_id> with the SI_ID of the folder in which you want to upload a file.

Add the logon token information in the Header as X-SAP-LogonToken

Add the form-data for your file you want to upload(From your client, u can browse for the file and select which file to upload)

and upload by sending the request .

You can upload any BOE (Webi, Crystal and Lumira documents) or Non-BOE documents (Any Agnostic documents like Word Document, Adobe Acrobat and Text)

10 |10000 characters needed characters left characters exceeded
avatar image
Former Member
Nov 10, 2016 at 05:36 AM

Thanks Karthik.

10 |10000 characters needed characters left characters exceeded