def route(conn_data)
env = unmarshal(conn_data)
if env.nil?
raise ArgumentError.new("illegal SOAP marshal format")
end
op = lookup_operation(conn_data.soapaction, env.body)
headerhandler = @headerhandler.dup
@headerhandlerfactory.each do |f|
headerhandler.add(f.create)
end
soap_response = default_encodingstyle = nil
begin
receive_headers(headerhandler, env.header)
soap_response =
op.call(env.body, @mapping_registry, @literal_mapping_registry,
create_mapping_opt)
conn_data.is_fault = true if soap_response.is_a?(SOAPFault)
default_encodingstyle = op.response_default_encodingstyle
rescue Exception => e
wsdl_fault_details = op.faults && op.faults[e.class.name]
soap_response = fault(e, wsdl_fault_details)
conn_data.is_fault = true
default_encodingstyle = nil
end
header = call_headers(headerhandler)
if op.response_use.nil?
conn_data.send_string = ''
conn_data.is_nocontent = true
conn_data
else
body = SOAPBody.new(soap_response, conn_data.is_fault)
env = SOAPEnvelope.new(header, body)
marshal(conn_data, env, default_encodingstyle)
end
end