Wednesday, August 13, 2008

CyberSource, SOAP and Ruby

CyberSource has a SOAP API. They don't officially support Ruby, but I don't see why it shouldn't work. Ruby has built-in support for SOAP. I knew absolutely nothing about SOAP or WSDL an hour ago, so I'm still trying to figure out how this works. SOAP is a protocol for calling web services and getting the responses from them. WSDL files describe the available web services. It looks like CyberSource publishes a new WSDL file for every API version that it supports. The latest at the moment seems to be 1.38. You can see a list of their WSDL files here. Let's try something:

require "soap/wsdlDriver"

wsdl_file = "" +

# Create a driver from the definition provided in wsdl_file.
driver =

# See what's available in this driver.
puts driver.methods.sort.join("\n")

This prints out a long list of method names available on the driver that is created from the WSDL file. AFAICT, the only method you're supposed to call is runTransaction. I don't know how to call it yet.

No comments: