views:

15

answers:

2

Hi,

I am using docmail's Simple API for sending Postcard.They have implemented this functionality recently, but I didn't get any sample code or instruction for implementation.

Thanks in advance, Gaurav Soni

A: 

Hi Gaurav,

We don't have any RoR examples at this time - others here may be able to help, but it's essentially a SOAP webservice, with the SimpleAPI using less complex data types than the standard version. The standard API already lets you send postcards and letters, but is more complex to use from some environments due to it's complex data types.

The test version of Docmail's SimpleAPI has now been updated to expose postcard calls to allow physical postcards to be send via the Simple version of the API. Once we're happy with the updates, we'll make them available in the live version too.

Although you've probably already been through the other info on the API, here are some links/addresses in case anyone else needs them: Docmail API Info Page

Simple API Test Webservice & Website (for the Simple API Live versions, replace "Test" with "Live"):
https://www.cfhdocmail.com/Test_SimpleAPI/DocMail.SimpleAPI.asmx?WSDL
https://www.cfhdocmail.com/Test

Hope that helps.
Will
(from Docmail)

PrintAndMail
Note: you'll need to make sure the PDF/Word file used contains 2 or less pages for postcards.
PrintAndMail
A: 

Hi,

I got my answer.Here is a sample code that can interact with Docmail Simple API methods.

require "base64" require "soap/wsdlDriver"

class TestDocmailLetterSending

def initialize(account) api="https://www.cfhdocmail.com/Test_SimpleAPI/DocMail.SimpleAPI.asmx?wsdl" @test = SOAP::WSDLDriverFactory.new(api).create_rpc_driver

contents = open(file, "rb") do |f| f.read end

result = @test.sendLetterToSingleAddress(
  'sUsr' => "username",
  'sPwd' => "password",
  'sMailingName' => "string",
  'sCallingApplicationID' => "string",
  'bColour' => true,
  'bDuplex' => true or false,
  'eDeliveryType' => "StandardClass",
  'sTemplateFileName' => File.basename(file),
  'eAddressNameFormat' => "FullName",

  'bTemplateData' => contents,
  'sFirstName' => first_name, 
  'sLastName'  => last_name,  
  'sAddress1' => "",
  'sAddress2' => ,
  'sAddress3' => ,
  'sAddress4' => ,
  'sPostCode' => ,
  'bProofApprovalRequired' => 'false'
)

end

end

gsoni