Using EchoSign API in VB.net

瘦欲@ 提交于 2019-12-02 07:09:22

问题


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

来源:https://stackoverflow.com/questions/10500167/using-echosign-api-in-vb-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!