Select the search type
  • Site
  • Web
Search
You are here:  Support/Forums
Support

Bring2mind Forums

DMXWebService - SimpleUploadNewEntry
Last Post 05/06/2010 1:43 PM by Peter Donker. 3 Replies.
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Kendall
New Member
New Member
Posts:2


--
04/29/2010 9:40 PM

 I'm trying to upload a file via the webservice and I'm getting the error: "Server was unable to process request. ---> Object reference not set to an instance of an object." The code I'm using is below. Can someone please point me in the right direction? Thanks!

Try
            Dim fileName As String = "C:\temp\pup.jpg"

            ' Open a file that is to be loaded into a byte array
            Dim oFile As System.IO.FileInfo
            oFile = New System.IO.FileInfo(fileName)

            Dim oFileStream As System.IO.FileStream = oFile.OpenRead()
            Dim lBytes As Long = oFileStream.Length

            If (lBytes > 0) Then
                Dim fileData(lBytes - 1) As Byte

                ' Read the file into a byte array
                oFileStream.Read(fileData, 0, lBytes)
                oFileStream.Close()

                Dim lc As New LoginCredentials()
                lc.PortalId = 0
                lc.Username = "user"
                lc.Password = "password"

                Dim ssc As New DMXService()
                ssc.LoginCredentialsValue = lc
                If ssc.Login() Then
                     ssc.SimpleUploadNewEntry(0, fileData, "pup.jpg")
                End If
            End If

        Catch ex As Exception
            Response.Write(ex.Message)
        End Try

Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
05/02/2010 10:36 AM
Hi Kendall,

I'll need to try this code myself. I'll let you know what I find.

Peter
Kendall
New Member
New Member
Posts:2


--
05/03/2010 3:20 PM

Thank you Peter. It's actually working now that I have WebDav configured properly!

Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
05/06/2010 1:43 PM
Hi Kendall,

Great. I did try some code btw and have had some success in uploading now. A small adjustment to the web service was needed to get it to work.

Peter
You are not authorized to post a reply.