Skip to content
Create a gist now

Instantly share code, notes, and snippets.

# by examples
# overview of examples at:
require "savon"
# = Instantiation
# Savon is based on the Savon::Client object. So the first thing you want to do, is to create a new
# Savon::Client instance. A few examples on using the Savon::Client with or without a WSDL are at:
client = do
wsdl.location = ""
# = SOAP actions
# When using Savon with a WSDL, you can ask Savon::WSDL about available SOAP actions.
client.wsdl.soap_actions # => [:get_user_by_id, :get_all_users]
# = Executing a SOAP request
# To execute a SOAP request, you just call the name of the SOAP action on the Savon::Client instance.
# When using Savon with a WSDL, you can name the method in snake_case without a problem. When you don't,
# Savon don't knows anything about your service, so it uses the convention of converting the method into
# lowerCamelCase. In case that doesn't work for you, please have a look at:
# To specify the payload for the SOAP action to receive, you can pass a Hash to Savon::SOAP#body.
# The Hash will be converted into XML via Hash#to_soap_xml. More information:
# You can also pass the raw XML as a String in case Hash#to_soap_xml does not work for you.
client.get_user_by_id do
soap.body = { :id => 12 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.