3
require 'wsdl/soap/wsdl2ruby'
4
require 'soap/rpc/standaloneServer'
5
require 'soap/wsdlDriver'
6
require 'soap/rpc/driver'
9
module WSDL; module Document
12
class TestNoSOAPAction < Test::Unit::TestCase
13
class Server < ::SOAP::RPC::StandaloneServer
14
Namespace = 'http://xmlsoap.org/Ping'
20
'ping_with_soapaction',
21
XSD::QName.new(Namespace, 'Ping'),
22
XSD::QName.new(Namespace, 'PingResponse')
29
XSD::QName.new(Namespace, 'Ping'),
30
XSD::QName.new(Namespace, 'PingResponse')
33
# When no SOAPAction given, latter method(ping) is called.
41
def ping_with_soapaction(arg)
42
arg.text = 'ping_with_soapaction'
47
DIR = File.dirname(File.expand_path(__FILE__))
58
@client.reset_stream if @client
62
@server = Server.new('Test', Server::Namespace, '0.0.0.0', Port)
63
@server.level = Logger::Severity::ERROR
64
@server_thread = start_server_thread(@server)
73
def start_server_thread(server)
75
Thread.current.abort_on_exception = true
81
def test_with_soapaction
82
wsdl = File.join(DIR, 'ping_nosoapaction.wsdl')
83
@client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
84
@client.endpoint_url = "http://localhost:#{Port}/"
85
@client.wiredump_dev = STDOUT if $DEBUG
86
rv = @client.ping(:scenario => 'scenario', :origin => 'origin',
88
assert_equal('scenario', rv.scenario)
89
assert_equal('origin', rv.origin)
90
assert_equal('ping', rv.text)
93
def test_without_soapaction
94
@client = ::SOAP::RPC::Driver.new("http://localhost:#{Port}/",
96
@client.add_document_method('ping', Server::Namespace + '/ping',
97
XSD::QName.new(Server::Namespace, 'Ping'),
98
XSD::QName.new(Server::Namespace, 'PingResponse'))
99
@client.wiredump_dev = STDOUT if $DEBUG
100
rv = @client.ping(:scenario => 'scenario', :origin => 'origin',
102
assert_equal('scenario', rv.scenario)
103
assert_equal('origin', rv.origin)
104
assert_equal('ping_with_soapaction', rv.text)