Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

root/trunk/lib/soap/header/handler.rb

Revision 1973, 1.3 kB (checked in by nahi, 1 year ago)
  • allow to remove mustUnderstand attribute from a SOAP Header. I heard that there's an implementation which cannot handle mustUnderstand existence. closes #429.
  • Property svn:eol-style set to native
  • Property svn:keywords set to author date id revision
Line 
1 # SOAP4R - SOAP Header handler item
2 # Copyright (C) 2000-2007  NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
3
4 # This program is copyrighted free software by NAKAMURA, Hiroshi.  You can
5 # redistribute it and/or modify it under the same terms of Ruby's license;
6 # either the dual license version in 2003, or any later version.
7
8
9 require 'soap/element'
10
11
12 module SOAP
13 module Header
14
15
16 class Handler
17   attr_reader :elename
18   attr_accessor :mustunderstand
19   attr_reader :encodingstyle
20   attr_reader :target_actor
21
22   def initialize(elename)
23     @elename = elename
24     @mustunderstand = false
25     @encodingstyle = nil
26     @target_actor = nil
27   end
28
29   # Should return a SOAP/OM, a SOAPHeaderItem or nil.
30   def on_outbound
31     nil
32   end
33
34   # Given header is a SOAPHeaderItem or nil.
35   def on_inbound(header, mustunderstand = false)
36     # do something.
37   end
38
39   def on_outbound_headeritem(header)
40     arity = self.method(:on_outbound).arity
41     item = (arity == 0) ? on_outbound : on_outbound(header)
42     if item.nil?
43       nil
44     elsif item.is_a?(::SOAP::SOAPHeaderItem)
45       item.elename = @elename
46       item
47     else
48       item.elename = @elename
49       ::SOAP::SOAPHeaderItem.new(item, @mustunderstand, @encodingstyle,
50         @target_actor)
51     end
52   end
53
54   def on_inbound_headeritem(header, item)
55     on_inbound(item.element, item.mustunderstand)
56   end
57 end
58
59
60 end
61 end
Note: See TracBrowser for help on using the browser.