0

我正在尝试使用 Ruby on Rails 创建对EchoSign API的 SOAP 请求,但我收到一条错误消息,指出其中一个字段为空白:

{http://dto14.api.echosign}RecipientRole: cannot accept ''

这是我正在使用的代码:

require 'soap/wsdlDriver'
require 'base64'

filename = 'quote'
recipient = 'martin@domain.co.uk'
quote_id = params[:id]

$S = SOAP::WSDLDriverFactory.new("https://secure.echosign.com/services/EchoSignDocumentService16?wsdl").create_rpc_driver

r = $S.sendDocument(
  :apiKey => 'XXXXXXXXXXX',
  :senderInfo => SOAP::SOAPNil.new,         # we need to explicitly set elements to nil
  :documentCreationInfo => {
          :fileInfos  => [{
                  :file      => RAILS_ROOT + '/pdfs/' + quote_id + '.pdf',
                  :fileName  => filename,
          }],
          :recipients => 
                  [{ :RecipientInfo => [{
                                :email     => 'martin@domain.co.uk',
                                :fax       => SOAP::SOAPNil.new,
                                :role      => 'SIGNER' 
                  }]
          }],
          :message  => "This is neat.",
          :name     => "Test from SOAP-Lite: " + filename,
          :reminderFrequency => "WEEKLY_UNTIL_SIGNED",
          :signatureFlow => "SENDER_SIGNATURE_NOT_REQUIRED",
          :signatureType => "ESIGN",
          :callbackInfo => SOAP::SOAPNil.new,     # we need to explicitly set elements to nil
          :ccs => SOAP::SOAPNil.new,        # we need to explicitly set elements to nil
          :externalId => SOAP::SOAPNil.new,       # we need to explicitly set elements to nil
          :securityOptions => SOAP::SOAPNil.new,      # we need to explicitly set elements to nil
  }
)

我这样做的方式显然有问题

:recipients => 
              [{ :RecipientInfo => [{
                            :email     => 'martin@domain.co.uk',
                            :fax       => SOAP::SOAPNil.new,
                            :role      => 'SIGNER' 
              }]
}],

但是我发现仅从文档中找到内容非常困难,我认为这会很愚蠢,但无法发现。

更新

在仔细查看示例请求后,我尝试了以下操作,但没有任何区别:

require 'soap/wsdlDriver'
require 'base64'

filename = 'quote'
quote_id = params[:id]

$S = SOAP::WSDLDriverFactory.new("https://secure.echosign.com/services/EchoSignDocumentService16?wsdl").create_rpc_driver

r = $S.sendDocument(
  :apiKey => 'XXXXXXXXXXX',
  :senderInfo => SOAP::SOAPNil.new,      
  :documentCreationInfo => {
          :fileInfos  => {
                  :FileInfo => {
                                :file      => RAILS_ROOT + '/pdfs/' + quote_id + '.pdf',
                                :fileName  => filename
                  }
          },
          :recipients => { 
                  :RecipientInfo => {
                                :email     => 'martin@domain.co.uk',
                                :fax       =>  SOAP::SOAPNil.new, 
                                :role      =>  'SIGNER'
                  }
          },
          :mergeFieldInfo => SOAP::SOAPNil.new,
          :tos => SOAP::SOAPNil.new,
          :message  => "This is neat.",
          :name     => "Test from SOAP-Lite: " + filename,
          :reminderFrequency => "WEEKLY_UNTIL_SIGNED",
          :signatureFlow => "SENDER_SIGNATURE_NOT_REQUIRED",
          :signatureType => "ESIGN",
          :callbackInfo => SOAP::SOAPNil.new,     # we need to explicitly set elements to nil
          :ccs => SOAP::SOAPNil.new,        # we need to explicitly set elements to nil
          :externalId => SOAP::SOAPNil.new,       # we need to explicitly set elements to nil
          :securityOptions => SOAP::SOAPNil.new     # we need to explicitly set elements to nil
  }
)
4

2 回答 2

0

您能否尝试SIGNER 使用双引号传递值,例如"SIGNER". 就像你有 for"ESIGN"和其他一些参数一样。

此外,如果发送ESIGN,则Fax不需要nil。尽量不要定义:Fax

于 2013-09-10T19:57:17.280 回答
-1

您应该将电子邮件地址和角色更改为使用双引号而不是单引号。

              :RecipientInfo => {
                            :email     => "martin@domain.co.uk",
                            :fax       =>  SOAP::SOAPNil.new, 
                            :role      =>  "SIGNER" change 

与您对 :reminderFrequency => "WEEKLY_UNTIL_SIGNED", :signatureFlow => "SENDER_SIGNATURE_NOT_REQUIRED" 所做的相同,

于 2013-09-10T20:12:12.187 回答