Thursday, March 29, 2012

Calling the JangoMail API in Ruby Using SOAP

If you're integrating in a Ruby environment, then Savon is a great, versatile way to call SOAP web services. In this example, we use savon to build a soap client for the JangoMail API, then call Groups_GetList_String. To test it with your own account, just insert your own JangoMail/JangoSMTP credentials. Download the source code for this example to start your own integration!

# make sure to include savon for building soap requests
# see to download
require 'savon'

# first, build the soap client from the wsdl
client = 

# specify the xml for the request, inserting your credentials
response = client.request 
    "" do |soap|
  soap.xml = """<?xml version=\"1.0\" encoding=\"utf-8\"?>
    <soap12:Envelope xmlns:xsi=\"
    <Groups_GetList_String xmlns=\"\">
    <Username>Your JangoMail/JangoSMTP Username</Username>
    <Password>Your JangoMail/JangoSMTP Password</Password>
    <RowDelimiter> </RowDelimiter>
    <ColDelimiter> - </ColDelimiter>