Module: SOAP::Processor

Defined in:
lib/wss4r/soap/processor.rb

Class Method Summary collapse

Class Method Details

.configObject



40
41
42
43
44
45
46
47
# File 'lib/wss4r/soap/processor.rb', line 40

def config()
  store = WSS4R::Config::Store.new()
  config = store.load()
  if (config != nil)
    @security = WSS4R::Security::Security.new()
    config.build_security(@security)
  end
end

.marshal(env, opt = {}, io = nil) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/wss4r/soap/processor.rb', line 49

def marshal(env,opt = {}, io = nil)
  #config()
  xml = Processor.old_marshal(env, opt, io)

  security = opt[:security]
  if (defined?(@@security) && @@security != nil)
    security = @@security if (@@security)
  end
  document = Document.new(xml)
  if (security != nil)
    security.process_document_marshal(document)
  end
  document.to_s()
end

.old_marshalObject



29
# File 'lib/wss4r/soap/processor.rb', line 29

alias old_marshal marshal

.old_unmarshalObject



30
# File 'lib/wss4r/soap/processor.rb', line 30

alias old_unmarshal unmarshal

.securityObject



35
36
37
38
# File 'lib/wss4r/soap/processor.rb', line 35

def security()
  @@security = WSS4R::Security::Security.new() if (!defined?(@@security))
  @@security
end

.security=(s) ⇒ Object



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

def security=(s)
  @@security = s
end

.unmarshal(stream, opt = {}) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/wss4r/soap/processor.rb', line 64

def unmarshal(stream, opt = {})
  #config()
  security = opt[:security] 
  if (defined?(@@security) && @@security != nil)
    security = @@security if (@@security)
  end
  doc = Document.new(stream)
  if (security != nil)
    SOAPParser::document=(doc)
    soap_ns = doc.root().prefix()
    wsseElement = SOAPParser.part(SOAPParser::SECURITY)
    if (wsseElement != nil)
      security.process_document_unmarshal(doc)
      if (wsseElement.parent() != nil)
        wsseElement.parent().delete_element(wsseElement)
      end
    else
      #TODO: What to do when no security tokens in header?
      #if security.tokens().size() > 0
       # raise Exception.new("No security elements received!")
      #end
    end
  end
  xml = Processor.old_unmarshal(doc.to_s(), opt)
  xml
end