Showing posts with label ruby. Show all posts
Showing posts with label ruby. Show all posts

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 http://savonrb.com/ to download
require 'savon'

# first, build the soap client from the wsdl
client = Savon::Client.new 
    "http://api.jangomail.com/api.asmx?wsdl"

# specify the xml for the request, inserting your credentials
response = client.request 
    "http://api.jangomail.com/Groups_GetList_String" do |soap|
  soap.xml = """<?xml version=\"1.0\" encoding=\"utf-8\"?>
    <soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSch...
    <soap12:Body>
    <Groups_GetList_String xmlns=\"http://api.jangomail.com/\">
    <Username>Your JangoMail/JangoSMTP Username</Username>
    <Password>Your JangoMail/JangoSMTP Password</Password>
    <RowDelimiter> </RowDelimiter>
    <ColDelimiter> - </ColDelimiter>
    <TextQualifier></TextQualifier>
    </Groups_GetList_String></soap12:Body></soap12:Envelope>"""
end