Sha256: c2dfa973a45c47e1e380753c69fc140def8ce91cd98abf23368b031c88cd1a29

Contents?: true

Size: 1.66 KB

Versions: 15

Compression:

Stored size: 1.66 KB

Contents

# encoding: ASCII-8BIT
require 'helper'
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_xml_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

15 entries across 15 versions & 9 rubygems

Version Path
malagant-soap4r-1.5.8.20141127181857 test/soap/test_extraattr.rb
rtiss_soap4r-1.6.1 test/soap/test_extraattr.rb
rtiss_soap4r-1.6.0 test/soap/test_extraattr.rb
eSpace_soap4r-1.5.8 test/soap/test_extraattr.rb
soap4r-ruby19-1.5.9 test/soap/test_extraattr.rb
tomdz-soap4r-1.5.8.20120202093209 test/soap/test_extraattr.rb
soap5r-2.0.3 test/soap/test_extraattr.rb
soap5r-2.0.2 test/soap/test_extraattr.rb
soap5r-2.0.1 test/soap/test_extraattr.rb
soap5r-2.0.0 test/soap/test_extraattr.rb
soap5r-2.0.0.20120130130121 test/soap/test_extraattr.rb
soap4r-sgonyea-1.5.9 test/soap/test_extraattr.rb
sunteya-soap4r-1.5.8.0 test/soap/test_extraattr.rb
tomdz-soap4r-1.5.8.20111103171510 test/soap/test_extraattr.rb
rubyjedi-soap4r-1.5.8.20100619003610 test/soap/test_extraattr.rb