Class: Savon::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/savon/request.rb

Constant Summary collapse

CONTENT_TYPE =
{
  1 => "text/xml;charset=%s",
  2 => "application/soap+xml;charset=%s"
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operation_name, wsdl, globals, locals) ⇒ Request

Returns a new instance of Request.



13
14
15
16
17
18
19
20
# File 'lib/savon/request.rb', line 13

def initialize(operation_name, wsdl, globals, locals)
  @operation_name = operation_name

  @wsdl    = wsdl
  @globals = globals
  @locals  = locals
  @http    = create_http_client
end

Instance Attribute Details

#httpObject (readonly)

Returns the value of attribute http.



22
23
24
# File 'lib/savon/request.rb', line 22

def http
  @http
end

Instance Method Details

#call(xml) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/savon/request.rb', line 24

def call(xml)
  @http.body = xml
  @http.headers["Content-Length"] = xml.bytesize.to_s

  log_request @http.url, @http.headers, @http.body
  response = HTTPI.post(@http)
  log_response response.code, response.body

  response
end