Class: SOAP::NetHttpClient

Inherits:
Object show all
Defined in:
lib/action_web_service/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.



33
34
35
36
37
38
39
40
# File 'lib/action_web_service/soap/netHttpClient.rb', line 33

def initialize(proxy = nil, agent = nil)
  @proxy = proxy ? URI.parse(proxy) : nil
  @agent = agent
  @debug_dev = nil
  @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.



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

def connect_timeout
  @connect_timeout
end

#debug_devObject

Returns the value of attribute debug_dev.



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

def debug_dev
  @debug_dev
end

#no_proxyObject

Returns the value of attribute no_proxy.



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

def no_proxy
  @no_proxy
end

#protocol_versionObject

ignored for now.



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

def protocol_version
  @protocol_version
end

#proxyObject

Returns the value of attribute proxy.



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

def proxy
  @proxy
end

#receive_timeoutObject

Returns the value of attribute receive_timeout.



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

def receive_timeout
  @receive_timeout
end

#send_timeoutObject

ignored for now.



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

def send_timeout
  @send_timeout
end

#ssl_configObject

ignored for now.



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

def ssl_config
  @ssl_config
end

Instance Method Details

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



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

def get_content(url, header = {})
  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



86
87
88
89
90
91
92
93
94
95
96
# File 'lib/action_web_service/soap/netHttpClient.rb', line 86

def post(url, req_body, header = {})
  unless url.is_a?(URI)
    url = URI.parse(url)
  end
  extra = header.dup
  extra['User-Agent'] = @agent if @agent
  res = start(url) { |http|
    http.post(url.request_uri, req_body, extra)
  }
  Response.new(res)
end

#reset(url) ⇒ Object



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

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

#reset_allObject



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

def reset_all
  # no persistent connection.  ignored.
end

Raises:

  • (NotImplementedError)


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

def save_cookie_store(filename)
  raise NotImplementedError.new
end

#set_basic_auth(uri, user_id, passwd) ⇒ Object

Raises:

  • (NotImplementedError)


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

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)


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

def set_cookie_store(filename)
  raise NotImplementedError.new
end

#test_loopback_responseObject

Raises:

  • (NotImplementedError)


42
43
44
# File 'lib/action_web_service/soap/netHttpClient.rb', line 42

def test_loopback_response
  raise NotImplementedError.new("not supported for now")
end