Sha256: 10384a0903b0aed1b8ea4af83eaf985631409bc0cf3a3598bf5a1cd4cc1e38c7

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require 'test/unit'
require 'soap/rpc/standaloneServer'
require 'soap/rpc/driver'
require 'soap/header/handler'


module SOAP


class TestNil < Test::Unit::TestCase
  Port = 17171

  class NilServer < SOAP::RPC::StandaloneServer
    def initialize(*arg)
      super
      add_method(self, 'nop')
    end

    def nop
      1
    end
  end

  def setup
    @server = NilServer.new(self.class.name, nil, '0.0.0.0', Port)
    @server.level = Logger::Severity::ERROR
    @t = Thread.new {
      @server.start
    }
    @endpoint = "http://localhost:#{Port}/"
    @client = SOAP::RPC::Driver.new(@endpoint)
    @client.add_rpc_method('nop')
  end

  def teardown
    @server.shutdown
    @t.kill
    @t.join
    @client.reset_stream
  end

  require 'rexml/document'
  # emulates SOAP::Lite's nil request
  def test_soaplite_nil
    body = SOAP::SOAPBody.new(REXML::Document.new(<<-__XML__))
      <nop xsi:nil="true"/>
    __XML__
    @client.wiredump_dev = STDOUT if $DEBUG
    header, body = @client.invoke(nil, body)
    assert_equal(1, body.root_node["return"].data)
  end
end


end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
soap4r-1.5.7 test/soap/test_nil.rb