Module: Sem4rSoap::SoapDumper

Included in:
HttpConnector::ConnectorHttpClient, HttpConnector::ConnectorNetHttp
Defined in:
lib/sem4r_soap/soap_dumper.rb

Instance Method Summary collapse

Instance Method Details

#dump_soap_options(options) ⇒ Object

set the options for the dumping soap message

Parameters:

Options Hash (options):



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/sem4r_soap/soap_dumper.rb', line 43

def dump_soap_options(options)
  @soap_dump     = true
  @soap_dump_log = nil

  if options[:directory]
    @soap_dump_dir = options[:directory]
  else
    @soap_dump_log = File.open(options[:file], "w")
  end
  @soap_dump_format = false || options[:format]

  @soap_dump_interceptor = options[:interceptor] if options[:interceptor]
end

#dump_soap_request(service_url, request_xml) ⇒ Object

TODO: request_xml might be a doc object as Nokogiri::doc



58
59
60
61
62
63
64
65
66
67
# File 'lib/sem4r_soap/soap_dumper.rb', line 58

def dump_soap_request(service_url, request_xml)
  return unless @soap_dump
  %w{email password developerToken authToken clientEmail}.each do |tag|
    request_xml = request_xml.gsub(/<#{tag}([^>]*)>.*<\/#{tag}>/, "<#{tag}\\1>***censured***</#{tag}>")
  end
  str = ""
  str << "<!-- Post to '#{service_url}' -->\n"
  str << xml_to_s(request_xml) << "\n"
  dump(service_url, "req", str)
end

#dump_soap_response(service_url, response_xml) ⇒ Object

TODO: response_xml might be a doc object as Nokogiri::doc



70
71
72
73
74
75
76
77
78
# File 'lib/sem4r_soap/soap_dumper.rb', line 70

def dump_soap_response(service_url, response_xml)
  return unless @soap_dump
  response_xml.gsub(/<email[^>]*>.+<\/email>/, "<email>**censured**</email>")
  str = ""
  str << "<!-- response -->\n" unless @soap_dump_dir
  str << xml_to_s(response_xml) << "\n"
  str << "<!-- end -->" unless @soap_dump_dir
  dump(service_url, "res", str)
end

#initializeObject



29
30
31
32
# File 'lib/sem4r_soap/soap_dumper.rb', line 29

def initialize
  @soap_dump     = false
  @soap_dump_log = nil
end