0

Ruby on Rails を使用してEchoSign APIへの SOAP リクエストを作成しようとしていますが、フィールドの 1 つが空白であるというエラーが表示されます。

{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