Ruby on Rails Adobe EchoSign SOAP Request

598 Views Asked by At

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 = '[email protected]'
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     => '[email protected]',
                                :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     => '[email protected]',
                            :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     => '[email protected]',
                                :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
  }
)
2

There are 2 best solutions below

0
On

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.

0
On

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

              :RecipientInfo => {
                            :email     => "[email protected]",
                            :fax       =>  SOAP::SOAPNil.new, 
                            :role      =>  "SIGNER" change 

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