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",