def invoke_soap(message_type, message)
      started = Time.now
      notification_payload = { request: message }

      response = client.call(message_type, message: message)
      handle_message_for_response(response)
      notification_payload[:response] = response.body
    rescue Excon::Errors::Timeout => raw_error
      notification_payload[:error] = handle_error(raw_error)
      raise TimeoutError
    rescue Excon::Errors::BadGateway => raw_error
      notification_payload[:error] = handle_error(raw_error)
      raise BadGatewayError
    rescue => raw_error
      processed_error = handle_error(raw_error)
      notification_payload[:error] = processed_error
      raise processed_error
    ensure
      publish("creditsafe.#{message_type}", started, Time.now,
              SecureRandom.hex(10), notification_payload)
    end
def invoke_soap(message_type, message)
      started = Time.now
      notification_payload = { request: message }

      response = client.call(message_type, message: message)
      handle_message_for_response(response)
      notification_payload[:response] = response.body
    rescue Excon::Errors::Timeout => raw_error
      notification_payload[:error] = handle_error(raw_error)
      raise TimeoutError
    rescue Excon::Errors::BadGateway => raw_error
      notification_payload[:error] = handle_error(raw_error)
      raise BadGatewayError
    rescue => raw_error
      processed_error = handle_error(raw_error)
      notification_payload[:error] = processed_error
      raise processed_error
    ensure
      publish("creditsafe.#{message_type}", started, Time.now,
              SecureRandom.hex(10), notification_payload)
    end
rubocop:disable Style/RescueStandardError
 rubocop:disable Metrics/MethodLength
 rubocop:disable Metrics/AbcSize