Using Savon Rb to communicate with SOAP client (http basic authentication and no WSDL file)

Most of the time, when we connect to webservices via SOAP (via SOAP! via SOAP! ;)), we have a WSDL file either local or downloaded from a server. But sometimes we need to connect to SOAP server which does not have this file and it is secured with http basic authentication.

To communicate with SOAP I use Savon Rb. It is easy and relatively fast. However in documentation there is nothing about communication with http basic authentication protected resources.

Although setting things up is really easy. First authentication:

@soap_client = do
  # Set basic authorization
  http.auth.basic "user_name", "password"

and non-wsdl connection:

@soap_client = do
  wsdl.endpoint = ""
  wsdl.namespace = ""

and that's all. Now we can execute remote method like this:

@soap_client.request :get_items

or with params:

@last_response = @soap_client.request :get_items do
  soap.body = {
    :param_1 => "value_1",
    :param_2 => "value_2",

Categories: Ruby, Software


  1. Thanks dude. I was looking for an example of basic auth for a while.

  2. Thank you soo much !! Was looking for this too.

Leave a Reply

Your email address will not be published. Required fields are marked *


Copyright © 2024 Closer to Code

Theme by Anders NorenUp ↑