在VB.net中使用EchoSign API

时间:2012-05-08 14:02:30

标签: nullpointerexception echosign

我正在尝试转换样本C#代码,在VB.net中提供我的echosign,以便在我们的应用程序中使用。特别是SendDocument方法。

有人在那里做过吗?

当我调用它时,API会抛出错误消息“Fault:java.lang.NullPointerException”。

这是转换后的功能:

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

欢迎任何帮助

由于

理查德

0 个答案:

没有答案