DocuSign基于SOAP的API调用错误处理

时间:2013-12-18 14:50:47

标签: docusignapi

我正在使用基于SOAP的API调用来创建DocuSign信封。 我能够创建一个信封但是如果收件人或其他东西缺少标签,我无法从API调用中检索正确的错误消息。 这是我的代码。

Dim client As New DocuSignServ.DSAPIServiceSoapClient
                Using scope As System.ServiceModel.OperationContextScope = New System.ServiceModel.OperationContextScope(client.InnerChannel)
                    SetHttpHeader()
                    Try
                        status = client.CreateAndSendEnvelope(newennvelope)
                        Session("status") = status
                        env.ID = status.EnvelopeID
                        envelopeid = env.ID
                    Catch ex2 As System.ServiceModel.FaultException
                        errormsg = "Error occured while creating an envelope into DocuSign account<br>Error Details : " & ex2.InnerException.Message.ToString
                    Catch ex As Exception

                        errormsg = "Error occured while creating an envelope into DocuSign account<br>Error Details : " & ex.Message.ToString
                    End Try
                End Using

请指教,

由于

1 个答案:

答案 0 :(得分:0)

如果你查看DocuSign SOAP服务的WSDL,你会发现有一个错误元素指定了ErrorCodeMessage

<s:complexType name="ErrorDetails">
<s:sequence>
    <s:element minOccurs="0" maxOccurs="1" name="ErrorCode" type="s:string"/>
    <s:element minOccurs="0" maxOccurs="1" name="Message" type="s:string"/>
</s:sequence>
</s:complexType>

您只需要解析该XML以检索错误代码和描述。

DocuSign WSDL