Class: SOAP::NetHttpClient

Inherits:
Object show all
Defined in:
lib/soap/netHttpClient.rb

Defined Under Namespace

Classes: Response, SessionManager

Constant Summary collapse

SSLEnabled =
begin
  require 'net/https'
  true
rescue LoadError
  false
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(proxy = nil, agent = nil) ⇒ NetHttpClient

Returns a new instance of NetHttpClient.



36
37
38
39
40
41
42
43
44
45
# File 'lib/soap/netHttpClient.rb', line 36

def initialize(proxy = nil, agent = nil)
  @proxy = proxy ? URI.parse(proxy) : nil
  @agent = agent
  @debug_dev = nil
  @test_loopback_response = []
  @request_filter = Filter::FilterChain.new
  @session_manager = SessionManager.new
  @no_proxy = @ssl_config = @protocol_version = nil
  @connect_timeout = @send_timeout = @receive_timeout = nil
end

Instance Attribute Details

#connect_timeoutObject

Returns the value of attribute connect_timeout.



30
31
32
# File 'lib/soap/netHttpClient.rb', line 30

def connect_timeout
  @connect_timeout
end

#debug_devObject

Returns the value of attribute debug_dev.



27
28
29
# File 'lib/soap/netHttpClient.rb', line 27

def debug_dev
  @debug_dev
end

#no_proxyObject

Returns the value of attribute no_proxy.



26
27
28
# File 'lib/soap/netHttpClient.rb', line 26

def no_proxy
  @no_proxy
end

#protocol_versionObject

ignored for now.



29
30
31
# File 'lib/soap/netHttpClient.rb', line 29

def protocol_version
  @protocol_version
end

#proxyObject

Returns the value of attribute proxy.



25
26
27
# File 'lib/soap/netHttpClient.rb', line 25

def proxy
  @proxy
end

#receive_timeoutObject

Returns the value of attribute receive_timeout.



32
33
34
# File 'lib/soap/netHttpClient.rb', line 32

def receive_timeout
  @receive_timeout
end

#request_filterObject (readonly)

ignored for now.



34
35
36
# File 'lib/soap/netHttpClient.rb', line 34

def request_filter
  @request_filter
end

#send_timeoutObject

ignored for now.



31
32
33
# File 'lib/soap/netHttpClient.rb', line 31

def send_timeout
  @send_timeout
end

#ssl_configObject

ignored for now.



28
29
30
# File 'lib/soap/netHttpClient.rb', line 28

def ssl_config
  @ssl_config
end

#test_loopback_responseObject (readonly)

Returns the value of attribute test_loopback_response.



33
34
35
# File 'lib/soap/netHttpClient.rb', line 33

def test_loopback_response
  @test_loopback_response
end

Instance Method Details

#get_content(url, header = {}) ⇒ Object



95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/soap/netHttpClient.rb', line 95

def get_content(url, header = {})
  if str = @test_loopback_response.shift
    return str
  end
  unless url.is_a?(URI)
    url = URI.parse(url)
  end
  extra = header.dup
  extra['User-Agent'] = @agent if @agent
  res = start(url) { |http|
	http.get(url.request_uri, extra)
    }
  res.body
end

#post(url, req_body, header = {}) ⇒ Object



91
92
93
# File 'lib/soap/netHttpClient.rb', line 91

def post(url, req_body, header = {})
  post_redirect(url, req_body, header, 10)
end

#reset(url) ⇒ Object



83
84
85
# File 'lib/soap/netHttpClient.rb', line 83

def reset(url)
  # no persistent connection.  ignored.
end

#reset_allObject



87
88
89
# File 'lib/soap/netHttpClient.rb', line 87

def reset_all
  # no persistent connection.  ignored.
end

Raises:

  • (NotImplementedError)


79
80
81
# File 'lib/soap/netHttpClient.rb', line 79

def save_cookie_store(filename)
  raise NotImplementedError.new
end

#set_auth(uri, user_id, passwd) ⇒ Object

Raises:

  • (NotImplementedError)


65
66
67
# File 'lib/soap/netHttpClient.rb', line 65

def set_auth(uri, user_id, passwd)
  raise NotImplementedError.new("auth is not supported under soap4r + net/http.")
end

#set_basic_auth(uri, user_id, passwd) ⇒ Object

Raises:

  • (NotImplementedError)


69
70
71
72
73
# File 'lib/soap/netHttpClient.rb', line 69

def set_basic_auth(uri, user_id, passwd)
  # net/http does not handle url.
  @basic_auth = [user_id, passwd]
  raise NotImplementedError.new("basic_auth is not supported under soap4r + net/http.")
end

Raises:

  • (NotImplementedError)


75
76
77
# File 'lib/soap/netHttpClient.rb', line 75

def set_cookie_store(filename)
  raise NotImplementedError.new
end