Savon::Service is a SOAP client library to enjoy. The goal is to minimize the overhead of working with SOAP services and provide a lightweight alternative to other libraries.


The gem for Savon is in the {gemcutter}[] repository.
Please follow the steps on their website to set up your rubygems installation.
Afterwards you can install the gem like this:

$ gem install savon


rubiii-apricoteatsgorilla >= 0.5.10
hpricot 0.8.241 (the latest JRuby-compatible version)

Hpricot 0.8.241 is also available at: Apricot eats Gorilla Downloads

How to use

Instantiate a new Savon::Service instance passing in the WSDL of your service.

proxy ="")

Call the SOAP service method of your choice on your Savon::Service instance.

response = proxy.get_all_users

Or pass in a Hash of options for the SOAP service to receive.

response = proxy.find_user_by_id(:id => 123)

Or specify a custom XPath-Expression to start translating the SOAP response at. By default the response is translated starting at “//return”.

response = proxy.find_user_by_id(nil, "//user/email")

Check for available SOAP actions

Access the WSDL to get an Array of SOAP actions found in the WSDL document.

# => [ "getAllUsers", "findUserById" ]

Handle HTTP error and SOAP faults

Savon::Service raises a Savon::SOAPFault in case of a SOAP fault and a Savon::HTTPError in case of an HTTP error.

Logging request and response

You should specify the logger to use before working with any service.

# example for Ruby on Rails

Of course you can also specify the log level if needed. By default it's set to :debug.

Savon.log_level = :info