2

I'm trying to convert the sample C# code provided my echosign in VB.net for use within our applications. Specifically the SendDocument method.

Has anyone out there done this already?

The API is throwing back an error message "Fault: java.lang.NullPointerException" when ever i call it.

Here is the converted function:

Public Shared Function SendDocument(ByVal apiKey As String, ByVal file As Byte(), ByVal recipientEmailAddress As String, ByVal fileName As String, ByVal message As String, ByVal expireDays As Int32) As String

    Try

        Dim ES As EchoSignDocumentService13 = New EchoSignDocumentService13()
        ES.Url = "https://secure.echosign.com/services/EchoSignDocumentService13"

        Dim recipients(1) As String
        recipients(0) = recipientEmailAddress

        Dim localSenderInfo As com.echosign.secure.SenderInfo = Nothing

        Dim echoFileInfo(1) As com.echosign.secure.FileInfo
        echoFileInfo(0) = New com.echosign.secure.FileInfo()
        With echoFileInfo(0)
            .fileName = fileName
            .mimeType = "application/msword"
            .file = file
        End With

        Dim echoDocumentInfo As com.echosign.secure.DocumentCreationInfo = New com.echosign.secure.DocumentCreationInfo()
        With echoDocumentInfo
            .tos = recipients
            .name = fileName
            .message = message
            .fileInfos = echoFileInfo
            .signatureType = SignatureType.ESIGN
            .signatureFlow = SignatureFlow.SENDER_SIGNATURE_NOT_REQUIRED
            .daysUntilSigningDeadline = expireDays
        End With

        Dim echoKey() As DocumentKey
        echoKey = ES.sendDocument(apiKey, localSenderInfo, echoDocumentInfo)

        Return echoKey(0).documentKey.ToString()

    Catch ex As Exception

        Return "EchoError: " & ex.Message

    End Try

End Function

Any help is most welcome

Thanks

Richard

Richard
  • 87
  • 1
  • 7
  • Solved it, it was me being a complete numpty. Dim recipients(1) As String resulted is a 2 element array. The second elemetn was empty and so the API did not like it. Thanks for looking anyway. – Richard May 09 '12 at 07:11

0 Answers0