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
}
)
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 benil
. Try to not defining:Fax
at all.