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

root/trunk/test/soap/test_extraattr.rb

Revision 1973, 1.6 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.
Line 
1 require 'test/unit'
2 require 'soap/processor'
3
4
5 module SOAP
6
7
8 class TestExtrAttr < Test::Unit::TestCase
9
10   HEADER_XML = %q[<?xml version="1.0" encoding="utf-8" ?>
11 <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
12     Id="extraattr"
13     xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
14     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
15   <env:Header Id="extraattr">
16       <n1:headeritem xmlns:n1="my:foo"
17           Id="extraattr"></n1:headeritem>
18   </env:Header>
19   <env:Body Id="extraattr&lt;&gt;">
20     <n2:test xmlns:n2="my:foo"
21         Id="extraattr"></n2:test>
22   </env:Body>
23 </env:Envelope>]
24
25   def test_extraattr
26     header = SOAP::SOAPHeader.new()
27     header.extraattr["Id"] = "extraattr"
28     hi = SOAP::SOAPElement.new(XSD::QName.new("my:foo", "headeritem"))
29     hi.extraattr["Id"] = "extraattr"
30     header.add("test", hi)
31     body = SOAP::SOAPBody.new()
32     body.extraattr["Id"] = "extraattr<>"
33     bi = SOAP::SOAPElement.new(XSD::QName.new("my:foo", "bodyitem"))
34     bi.extraattr["Id"] = "extraattr"
35     body.add("test", bi)
36     env = SOAP::SOAPEnvelope.new(header, body)
37     env.extraattr["Id"] = "extraattr"
38     g = SOAP::Generator.new()
39     xml = g.generate(env)
40     assert_equal(HEADER_XML, xml)
41     #
42     parser = SOAP::Parser.new
43     env = parser.parse(xml)
44     header = env.header
45     body = env.body
46     assert_equal("extraattr", env.extraattr[XSD::QName.new(nil, "Id")])
47     assert_equal("extraattr", header.extraattr[XSD::QName.new(nil, "Id")])
48     assert_equal("extraattr<>", body.extraattr[XSD::QName.new(nil, "Id")])
49     assert_equal("extraattr", header["headeritem"].element.extraattr[XSD::QName.new(nil, "Id")])
50   end
51 end
52
53
54 end
Note: See TracBrowser for help on using the browser.