Sha256: 5529a1f31504e6eccc777cf7de120f805f207ae9aee9314cf118aadf016454db

Contents?: true

Size: 1.63 KB

Versions: 30

Compression:

Stored size: 1.63 KB

Contents

require 'test/unit'
require 'soap/processor'


module SOAP


class TestExtrAttr < Test::Unit::TestCase

  HEADER_XML = %q[<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    Id="extraattr"
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <env:Header Id="extraattr">
      <n1:headeritem xmlns:n1="my:foo"
          Id="extraattr"></n1:headeritem>
  </env:Header>
  <env:Body Id="extraattr&lt;&gt;">
    <n2:test xmlns:n2="my:foo"
        Id="extraattr"></n2:test>
  </env:Body>
</env:Envelope>]

  def test_extraattr
    header = SOAP::SOAPHeader.new()
    header.extraattr["Id"] = "extraattr"
    hi = SOAP::SOAPElement.new(XSD::QName.new("my:foo", "headeritem"))
    hi.extraattr["Id"] = "extraattr"
    header.add("test", hi)
    body = SOAP::SOAPBody.new()
    body.extraattr["Id"] = "extraattr<>"
    bi = SOAP::SOAPElement.new(XSD::QName.new("my:foo", "bodyitem"))
    bi.extraattr["Id"] = "extraattr"
    body.add("test", bi)
    env = SOAP::SOAPEnvelope.new(header, body)
    env.extraattr["Id"] = "extraattr"
    g = SOAP::Generator.new()
    xml = g.generate(env)
    assert_equal(HEADER_XML, xml)
    #
    parser = SOAP::Parser.new
    env = parser.parse(xml)
    header = env.header
    body = env.body
    assert_equal("extraattr", env.extraattr[XSD::QName.new(nil, "Id")])
    assert_equal("extraattr", header.extraattr[XSD::QName.new(nil, "Id")])
    assert_equal("extraattr<>", body.extraattr[XSD::QName.new(nil, "Id")])
    assert_equal("extraattr", header["headeritem"].element.extraattr[XSD::QName.new(nil, "Id")])
  end
end


end

Version data entries

30 entries across 30 versions & 13 rubygems

Version Path
mumboe-soap4r-1.6.0.pre.beta test/soap/test_extraattr.rb
DefV-soap4r-1.5.8.2 test/soap/test_extraattr.rb
mumboe-soap4r-1.5.8.7 test/soap/test_extraattr.rb
teo-soap4r-1.5.9b test/soap/test_extraattr.rb
mumboe-soap4r-1.5.8.6 test/soap/test_extraattr.rb
soap4r-spox-1.6.0 test/soap/test_extraattr.rb
soap4r-r19-1.5.9 test/soap/test_extraattr.rb
mumboe-soap4r-1.5.8.5 test/soap/test_extraattr.rb
soap4r-ruby1.9-2.0.5 test/soap/test_extraattr.rb
soap4r-sgonyea-1.6.0 test/soap/test_extraattr.rb
soap4r-straightjacket-1.5.9 test/soap/test_extraattr.rb
soap4r-straightjacket-1.5.8 test/soap/test_extraattr.rb
soap4r-ruby1.9-2.0.3 test/soap/test_extraattr.rb
soap4r-ruby1.9-2.0.2 test/soap/test_extraattr.rb
soap4r-ruby1.9-2.0.1 test/soap/test_extraattr.rb
mumboe-soap4r-1.5.8.4 test/soap/test_extraattr.rb
soap4r-ruby1.9-2.0.0 test/soap/test_extraattr.rb
hands-soap4r-1.5.8.4 test/soap/test_extraattr.rb
soap4r-ruby1.9-1.0.0 test/soap/test_extraattr.rb
snaury-soap4r-1.5.8.1 test/soap/test_extraattr.rb