0

I am trying to use Ruby on Rails to create a SOAP request to the EchoSign API but I am getting an error saying one of the fields is blank:

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

This is the code I am using:

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
  }
)

There must obviously be something wrong with the way I am doing the

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

but I am finding it extremely difficult to find what just from the documentation, I think it will be something silly but can't spot it.

update

after looking more closely at the example request I tried the following but it made no difference:

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
  }
)
martincarlin87
  • 9,630
  • 22
  • 92
  • 143

2 Answers2

0

Can you please try to pass the value SIGNER with double quotations like "SIGNER". Just like you have for "ESIGN" and some other parameters.

Also, if sending for ESIGN, Fax should not need to be nil . Try to not defining :Fax at all.

Raúl Juárez
  • 2,079
  • 1
  • 19
  • 16
Guest
  • 1
-1

You should change the email address and the role to have double quotes instead of single quotes.

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

Same as you have done for :reminderFrequency => "WEEKLY_UNTIL_SIGNED", :signatureFlow => "SENDER_SIGNATURE_NOT_REQUIRED",