Connecting to the SOAP API Using Ruby on Rails

This page contains information on connecting your development environment or other systems to the Marketing Cloud SOAP API using Ruby on Rails.

Why Connect to the SOAP API using Ruby on Rails

You can use the connection to the SOAP API to test your calls and perform various tasks, such as sending email and retrieving tracking information.

Prerequisites

You must download and install the following in order to connect to the SOAP API via Ruby on Rails:

  • soap4r (soap4r-ruby19 if using Ruby v1.9)
  • wss4r
  • wsse

Marketing Cloud also provides a full Ruby on Rails SDK for connecting your environment and developing your projects.

Download Ruby on Rails SDK

How to Connect to the SOAP API using Ruby on Rails

Follow the directions below to connect to the SOAP API using Ruby on Rails:

Sample Code

The sample code below demonstrates how to connect and interact with the SOAP API.

Generating Drivers

You can generate your own Ruby on Rails drivers using wsdl2ruby.rb and typing the following command in your command line.

Executing a Ruby on Rails File in a Shell

Use the following syntax to execute a Ruby on Rails file in a shell:

Authenticating your Environment to the SOAP API

Use the sample code below to authenticate your Ruby on Rails environment to the SOAP API: