mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
This commit was manufactured by cvs2svn to create branch 'ruby_1_8'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b8bc87839d
commit
caf6ad3a76
29 changed files with 2953 additions and 0 deletions
96
test/soap/asp.net/hello.wsdl
Normal file
96
test/soap/asp.net/hello.wsdl
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
|
||||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||
xmlns:s="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:tns="http://localhost/WebService/"
|
||||
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
|
||||
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
|
||||
targetNamespace="http://localhost/WebService/"
|
||||
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
|
||||
<wsdl:types>
|
||||
<s:schema elementFormDefault="qualified"
|
||||
targetNamespace="http://localhost/WebService/">
|
||||
<s:element name="HelloWorld">
|
||||
<s:complexType />
|
||||
</s:element>
|
||||
<s:element name="HelloWorldResponse">
|
||||
<s:complexType>
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1"
|
||||
name="HelloWorldResult" type="s:string" />
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
</s:element>
|
||||
<s:element name="SayHello">
|
||||
<s:complexType>
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1" name="name"
|
||||
type="s:string" />
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
</s:element>
|
||||
<s:element name="SayHelloResponse">
|
||||
<s:complexType>
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1"
|
||||
name="SayHelloResult" type="s:string" />
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
</s:element>
|
||||
</s:schema>
|
||||
</wsdl:types>
|
||||
<wsdl:message name="HelloWorldSoapIn">
|
||||
<wsdl:part name="parameters" element="tns:HelloWorld" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="HelloWorldSoapOut">
|
||||
<wsdl:part name="parameters" element="tns:HelloWorldResponse" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="SayHelloSoapIn">
|
||||
<wsdl:part name="parameters" element="tns:SayHello" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="SayHelloSoapOut">
|
||||
<wsdl:part name="parameters" element="tns:SayHelloResponse" />
|
||||
</wsdl:message>
|
||||
<wsdl:portType name="Service1Soap">
|
||||
<wsdl:operation name="HelloWorld">
|
||||
<wsdl:input message="tns:HelloWorldSoapIn" />
|
||||
<wsdl:output message="tns:HelloWorldSoapOut" />
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="SayHello">
|
||||
<wsdl:input message="tns:SayHelloSoapIn" />
|
||||
<wsdl:output message="tns:SayHelloSoapOut" />
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
<wsdl:binding name="Service1Soap" type="tns:Service1Soap">
|
||||
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
|
||||
style="document" />
|
||||
<wsdl:operation name="HelloWorld">
|
||||
<soap:operation
|
||||
soapAction="http://localhost/WebService/HelloWorld" style="document" />
|
||||
<wsdl:input>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="SayHello">
|
||||
<soap:operation soapAction="http://localhost/WebService/SayHello"
|
||||
style="document" />
|
||||
<wsdl:input>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:binding>
|
||||
<wsdl:service name="Service1">
|
||||
<documentation xmlns="http://schemas.xmlsoap.org/wsdl/" />
|
||||
<wsdl:port name="Service1Soap" binding="tns:Service1Soap">
|
||||
<soap:address
|
||||
location="http://localhost/WebService/Service1.asmx" />
|
||||
</wsdl:port>
|
||||
</wsdl:service>
|
||||
</wsdl:definitions>
|
||||
111
test/soap/asp.net/test_aspdotnet.rb
Normal file
111
test/soap/asp.net/test_aspdotnet.rb
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
require 'test/unit'
|
||||
require 'soap/rpc/standaloneServer'
|
||||
require 'soap/rpc/driver'
|
||||
|
||||
|
||||
module SOAP; module ASPDotNet
|
||||
|
||||
|
||||
class TestASPDotNet < Test::Unit::TestCase
|
||||
class Server < ::SOAP::RPC::StandaloneServer
|
||||
Namespace = "http://localhost/WebService/"
|
||||
|
||||
def on_init
|
||||
add_document_method(
|
||||
self,
|
||||
Namespace + 'SayHello',
|
||||
'sayHello',
|
||||
XSD::QName.new(Namespace, 'SayHello'),
|
||||
XSD::QName.new(Namespace, 'SayHelloResponse')
|
||||
)
|
||||
end
|
||||
|
||||
def sayHello(arg)
|
||||
name = arg['name']
|
||||
"Hello #{name}"
|
||||
end
|
||||
end
|
||||
|
||||
Port = 17171
|
||||
Endpoint = "http://localhost:#{Port}/"
|
||||
|
||||
def setup
|
||||
setup_server
|
||||
@client = nil
|
||||
end
|
||||
|
||||
def teardown
|
||||
teardown_server
|
||||
@client.reset_stream if @client
|
||||
end
|
||||
|
||||
def setup_server
|
||||
@server = Server.new('Test', Server::Namespace, '0.0.0.0', Port)
|
||||
@server.level = Logger::Severity::ERROR
|
||||
@server_thread = start_server_thread(@server)
|
||||
end
|
||||
|
||||
def teardown_server
|
||||
@server.shutdown
|
||||
@server_thread.kill
|
||||
@server_thread.join
|
||||
end
|
||||
|
||||
def start_server_thread(server)
|
||||
t = Thread.new {
|
||||
Thread.current.abort_on_exception = true
|
||||
server.start
|
||||
}
|
||||
t
|
||||
end
|
||||
|
||||
def test_document_method
|
||||
@client = SOAP::RPC::Driver.new(Endpoint, Server::Namespace)
|
||||
@client.wiredump_dev = STDOUT if $DEBUG
|
||||
@client.add_document_method('sayHello', Server::Namespace + 'SayHello',
|
||||
XSD::QName.new(Server::Namespace, 'SayHello'),
|
||||
XSD::QName.new(Server::Namespace, 'SayHelloResponse'))
|
||||
assert_equal("Hello Mike", @client.sayHello(:name => "Mike"))
|
||||
end
|
||||
|
||||
def test_aspdotnethandler
|
||||
@client = SOAP::RPC::Driver.new(Endpoint, Server::Namespace)
|
||||
@client.wiredump_dev = STDOUT if $DEBUG
|
||||
@client.add_method_with_soapaction('sayHello', Server::Namespace + 'SayHello', 'name')
|
||||
@client.default_encodingstyle = SOAP::EncodingStyle::ASPDotNetHandler::Namespace
|
||||
assert_equal("Hello Mike", @client.sayHello("Mike"))
|
||||
end
|
||||
|
||||
if defined?(HTTPAccess2)
|
||||
|
||||
# qualified!
|
||||
REQUEST_ASPDOTNETHANDLER =
|
||||
%q[<?xml version="1.0" encoding="utf-8" ?>
|
||||
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<env:Body>
|
||||
<n1:sayHello xmlns:n1="http://localhost/WebService/">
|
||||
<n1:name>Mike</n1:name>
|
||||
</n1:sayHello>
|
||||
</env:Body>
|
||||
</env:Envelope>]
|
||||
|
||||
def test_aspdotnethandler_envelope
|
||||
@client = SOAP::RPC::Driver.new(Endpoint, Server::Namespace)
|
||||
@client.wiredump_dev = str = ''
|
||||
@client.add_method_with_soapaction('sayHello', Server::Namespace + 'SayHello', 'name')
|
||||
@client.default_encodingstyle = SOAP::EncodingStyle::ASPDotNetHandler::Namespace
|
||||
assert_equal("Hello Mike", @client.sayHello("Mike"))
|
||||
assert_equal(REQUEST_ASPDOTNETHANDLER, parse_requestxml(str))
|
||||
end
|
||||
|
||||
def parse_requestxml(str)
|
||||
str.split(/\r?\n\r?\n/)[3]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end; end
|
||||
116
test/soap/header/test_simplehandler.rb
Normal file
116
test/soap/header/test_simplehandler.rb
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
require 'test/unit'
|
||||
require 'soap/rpc/driver'
|
||||
require 'soap/rpc/standaloneServer'
|
||||
require 'soap/header/simplehandler'
|
||||
|
||||
|
||||
module SOAP
|
||||
module Header
|
||||
|
||||
|
||||
class TestSimpleHandler < Test::Unit::TestCase
|
||||
Port = 17171
|
||||
PortName = 'http://tempuri.org/authHeaderPort'
|
||||
|
||||
class PingPortServer < SOAP::RPC::StandaloneServer
|
||||
class PingService
|
||||
def self.create
|
||||
new
|
||||
end
|
||||
|
||||
def ping
|
||||
Thread.current[:pingheader]
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(*arg)
|
||||
super
|
||||
add_rpc_servant(PingService.new, PortName)
|
||||
add_request_headerhandler(PingServerHeaderHandler)
|
||||
end
|
||||
|
||||
class PingServerHeaderHandler < SOAP::Header::SimpleHandler
|
||||
MyHeaderName = XSD::QName.new("http://xmlsoap.org/Ping", "PingHeader")
|
||||
|
||||
def self.create
|
||||
new
|
||||
end
|
||||
|
||||
def initialize()
|
||||
super(MyHeaderName)
|
||||
end
|
||||
|
||||
def on_simple_outbound
|
||||
"dummy"
|
||||
end
|
||||
|
||||
def on_simple_inbound(my_header, mu)
|
||||
Thread.current[:pingheader] = my_header
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class PingClientHeaderHandler < SOAP::Header::SimpleHandler
|
||||
MyHeaderName = XSD::QName.new("http://xmlsoap.org/Ping", "PingHeader")
|
||||
|
||||
def initialize(pingHeader)
|
||||
super(MyHeaderName)
|
||||
@pingHeader = pingHeader
|
||||
@mustunderstand = false
|
||||
end
|
||||
|
||||
def on_simple_outbound
|
||||
@pingHeader # --- note, not a Hash
|
||||
end
|
||||
|
||||
def on_simple_inbound(my_header, mustunderstand)
|
||||
Thread.current[:pingheader] = my_header
|
||||
end
|
||||
end
|
||||
|
||||
def setup
|
||||
@endpoint = "http://localhost:#{Port}/"
|
||||
setup_server
|
||||
setup_client
|
||||
end
|
||||
|
||||
def setup_server
|
||||
@server = PingPortServer.new(self.class.name, nil, '0.0.0.0', Port)
|
||||
@server.level = Logger::Severity::ERROR
|
||||
@t = Thread.new {
|
||||
@server.start
|
||||
}
|
||||
end
|
||||
|
||||
def setup_client
|
||||
@client = SOAP::RPC::Driver.new(@endpoint, PortName)
|
||||
@client.wiredump_dev = STDERR if $DEBUG
|
||||
@client.add_method('ping')
|
||||
end
|
||||
|
||||
def teardown
|
||||
teardown_server
|
||||
teardown_client
|
||||
end
|
||||
|
||||
def teardown_server
|
||||
@server.shutdown
|
||||
@t.kill
|
||||
@t.join
|
||||
end
|
||||
|
||||
def teardown_client
|
||||
@client.reset_stream
|
||||
end
|
||||
|
||||
def test_string
|
||||
h = PingClientHeaderHandler.new('pingheader')
|
||||
@client.headerhandler << h
|
||||
assert_equal("pingheader", @client.ping)
|
||||
assert_equal("dummy", Thread.current[:pingheader])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
92
test/soap/test_envelopenamespace.rb
Normal file
92
test/soap/test_envelopenamespace.rb
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
require 'test/unit'
|
||||
require 'soap/rpc/driver'
|
||||
require 'webrick'
|
||||
require 'logger'
|
||||
|
||||
|
||||
module SOAP
|
||||
|
||||
|
||||
class TestEnvelopeNamespace < Test::Unit::TestCase
|
||||
Port = 17171
|
||||
TemporaryNamespace = 'urn:foo'
|
||||
|
||||
def setup
|
||||
@logger = Logger.new(STDERR)
|
||||
@logger.level = Logger::Severity::ERROR
|
||||
@url = "http://localhost:#{Port}/"
|
||||
@server = @client = nil
|
||||
@server_thread = nil
|
||||
setup_server
|
||||
setup_client
|
||||
end
|
||||
|
||||
def teardown
|
||||
teardown_client
|
||||
teardown_server
|
||||
end
|
||||
|
||||
def setup_server
|
||||
@server = WEBrick::HTTPServer.new(
|
||||
:BindAddress => "0.0.0.0",
|
||||
:Logger => @logger,
|
||||
:Port => Port,
|
||||
:AccessLog => [],
|
||||
:DocumentRoot => File.dirname(File.expand_path(__FILE__))
|
||||
)
|
||||
@server.mount(
|
||||
'/',
|
||||
WEBrick::HTTPServlet::ProcHandler.new(method(:do_server_proc).to_proc)
|
||||
)
|
||||
@server_thread = start_server_thread(@server)
|
||||
end
|
||||
|
||||
def setup_client
|
||||
@client = SOAP::RPC::Driver.new(@url, '')
|
||||
@client.add_method("do_server_proc")
|
||||
end
|
||||
|
||||
def teardown_server
|
||||
@server.shutdown
|
||||
@server_thread.kill
|
||||
@server_thread.join
|
||||
end
|
||||
|
||||
def teardown_client
|
||||
@client.reset_stream
|
||||
end
|
||||
|
||||
def start_server_thread(server)
|
||||
t = Thread.new {
|
||||
Thread.current.abort_on_exception = true
|
||||
server.start
|
||||
}
|
||||
t
|
||||
end
|
||||
|
||||
def do_server_proc(req, res)
|
||||
res['content-type'] = 'text/xml'
|
||||
res.body = <<__EOX__
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<env:Envelope xmlns:env="#{TemporaryNamespace}">
|
||||
<env:Body>
|
||||
<n1:do_server_proc xmlns:n1="urn:foo" env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<return>hello world</return>
|
||||
</n1:do_server_proc>
|
||||
</env:Body>
|
||||
</env:Envelope>
|
||||
__EOX__
|
||||
end
|
||||
|
||||
def test_normal
|
||||
assert_raise(SOAP::ResponseFormatError) do
|
||||
@client.do_server_proc
|
||||
end
|
||||
@client.options["soap.envelope.requestnamespace"] = TemporaryNamespace
|
||||
@client.options["soap.envelope.responsenamespace"] = TemporaryNamespace
|
||||
assert_equal('hello world', @client.do_server_proc)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
39
test/soap/test_httpconfigloader.rb
Normal file
39
test/soap/test_httpconfigloader.rb
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
require 'test/unit'
|
||||
require 'soap/httpconfigloader'
|
||||
require 'soap/rpc/driver'
|
||||
|
||||
if defined?(HTTPAccess2)
|
||||
|
||||
module SOAP
|
||||
|
||||
|
||||
class TestHTTPConfigLoader < Test::Unit::TestCase
|
||||
DIR = File.dirname(File.expand_path(__FILE__))
|
||||
|
||||
def setup
|
||||
@client = SOAP::RPC::Driver.new(nil, nil)
|
||||
end
|
||||
|
||||
def test_property
|
||||
testpropertyname = File.join(DIR, 'soapclient.properties')
|
||||
File.open(testpropertyname, "w") do |f|
|
||||
f <<<<__EOP__
|
||||
protocol.http.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
||||
# depth: 1 causes an error (intentional)
|
||||
protocol.http.ssl_config.verify_depth = 1
|
||||
protocol.http.ssl_config.ciphers = ALL
|
||||
__EOP__
|
||||
end
|
||||
begin
|
||||
@client.loadproperty(testpropertyname)
|
||||
assert_equal('ALL', @client.options['protocol.http.ssl_config.ciphers'])
|
||||
ensure
|
||||
File.unlink(testpropertyname)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
86
test/soap/test_no_indent.rb
Normal file
86
test/soap/test_no_indent.rb
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
require 'test/unit'
|
||||
require 'soap/rpc/standaloneServer'
|
||||
require 'soap/rpc/driver'
|
||||
|
||||
if defined?(HTTPAccess2)
|
||||
|
||||
module SOAP
|
||||
|
||||
|
||||
class TestNoIndent < Test::Unit::TestCase
|
||||
Port = 17171
|
||||
|
||||
class NopServer < SOAP::RPC::StandaloneServer
|
||||
def initialize(*arg)
|
||||
super
|
||||
add_rpc_method(self, 'nop')
|
||||
end
|
||||
|
||||
def nop
|
||||
SOAP::RPC::SOAPVoid.new
|
||||
end
|
||||
end
|
||||
|
||||
def setup
|
||||
@server = NopServer.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
|
||||
|
||||
INDENT_XML =
|
||||
%q[<?xml version="1.0" encoding="utf-8" ?>
|
||||
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<env:Body>
|
||||
<nop env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
</nop>
|
||||
</env:Body>
|
||||
</env:Envelope>]
|
||||
|
||||
NO_INDENT_XML =
|
||||
%q[<?xml version="1.0" encoding="utf-8" ?>
|
||||
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<env:Body>
|
||||
<nop env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
</nop>
|
||||
</env:Body>
|
||||
</env:Envelope>]
|
||||
|
||||
def test_indent
|
||||
@client.wiredump_dev = str = ''
|
||||
@client.options["soap.envelope.no_indent"] = false
|
||||
@client.nop
|
||||
assert_equal(INDENT_XML, parse_requestxml(str))
|
||||
end
|
||||
|
||||
def test_no_indent
|
||||
@client.wiredump_dev = str = ''
|
||||
@client.options["soap.envelope.no_indent"] = true
|
||||
@client.nop
|
||||
assert_equal(NO_INDENT_XML, parse_requestxml(str))
|
||||
end
|
||||
|
||||
def parse_requestxml(str)
|
||||
str.split(/\r?\n\r?\n/)[3]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
50
test/wsdl/any/any.wsdl
Normal file
50
test/wsdl/any/any.wsdl
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<definitions name="echo"
|
||||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:tns="urn:example.com:echo"
|
||||
xmlns:txd="urn:example.com:echo-type"
|
||||
targetNamespace="urn:example.com:echo"
|
||||
xmlns="http://schemas.xmlsoap.org/wsdl/">
|
||||
<types>
|
||||
<xsd:schema targetNamespace="urn:example.com:echo-type">
|
||||
<xsd:complexType name="foo.bar">
|
||||
<xsd:sequence>
|
||||
<xsd:any />
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:schema>
|
||||
</types>
|
||||
|
||||
<message name="msg_echoitem">
|
||||
<part name="echoitem" type="txd:foo.bar"/>
|
||||
</message>
|
||||
|
||||
<portType name="echo_port_type">
|
||||
<operation name="echo">
|
||||
<input message="tns:msg_echoitem"/>
|
||||
<output message="tns:msg_echoitem"/>
|
||||
</operation>
|
||||
</portType>
|
||||
|
||||
<binding name="echo_binding" type="tns:echo_port_type">
|
||||
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
|
||||
<operation name="echo">
|
||||
<soap:operation soapAction="urn:example.com:echo"/>
|
||||
<input>
|
||||
<soap:body use="encoded" namespace="urn:example.com:echo"
|
||||
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</input>
|
||||
<output>
|
||||
<soap:body use="encoded" namespace="urn:example.com:echo"
|
||||
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</output>
|
||||
</operation>
|
||||
</binding>
|
||||
|
||||
<service name="echo_service">
|
||||
<port name="echo_port" binding="tns:echo_binding">
|
||||
<soap:address location="http://localhost:10080"/>
|
||||
</port>
|
||||
</service>
|
||||
</definitions>
|
||||
54
test/wsdl/any/expectedDriver.rb
Normal file
54
test/wsdl/any/expectedDriver.rb
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
require 'echo.rb'
|
||||
|
||||
require 'soap/rpc/driver'
|
||||
|
||||
class Echo_port_type < ::SOAP::RPC::Driver
|
||||
DefaultEndpointUrl = "http://localhost:10080"
|
||||
MappingRegistry = ::SOAP::Mapping::Registry.new
|
||||
|
||||
MappingRegistry.set(
|
||||
FooBar,
|
||||
::SOAP::SOAPStruct,
|
||||
::SOAP::Mapping::Registry::TypedStructFactory,
|
||||
{ :type => XSD::QName.new("urn:example.com:echo-type", "foo.bar") }
|
||||
)
|
||||
|
||||
Methods = [
|
||||
[ XSD::QName.new("urn:example.com:echo", "echo"),
|
||||
"urn:example.com:echo",
|
||||
"echo",
|
||||
[ ["in", "echoitem", ["FooBar", "urn:example.com:echo-type", "foo.bar"]],
|
||||
["retval", "echoitem", ["FooBar", "urn:example.com:echo-type", "foo.bar"]] ],
|
||||
{ :request_style => :rpc, :request_use => :encoded,
|
||||
:response_style => :rpc, :response_use => :encoded }
|
||||
]
|
||||
]
|
||||
|
||||
def initialize(endpoint_url = nil)
|
||||
endpoint_url ||= DefaultEndpointUrl
|
||||
super(endpoint_url, nil)
|
||||
self.mapping_registry = MappingRegistry
|
||||
init_methods
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def init_methods
|
||||
Methods.each do |definitions|
|
||||
opt = definitions.last
|
||||
if opt[:request_style] == :document
|
||||
add_document_operation(*definitions)
|
||||
else
|
||||
add_rpc_operation(*definitions)
|
||||
qname = definitions[0]
|
||||
name = definitions[2]
|
||||
if qname.name != name and qname.name.capitalize == name.capitalize
|
||||
::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
|
||||
__send__(name, *arg)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
14
test/wsdl/any/expectedEcho.rb
Normal file
14
test/wsdl/any/expectedEcho.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
require 'xsd/qname'
|
||||
|
||||
# {urn:example.com:echo-type}foo.bar
|
||||
class FooBar
|
||||
@@schema_type = "foo.bar"
|
||||
@@schema_ns = "urn:example.com:echo-type"
|
||||
@@schema_element = [["any", [nil, XSD::QName.new(nil, "any")]]]
|
||||
|
||||
attr_accessor :any
|
||||
|
||||
def initialize(any = nil)
|
||||
@any = any
|
||||
end
|
||||
end
|
||||
52
test/wsdl/any/expectedService.rb
Normal file
52
test/wsdl/any/expectedService.rb
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/env ruby
|
||||
require 'echoServant.rb'
|
||||
|
||||
require 'soap/rpc/standaloneServer'
|
||||
require 'soap/mapping/registry'
|
||||
|
||||
class Echo_port_type
|
||||
MappingRegistry = ::SOAP::Mapping::Registry.new
|
||||
|
||||
MappingRegistry.set(
|
||||
FooBar,
|
||||
::SOAP::SOAPStruct,
|
||||
::SOAP::Mapping::Registry::TypedStructFactory,
|
||||
{ :type => XSD::QName.new("urn:example.com:echo-type", "foo.bar") }
|
||||
)
|
||||
|
||||
Methods = [
|
||||
[ XSD::QName.new("urn:example.com:echo", "echo"),
|
||||
"urn:example.com:echo",
|
||||
"echo",
|
||||
[ ["in", "echoitem", ["FooBar", "urn:example.com:echo-type", "foo.bar"]],
|
||||
["retval", "echoitem", ["FooBar", "urn:example.com:echo-type", "foo.bar"]] ],
|
||||
{ :request_style => :rpc, :request_use => :encoded,
|
||||
:response_style => :rpc, :response_use => :encoded }
|
||||
]
|
||||
]
|
||||
end
|
||||
|
||||
class Echo_port_typeApp < ::SOAP::RPC::StandaloneServer
|
||||
def initialize(*arg)
|
||||
super(*arg)
|
||||
servant = Echo_port_type.new
|
||||
Echo_port_type::Methods.each do |definitions|
|
||||
opt = definitions.last
|
||||
if opt[:request_style] == :document
|
||||
@router.add_document_operation(servant, *definitions)
|
||||
else
|
||||
@router.add_rpc_operation(servant, *definitions)
|
||||
end
|
||||
end
|
||||
self.mapping_registry = Echo_port_type::MappingRegistry
|
||||
end
|
||||
end
|
||||
|
||||
if $0 == __FILE__
|
||||
# Change listen port.
|
||||
server = Echo_port_typeApp.new('app', nil, '0.0.0.0', 10080)
|
||||
trap(:INT) do
|
||||
server.shutdown
|
||||
end
|
||||
server.start
|
||||
end
|
||||
46
test/wsdl/any/test_any.rb
Normal file
46
test/wsdl/any/test_any.rb
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
require 'test/unit'
|
||||
require 'wsdl/parser'
|
||||
require 'wsdl/soap/wsdl2ruby'
|
||||
module WSDL; module Any
|
||||
|
||||
|
||||
class TestAny < Test::Unit::TestCase
|
||||
DIR = File.dirname(File.expand_path(__FILE__))
|
||||
def pathname(filename)
|
||||
File.join(DIR, filename)
|
||||
end
|
||||
|
||||
def test_any
|
||||
gen = WSDL::SOAP::WSDL2Ruby.new
|
||||
gen.location = pathname("any.wsdl")
|
||||
gen.basedir = DIR
|
||||
gen.logger.level = Logger::FATAL
|
||||
gen.opt['classdef'] = nil
|
||||
gen.opt['driver'] = nil
|
||||
gen.opt['client_skelton'] = nil
|
||||
gen.opt['servant_skelton'] = nil
|
||||
gen.opt['standalone_server_stub'] = nil
|
||||
gen.opt['force'] = true
|
||||
gen.run
|
||||
compare("expectedDriver.rb", "echoDriver.rb")
|
||||
compare("expectedEcho.rb", "echo.rb")
|
||||
compare("expectedService.rb", "echo_service.rb")
|
||||
|
||||
File.unlink(pathname("echo_service.rb"))
|
||||
File.unlink(pathname("echo.rb"))
|
||||
File.unlink(pathname("echo_serviceClient.rb"))
|
||||
File.unlink(pathname("echoDriver.rb"))
|
||||
File.unlink(pathname("echoServant.rb"))
|
||||
end
|
||||
|
||||
def compare(expected, actual)
|
||||
assert_equal(loadfile(expected), loadfile(actual), actual)
|
||||
end
|
||||
|
||||
def loadfile(file)
|
||||
File.open(pathname(file)) { |f| f.read }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end; end
|
||||
47
test/wsdl/qualified/lp.wsdl
Normal file
47
test/wsdl/qualified/lp.wsdl
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<definitions
|
||||
name="lp"
|
||||
targetNamespace="urn:lp"
|
||||
xmlns:tns="urn:lp"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||
xmlns="http://schemas.xmlsoap.org/wsdl/">
|
||||
<types>
|
||||
<schema xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<import namespace="urn:lp" schemaLocation="lp.xsd"/>
|
||||
</schema>
|
||||
</types>
|
||||
|
||||
<message name="login_in">
|
||||
<part name="parameters" element="tns:login" />
|
||||
</message>
|
||||
<message name="login_out">
|
||||
<part name="parameters" element="tns:loginResponse" />
|
||||
</message>
|
||||
|
||||
<portType name="lp_porttype">
|
||||
<operation name="login">
|
||||
<input message="tns:login_in" />
|
||||
<output message="tns:login_out" />
|
||||
</operation>
|
||||
</portType>
|
||||
|
||||
<binding name="lp_binding" type="tns:lp_porttype">
|
||||
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
|
||||
<operation name="login">
|
||||
<soap:operation soapAction="urn:lp:login" style="document" />
|
||||
<input>
|
||||
<soap:body use="literal" />
|
||||
</input>
|
||||
<output>
|
||||
<soap:body use="literal" />
|
||||
</output>
|
||||
</operation>
|
||||
</binding>
|
||||
|
||||
<service name="lp_service">
|
||||
<port name="lp_service_port" binding="tns:lp_binding">
|
||||
<soap:address location="http://localhost:17171/" />
|
||||
</port>
|
||||
</service>
|
||||
</definitions>
|
||||
26
test/wsdl/qualified/lp.xsd
Normal file
26
test/wsdl/qualified/lp.xsd
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:lp="urn:lp" targetNamespace="urn:lp" elementFormDefault="unqualified">
|
||||
|
||||
<xs:complexType name="login">
|
||||
<xs:sequence>
|
||||
<xs:element name="username" type="xs:string"/>
|
||||
<xs:element name="password" type="xs:string"/>
|
||||
<xs:element name="timezone" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:element name="login" type="lp:login"/>
|
||||
|
||||
<xs:complexType name="loginResponse">
|
||||
<xs:sequence>
|
||||
<xs:element name="loginResult">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="sessionID" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:element name="loginResponse" type="lp:loginResponse"/>
|
||||
</xs:schema>
|
||||
50
test/wsdl/qualified/np.wsdl
Normal file
50
test/wsdl/qualified/np.wsdl
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://www50.brinkster.com/vbfacileinpt/np" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://www50.brinkster.com/vbfacileinpt/np" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
|
||||
<wsdl:types>
|
||||
<s:schema elementFormDefault="qualified" targetNamespace="http://www50.brinkster.com/vbfacileinpt/np">
|
||||
<s:element name="GetPrimeNumbers">
|
||||
<s:complexType>
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1" name="Max" type="s:string" />
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
</s:element>
|
||||
<s:element name="GetPrimeNumbersResponse">
|
||||
<s:complexType>
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1" name="GetPrimeNumbersResult" type="s:string" />
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
</s:element>
|
||||
</s:schema>
|
||||
</wsdl:types>
|
||||
<wsdl:message name="GetPrimeNumbersSoapIn">
|
||||
<wsdl:part name="parameters" element="tns:GetPrimeNumbers" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="GetPrimeNumbersSoapOut">
|
||||
<wsdl:part name="parameters" element="tns:GetPrimeNumbersResponse" />
|
||||
</wsdl:message>
|
||||
<wsdl:portType name="pnumSoap">
|
||||
<wsdl:operation name="GetPrimeNumbers">
|
||||
<wsdl:input message="tns:GetPrimeNumbersSoapIn" />
|
||||
<wsdl:output message="tns:GetPrimeNumbersSoapOut" />
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
<wsdl:binding name="pnumSoap" type="tns:pnumSoap">
|
||||
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
|
||||
<wsdl:operation name="GetPrimeNumbers">
|
||||
<soap:operation soapAction="http://www50.brinkster.com/vbfacileinpt/np/GetPrimeNumbers" style="document" />
|
||||
<wsdl:input>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:binding>
|
||||
<wsdl:service name="pnum">
|
||||
<wsdl:port name="pnumSoap" binding="tns:pnumSoap">
|
||||
<soap:address location="http://www50.brinkster.com/vbfacileinpt/np.asmx" />
|
||||
</wsdl:port>
|
||||
</wsdl:service>
|
||||
</wsdl:definitions>
|
||||
154
test/wsdl/qualified/test_qualified.rb
Normal file
154
test/wsdl/qualified/test_qualified.rb
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
require 'test/unit'
|
||||
require 'wsdl/soap/wsdl2ruby'
|
||||
require 'soap/rpc/standaloneServer'
|
||||
require 'soap/wsdlDriver'
|
||||
|
||||
if defined?(HTTPAccess2)
|
||||
|
||||
module WSDL
|
||||
|
||||
|
||||
class TestQualified < Test::Unit::TestCase
|
||||
class Server < ::SOAP::RPC::StandaloneServer
|
||||
Namespace = 'http://www50.brinkster.com/vbfacileinpt/np'
|
||||
|
||||
def on_init
|
||||
add_document_method(
|
||||
self,
|
||||
Namespace + '/GetPrimeNumbers',
|
||||
'GetPrimeNumbers',
|
||||
XSD::QName.new(Namespace, 'GetPrimeNumbers'),
|
||||
XSD::QName.new(Namespace, 'GetPrimeNumbersResponse')
|
||||
)
|
||||
end
|
||||
|
||||
def GetPrimeNumbers(arg)
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
DIR = File.dirname(File.expand_path(__FILE__))
|
||||
Port = 17171
|
||||
|
||||
def setup
|
||||
setup_server
|
||||
setup_clientdef
|
||||
@client = nil
|
||||
end
|
||||
|
||||
def teardown
|
||||
teardown_server
|
||||
unless $DEBUG
|
||||
File.unlink(pathname('default.rb'))
|
||||
File.unlink(pathname('defaultDriver.rb'))
|
||||
end
|
||||
@client.reset_stream if @client
|
||||
end
|
||||
|
||||
def setup_server
|
||||
@server = Server.new('Test', "urn:lp", '0.0.0.0', Port)
|
||||
@server.level = Logger::Severity::ERROR
|
||||
@server_thread = start_server_thread(@server)
|
||||
end
|
||||
|
||||
def setup_clientdef
|
||||
backupdir = Dir.pwd
|
||||
begin
|
||||
Dir.chdir(DIR)
|
||||
gen = WSDL::SOAP::WSDL2Ruby.new
|
||||
gen.location = pathname("np.wsdl")
|
||||
gen.basedir = DIR
|
||||
gen.logger.level = Logger::FATAL
|
||||
gen.opt['classdef'] = nil
|
||||
gen.opt['driver'] = nil
|
||||
gen.opt['force'] = true
|
||||
gen.run
|
||||
require pathname('default.rb')
|
||||
ensure
|
||||
Dir.chdir(backupdir)
|
||||
end
|
||||
end
|
||||
|
||||
def teardown_server
|
||||
@server.shutdown
|
||||
@server_thread.kill
|
||||
@server_thread.join
|
||||
end
|
||||
|
||||
def start_server_thread(server)
|
||||
t = Thread.new {
|
||||
Thread.current.abort_on_exception = true
|
||||
server.start
|
||||
}
|
||||
t
|
||||
end
|
||||
|
||||
def pathname(filename)
|
||||
File.join(DIR, filename)
|
||||
end
|
||||
|
||||
LOGIN_REQUEST_QUALIFIED_NS =
|
||||
%q[<?xml version="1.0" encoding="utf-8" ?>
|
||||
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<env:Body>
|
||||
<n1:GetPrimeNumbers xmlns:n1="http://www50.brinkster.com/vbfacileinpt/np">
|
||||
<n1:Max>10</n1:Max>
|
||||
</n1:GetPrimeNumbers>
|
||||
</env:Body>
|
||||
</env:Envelope>]
|
||||
|
||||
LOGIN_REQUEST_QUALIFIED =
|
||||
%q[<?xml version="1.0" encoding="utf-8" ?>
|
||||
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<env:Body>
|
||||
<GetPrimeNumbers xmlns="http://www50.brinkster.com/vbfacileinpt/np">
|
||||
<Max>10</Max>
|
||||
</GetPrimeNumbers>
|
||||
</env:Body>
|
||||
</env:Envelope>]
|
||||
|
||||
def test_wsdl
|
||||
wsdl = File.join(DIR, 'np.wsdl')
|
||||
@client = nil
|
||||
backupdir = Dir.pwd
|
||||
begin
|
||||
Dir.chdir(DIR)
|
||||
@client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
|
||||
ensure
|
||||
Dir.chdir(backupdir)
|
||||
end
|
||||
@client.endpoint_url = "http://localhost:#{Port}/"
|
||||
@client.wiredump_dev = str = ''
|
||||
@client.GetPrimeNumbers(:Max => 10)
|
||||
assert_equal(LOGIN_REQUEST_QUALIFIED_NS, parse_requestxml(str))
|
||||
end
|
||||
|
||||
include ::SOAP
|
||||
def test_naive
|
||||
backupdir = Dir.pwd
|
||||
begin
|
||||
Dir.chdir(DIR)
|
||||
require pathname('defaultDriver')
|
||||
ensure
|
||||
Dir.chdir(backupdir)
|
||||
end
|
||||
@client = PnumSoap.new("http://localhost:#{Port}/")
|
||||
|
||||
@client.wiredump_dev = str = ''
|
||||
@client.getPrimeNumbers(GetPrimeNumbers.new(10))
|
||||
assert_equal(LOGIN_REQUEST_QUALIFIED, parse_requestxml(str))
|
||||
end
|
||||
|
||||
def parse_requestxml(str)
|
||||
str.split(/\r?\n\r?\n/)[3]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
143
test/wsdl/qualified/test_unqualified.rb
Normal file
143
test/wsdl/qualified/test_unqualified.rb
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
require 'test/unit'
|
||||
require 'wsdl/soap/wsdl2ruby'
|
||||
require 'soap/rpc/standaloneServer'
|
||||
require 'soap/wsdlDriver'
|
||||
|
||||
if defined?(HTTPAccess2)
|
||||
|
||||
module WSDL
|
||||
|
||||
|
||||
class TestUnqualified < Test::Unit::TestCase
|
||||
class Server < ::SOAP::RPC::StandaloneServer
|
||||
Namespace = 'urn:lp'
|
||||
|
||||
def on_init
|
||||
add_document_method(
|
||||
self,
|
||||
Namespace + ':login',
|
||||
'login',
|
||||
XSD::QName.new(Namespace, 'login'),
|
||||
XSD::QName.new(Namespace, 'loginResponse')
|
||||
)
|
||||
end
|
||||
|
||||
def login(arg)
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
DIR = File.dirname(File.expand_path(__FILE__))
|
||||
Port = 17171
|
||||
|
||||
def setup
|
||||
setup_server
|
||||
setup_clientdef
|
||||
@client = nil
|
||||
end
|
||||
|
||||
def teardown
|
||||
teardown_server
|
||||
File.unlink(pathname('lp.rb'))
|
||||
File.unlink(pathname('lpDriver.rb'))
|
||||
@client.reset_stream if @client
|
||||
end
|
||||
|
||||
def setup_server
|
||||
@server = Server.new('Test', "urn:lp", '0.0.0.0', Port)
|
||||
@server.level = Logger::Severity::ERROR
|
||||
@server_thread = start_server_thread(@server)
|
||||
end
|
||||
|
||||
def setup_clientdef
|
||||
backupdir = Dir.pwd
|
||||
begin
|
||||
Dir.chdir(DIR)
|
||||
gen = WSDL::SOAP::WSDL2Ruby.new
|
||||
gen.location = pathname("lp.wsdl")
|
||||
gen.basedir = DIR
|
||||
gen.logger.level = Logger::FATAL
|
||||
gen.opt['classdef'] = nil
|
||||
gen.opt['driver'] = nil
|
||||
gen.opt['force'] = true
|
||||
gen.run
|
||||
require pathname('lp')
|
||||
ensure
|
||||
Dir.chdir(backupdir)
|
||||
end
|
||||
end
|
||||
|
||||
def teardown_server
|
||||
@server.shutdown
|
||||
@server_thread.kill
|
||||
@server_thread.join
|
||||
end
|
||||
|
||||
def start_server_thread(server)
|
||||
t = Thread.new {
|
||||
Thread.current.abort_on_exception = true
|
||||
server.start
|
||||
}
|
||||
t
|
||||
end
|
||||
|
||||
def pathname(filename)
|
||||
File.join(DIR, filename)
|
||||
end
|
||||
|
||||
LOGIN_REQUEST_QUALIFIED =
|
||||
%q[<?xml version="1.0" encoding="utf-8" ?>
|
||||
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<env:Body>
|
||||
<n1:login xmlns:n1="urn:lp">
|
||||
<username>NaHi</username>
|
||||
<password>passwd</password>
|
||||
<timezone>JST</timezone>
|
||||
</n1:login>
|
||||
</env:Body>
|
||||
</env:Envelope>]
|
||||
|
||||
def test_wsdl
|
||||
wsdl = File.join(DIR, 'lp.wsdl')
|
||||
@client = nil
|
||||
backupdir = Dir.pwd
|
||||
begin
|
||||
Dir.chdir(DIR)
|
||||
@client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
|
||||
ensure
|
||||
Dir.chdir(backupdir)
|
||||
end
|
||||
@client.endpoint_url = "http://localhost:#{Port}/"
|
||||
@client.wiredump_dev = str = ''
|
||||
@client.login(:timezone => 'JST', :password => 'passwd',
|
||||
:username => 'NaHi')
|
||||
assert_equal(LOGIN_REQUEST_QUALIFIED, parse_requestxml(str))
|
||||
end
|
||||
|
||||
include ::SOAP
|
||||
def test_naive
|
||||
backupdir = Dir.pwd
|
||||
begin
|
||||
Dir.chdir(DIR)
|
||||
require pathname('lpDriver')
|
||||
ensure
|
||||
Dir.chdir(backupdir)
|
||||
end
|
||||
@client = Lp_porttype.new("http://localhost:#{Port}/")
|
||||
|
||||
@client.wiredump_dev = str = ''
|
||||
@client.login(Login.new('NaHi', 'passwd', 'JST'))
|
||||
assert_equal(LOGIN_REQUEST_QUALIFIED, parse_requestxml(str))
|
||||
end
|
||||
|
||||
def parse_requestxml(str)
|
||||
str.split(/\r?\n\r?\n/)[3]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
90
test/wsdl/ref/expectedProduct.rb
Normal file
90
test/wsdl/ref/expectedProduct.rb
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
require 'xsd/qname'
|
||||
|
||||
# {urn:product}Rating
|
||||
module Rating
|
||||
C_0 = "0"
|
||||
C_1 = "+1"
|
||||
C_1_2 = "-1"
|
||||
end
|
||||
|
||||
# {urn:product}Product-Bag
|
||||
class ProductBag
|
||||
@@schema_type = "Product-Bag"
|
||||
@@schema_ns = "urn:product"
|
||||
@@schema_attribute = {XSD::QName.new("urn:product", "version") => "SOAP::SOAPString", XSD::QName.new("urn:product", "yesno") => "SOAP::SOAPString"}
|
||||
@@schema_element = [["bag", ["Product[]", XSD::QName.new(nil, "bag")]], ["rating", ["SOAP::SOAPString[]", XSD::QName.new("urn:product", "Rating")]], ["product_Bag", [nil, XSD::QName.new("urn:product", "Product-Bag")]], ["comment_1", [nil, XSD::QName.new(nil, "comment_1")]], ["comment_2", ["Comment[]", XSD::QName.new(nil, "comment-2")]]]
|
||||
|
||||
attr_accessor :bag
|
||||
attr_accessor :product_Bag
|
||||
attr_accessor :comment_1
|
||||
attr_accessor :comment_2
|
||||
|
||||
def Rating
|
||||
@rating
|
||||
end
|
||||
|
||||
def Rating=(value)
|
||||
@rating = value
|
||||
end
|
||||
|
||||
def xmlattr_version
|
||||
(@__xmlattr ||= {})[XSD::QName.new("urn:product", "version")]
|
||||
end
|
||||
|
||||
def xmlattr_version=(value)
|
||||
(@__xmlattr ||= {})[XSD::QName.new("urn:product", "version")] = value
|
||||
end
|
||||
|
||||
def xmlattr_yesno
|
||||
(@__xmlattr ||= {})[XSD::QName.new("urn:product", "yesno")]
|
||||
end
|
||||
|
||||
def xmlattr_yesno=(value)
|
||||
(@__xmlattr ||= {})[XSD::QName.new("urn:product", "yesno")] = value
|
||||
end
|
||||
|
||||
def initialize(bag = [], rating = [], product_Bag = nil, comment_1 = [], comment_2 = [])
|
||||
@bag = bag
|
||||
@rating = rating
|
||||
@product_Bag = product_Bag
|
||||
@comment_1 = comment_1
|
||||
@comment_2 = comment_2
|
||||
@__xmlattr = {}
|
||||
end
|
||||
end
|
||||
|
||||
# {urn:product}Creator
|
||||
class Creator
|
||||
@@schema_type = "Creator"
|
||||
@@schema_ns = "urn:product"
|
||||
@@schema_element = []
|
||||
|
||||
def initialize
|
||||
end
|
||||
end
|
||||
|
||||
# {urn:product}Product
|
||||
class Product
|
||||
@@schema_type = "Product"
|
||||
@@schema_ns = "urn:product"
|
||||
@@schema_element = [["name", ["SOAP::SOAPString", XSD::QName.new(nil, "name")]], ["rating", ["SOAP::SOAPString", XSD::QName.new("urn:product", "Rating")]]]
|
||||
|
||||
attr_accessor :name
|
||||
|
||||
def Rating
|
||||
@rating
|
||||
end
|
||||
|
||||
def Rating=(value)
|
||||
@rating = value
|
||||
end
|
||||
|
||||
def initialize(name = nil, rating = nil)
|
||||
@name = name
|
||||
@rating = rating
|
||||
end
|
||||
end
|
||||
|
||||
# {urn:product}Comment
|
||||
class Comment < String
|
||||
end
|
||||
86
test/wsdl/ref/product.wsdl
Normal file
86
test/wsdl/ref/product.wsdl
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
<?xml version="1.0"?>
|
||||
<definitions name="product"
|
||||
targetNamespace="urn:product"
|
||||
xmlns:tns="urn:product"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||
xmlns="http://schemas.xmlsoap.org/wsdl/">
|
||||
<types>
|
||||
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="urn:product">
|
||||
<simpleType name="non-empty-string">
|
||||
<restriction base="xsd:string">
|
||||
<minLength value="1"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<complexType name="Product">
|
||||
<all>
|
||||
<element name="name" type="xsd:string"/>
|
||||
<element ref="tns:Rating"/>
|
||||
</all>
|
||||
</complexType>
|
||||
|
||||
<complexType name="Comment">
|
||||
<simpleContent>
|
||||
<extension base="xsd:string">
|
||||
<attribute name="msgid" type="xsd:string" use="required"/>
|
||||
</extension>
|
||||
</simpleContent>
|
||||
</complexType>
|
||||
|
||||
<attribute name="version" type="tns:non-empty-string"/>
|
||||
|
||||
<attribute default="Y" name="yesno">
|
||||
<simpleType>
|
||||
<restriction base="xsd:string">
|
||||
<enumeration value="Y"/>
|
||||
<enumeration value="N"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
</attribute>
|
||||
|
||||
<element name="Rating">
|
||||
<simpleType>
|
||||
<restriction base="xsd:string">
|
||||
<enumeration value="+1"/>
|
||||
<enumeration value="0"/>
|
||||
<enumeration value="-1"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
</element>
|
||||
|
||||
<element name="Product-Bag">
|
||||
<complexType>
|
||||
<sequence>
|
||||
<element name="bag" type="tns:Product" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<element ref="tns:Rating" minOccurs="0" maxOccurs="unbounded"/>
|
||||
<element ref="tns:Product-Bag"/>
|
||||
<element name="comment_1" minOccurs="0" maxOccurs="unbounded">
|
||||
<complexType>
|
||||
<simpleContent>
|
||||
<extension base="xsd:string">
|
||||
<attribute name="msgid" type="xsd:string" use="required"/>
|
||||
</extension>
|
||||
</simpleContent>
|
||||
</complexType>
|
||||
</element>
|
||||
<element name="comment-2" type="tns:Comment" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
<attribute ref="tns:version"/>
|
||||
<attribute ref="tns:yesno"/>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="Creator" minOccurs="0" maxOccurs="unbounded">
|
||||
<complexType>
|
||||
<simpleContent>
|
||||
<extension base="xsd:string">
|
||||
<attribute name="Role" type="xs:string" use="required"/>
|
||||
</extension>
|
||||
</simpleContent>
|
||||
</complexType>
|
||||
</element>
|
||||
</xsd:schema>
|
||||
</types>
|
||||
</definitions>
|
||||
42
test/wsdl/ref/test_ref.rb
Normal file
42
test/wsdl/ref/test_ref.rb
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
require 'test/unit'
|
||||
require 'soap/rpc/standaloneServer'
|
||||
require 'soap/wsdlDriver'
|
||||
require 'wsdl/soap/wsdl2ruby'
|
||||
|
||||
|
||||
module WSDL
|
||||
module Ref
|
||||
|
||||
|
||||
class TestRef < Test::Unit::TestCase
|
||||
DIR = File.dirname(File.expand_path(__FILE__))
|
||||
Port = 17171
|
||||
|
||||
def test_classdef
|
||||
gen = WSDL::SOAP::WSDL2Ruby.new
|
||||
gen.location = pathname("product.wsdl")
|
||||
gen.basedir = DIR
|
||||
gen.logger.level = Logger::FATAL
|
||||
gen.opt['classdef'] = nil
|
||||
gen.opt['force'] = true
|
||||
gen.run
|
||||
compare("expectedProduct.rb", "product.rb")
|
||||
File.unlink(pathname('product.rb'))
|
||||
end
|
||||
|
||||
def compare(expected, actual)
|
||||
assert_equal(loadfile(expected), loadfile(actual), actual)
|
||||
end
|
||||
|
||||
def loadfile(file)
|
||||
File.open(pathname(file)) { |f| f.read }
|
||||
end
|
||||
|
||||
def pathname(filename)
|
||||
File.join(DIR, filename)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
364
test/wsdl/rpc/test-rpc-lit.wsdl
Normal file
364
test/wsdl/rpc/test-rpc-lit.wsdl
Normal file
|
|
@ -0,0 +1,364 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<definitions name="RPC-Literal-TestDefinitions"
|
||||
targetNamespace="http://whitemesa.net/wsdl/rpc-lit-test"
|
||||
xmlns="http://schemas.xmlsoap.org/wsdl/"
|
||||
xmlns:soap11="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:tns="http://whitemesa.net/wsdl/rpc-lit-test"
|
||||
xmlns:types="http://soapbuilders.org/rpc-lit-test/types"
|
||||
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
|
||||
<types>
|
||||
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://soapbuilders.org/rpc-lit-test/types">
|
||||
|
||||
<element name="stringItem" type="xsd:string" />
|
||||
<complexType name="ArrayOfstring">
|
||||
<sequence>
|
||||
<element ref="types:stringItem" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="ArrayOfstringInline">
|
||||
<sequence>
|
||||
<element name="stringItem" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="ArrayOfint">
|
||||
<sequence>
|
||||
<element name="integer" type="xsd:int" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<element name="structItem" type="types:SOAPStruct" />
|
||||
<complexType name="SOAPStruct">
|
||||
<all>
|
||||
<element name="varString" type="xsd:string"/>
|
||||
<element name="varInt" type="xsd:int"/>
|
||||
<element name="varFloat" type="xsd:float"/>
|
||||
</all>
|
||||
</complexType>
|
||||
|
||||
<complexType name="ArrayOfSOAPStruct">
|
||||
<sequence>
|
||||
<element ref="types:structItem" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="SOAPStructStruct">
|
||||
<all>
|
||||
<element name="varString" type="xsd:string"/>
|
||||
<element name="varInt" type="xsd:int"/>
|
||||
<element name="varFloat" type="xsd:float"/>
|
||||
<element ref="types:structItem" />
|
||||
</all>
|
||||
</complexType>
|
||||
|
||||
<complexType name="SOAPArrayStruct">
|
||||
<all>
|
||||
<element name="varString" type="xsd:string"/>
|
||||
<element name="varInt" type="xsd:int"/>
|
||||
<element name="varFloat" type="xsd:float"/>
|
||||
<element name="varArray" type="types:ArrayOfstring"/>
|
||||
</all>
|
||||
</complexType>
|
||||
|
||||
</schema>
|
||||
|
||||
</types>
|
||||
|
||||
<!-- echoStruct rpc operation -->
|
||||
<message name="echoStructRequest">
|
||||
<part name="inputStruct" type="types:SOAPStruct"/>
|
||||
</message>
|
||||
<message name="echoStructResponse">
|
||||
<part name="return" type="types:SOAPStruct"/>
|
||||
</message>
|
||||
|
||||
<!-- echoStructArray rpc operation -->
|
||||
<message name="echoStructArrayRequest">
|
||||
<part name="inputStructArray" type="types:ArrayOfSOAPStruct"/>
|
||||
</message>
|
||||
<message name="echoStructArrayResponse">
|
||||
<part name="return" type="types:ArrayOfSOAPStruct"/>
|
||||
</message>
|
||||
|
||||
<!-- echoStructAsSimpleTypes rpc operation -->
|
||||
<message name="echoStructAsSimpleTypesRequest">
|
||||
<part name="inputStruct" type="types:SOAPStruct"/>
|
||||
</message>
|
||||
<message name="echoStructAsSimpleTypesResponse">
|
||||
<part name="outputString" type="xsd:string"/>
|
||||
<part name="outputInteger" type="xsd:int"/>
|
||||
<part name="outputFloat" type="xsd:float"/>
|
||||
</message>
|
||||
|
||||
<!-- echoSimpleTypesAsStruct rpc operation -->
|
||||
<message name="echoSimpleTypesAsStructRequest">
|
||||
<part name="inputString" type="xsd:string"/>
|
||||
<part name="inputInteger" type="xsd:int"/>
|
||||
<part name="inputFloat" type="xsd:float"/>
|
||||
</message>
|
||||
<message name="echoSimpleTypesAsStructResponse">
|
||||
<part name="return" type="types:SOAPStruct"/>
|
||||
</message>
|
||||
|
||||
<!-- echoNestedStruct rpc operation -->
|
||||
<message name="echoNestedStructRequest">
|
||||
<part name="inputStruct" type="types:SOAPStructStruct"/>
|
||||
</message>
|
||||
<message name="echoNestedStructResponse">
|
||||
<part name="return" type="types:SOAPStructStruct"/>
|
||||
</message>
|
||||
|
||||
<!-- echoNestedArray rpc operation -->
|
||||
<message name="echoNestedArrayRequest">
|
||||
<part name="inputStruct" type="types:SOAPArrayStruct"/>
|
||||
</message>
|
||||
<message name="echoNestedArrayResponse">
|
||||
<part name="return" type="types:SOAPArrayStruct"/>
|
||||
</message>
|
||||
|
||||
<!-- echoStringArray rpc operation -->
|
||||
<message name="echoStringArrayRequest">
|
||||
<part name="inputStringArray" type="types:ArrayOfstring"/>
|
||||
</message>
|
||||
<message name="echoStringArrayResponse">
|
||||
<part name="return" type="types:ArrayOfstring"/>
|
||||
</message>
|
||||
|
||||
<message name="echoStringArrayInlineRequest">
|
||||
<part name="inputStringArray" type="types:ArrayOfstringInline"/>
|
||||
</message>
|
||||
<message name="echoStringArrayInlineResponse">
|
||||
<part name="return" type="types:ArrayOfstringInline"/>
|
||||
</message>
|
||||
|
||||
<!-- echoIntegerArray rpc operation -->
|
||||
<message name="echoIntegerArrayRequest">
|
||||
<part name="inputIntegerArray" type="types:ArrayOfint"/>
|
||||
</message>
|
||||
<message name="echoIntegerArrayResponse">
|
||||
<part name="return" type="types:ArrayOfint"/>
|
||||
</message>
|
||||
|
||||
<!-- echoBoolean rpc operation -->
|
||||
<message name="echoBooleanRequest">
|
||||
<part name="inputBoolean" type="xsd:boolean"/>
|
||||
</message>
|
||||
<message name="echoBooleanResponse">
|
||||
<part name="return" type="xsd:boolean"/>
|
||||
</message>
|
||||
|
||||
<!-- echoString rpc operation -->
|
||||
<message name="echoStringRequest">
|
||||
<part name="inputString" type="xsd:string"/>
|
||||
</message>
|
||||
<message name="echoStringResponse">
|
||||
<part name="return" type="xsd:string"/>
|
||||
</message>
|
||||
|
||||
|
||||
<portType name="SoapTestPortTypeRpc">
|
||||
|
||||
<!-- echoStruct rpc operation -->
|
||||
<operation name="echoStruct" parameterOrder="inputStruct">
|
||||
<input message="tns:echoStructRequest"/>
|
||||
<output message="tns:echoStructResponse"/>
|
||||
</operation>
|
||||
|
||||
<!-- echoStructArray rpc operation -->
|
||||
<operation name="echoStructArray" parameterOrder="inputStructArray">
|
||||
<input message="tns:echoStructArrayRequest"/>
|
||||
<output message="tns:echoStructArrayResponse"/>
|
||||
</operation>
|
||||
|
||||
<!-- echoStructAsSimpleTypes rpc operation -->
|
||||
<operation name="echoStructAsSimpleTypes" parameterOrder="inputStruct outputString outputInteger outputFloat">
|
||||
<input message="tns:echoStructAsSimpleTypesRequest"/>
|
||||
<output message="tns:echoStructAsSimpleTypesResponse"/>
|
||||
</operation>
|
||||
|
||||
<!-- echoSimpleTypesAsStruct rpc operation -->
|
||||
<operation name="echoSimpleTypesAsStruct" parameterOrder="inputString inputInteger inputFloat">
|
||||
<input message="tns:echoSimpleTypesAsStructRequest"/>
|
||||
<output message="tns:echoSimpleTypesAsStructResponse"/>
|
||||
</operation>
|
||||
|
||||
<!-- echoNestedStruct rpc operation -->
|
||||
<operation name="echoNestedStruct" parameterOrder="inputStruct">
|
||||
<input message="tns:echoNestedStructRequest"/>
|
||||
<output message="tns:echoNestedStructResponse"/>
|
||||
</operation>
|
||||
|
||||
<!-- echoNestedArray rpc operation -->
|
||||
<operation name="echoNestedArray" parameterOrder="inputStruct">
|
||||
<input message="tns:echoNestedArrayRequest"/>
|
||||
<output message="tns:echoNestedArrayResponse"/>
|
||||
</operation>
|
||||
|
||||
<!-- echoStringArray rpc operation -->
|
||||
<operation name="echoStringArray" parameterOrder="inputStringArray">
|
||||
<input message="tns:echoStringArrayRequest"/>
|
||||
<output message="tns:echoStringArrayResponse"/>
|
||||
</operation>
|
||||
|
||||
<operation name="echoStringArrayInline" parameterOrder="inputStringArray">
|
||||
<input message="tns:echoStringArrayInlineRequest"/>
|
||||
<output message="tns:echoStringArrayInlineResponse"/>
|
||||
</operation>
|
||||
|
||||
<!-- echoIntegerArray rpc operation -->
|
||||
<operation name="echoIntegerArray" parameterOrder="inputIntegerArray">
|
||||
<input message="tns:echoIntegerArrayRequest"/>
|
||||
<output message="tns:echoIntegerArrayResponse"/>
|
||||
</operation>
|
||||
|
||||
<!-- echoBoolean rpc operation -->
|
||||
<operation name="echoBoolean" parameterOrder="inputBoolean">
|
||||
<input message="tns:echoBooleanRequest"/>
|
||||
<output message="tns:echoBooleanResponse"/>
|
||||
</operation>
|
||||
|
||||
<!-- echoString rpc operation -->
|
||||
<operation name="echoString" parameterOrder="inputString">
|
||||
<input message="tns:echoStringRequest"/>
|
||||
<output message="tns:echoStringResponse"/>
|
||||
</operation>
|
||||
|
||||
</portType>
|
||||
|
||||
<binding name="Soap11TestRpcLitBinding" type="tns:SoapTestPortTypeRpc">
|
||||
<soap11:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||
|
||||
<!-- echoStruct rpc operation -->
|
||||
<operation name="echoStruct">
|
||||
<soap11:operation soapAction="http://soapinterop.org/"/>
|
||||
<input>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoStructArray rpc operation -->
|
||||
<operation name="echoStructArray">
|
||||
<soap11:operation soapAction="http://soapinterop.org/"/>
|
||||
<input>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoStructAsSimpleTypes rpc operation -->
|
||||
<operation name="echoStructAsSimpleTypes">
|
||||
<soap11:operation soapAction="http://soapinterop.org/"/>
|
||||
<input>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoSimpleTypesAsStruct rpc operation -->
|
||||
<operation name="echoSimpleTypesAsStruct">
|
||||
<soap11:operation soapAction="http://soapinterop.org/"/>
|
||||
<input>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoNestedStruct rpc operation -->
|
||||
<operation name="echoNestedStruct">
|
||||
<soap11:operation soapAction="http://soapinterop.org/"/>
|
||||
<input>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoNestedArray rpc operation -->
|
||||
<operation name="echoNestedArray">
|
||||
<soap11:operation soapAction="http://soapinterop.org/"/>
|
||||
<input>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoStringArray rpc operation -->
|
||||
<operation name="echoStringArray">
|
||||
<soap11:operation soapAction="http://soapinterop.org/"/>
|
||||
<input>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<operation name="echoStringArrayInline">
|
||||
<soap11:operation soapAction="http://soapinterop.org/"/>
|
||||
<input>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoIntegerArray rpc operation -->
|
||||
<operation name="echoIntegerArray">
|
||||
<soap11:operation soapAction="http://soapinterop.org/"/>
|
||||
<input>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoBoolean rpc operation -->
|
||||
<operation name="echoBoolean">
|
||||
<soap11:operation soapAction="http://soapinterop.org/"/>
|
||||
<input>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoString rpc operation -->
|
||||
<operation name="echoString">
|
||||
<soap11:operation soapAction="http://soapinterop.org/"/>
|
||||
<input>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
</binding>
|
||||
|
||||
<service name="WhiteMesaSoapRpcLitTestSvc">
|
||||
|
||||
<port name="Soap11TestRpcLitPort" binding="tns:Soap11TestRpcLitBinding">
|
||||
<soap11:address location="http://www.whitemesa.net/test-rpc-lit"/>
|
||||
</port>
|
||||
|
||||
</service>
|
||||
|
||||
</definitions>
|
||||
455
test/wsdl/rpc/test-rpc-lit12.wsdl
Normal file
455
test/wsdl/rpc/test-rpc-lit12.wsdl
Normal file
|
|
@ -0,0 +1,455 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<definitions name="RPC-Literal-TestDefinitions"
|
||||
targetNamespace="http://whitemesa.net/wsdl/rpc-lit-test"
|
||||
xmlns="http://schemas.xmlsoap.org/wsdl/"
|
||||
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
|
||||
xmlns:soap11="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:tns="http://whitemesa.net/wsdl/rpc-lit-test"
|
||||
xmlns:types="http://soapbuilders.org/rpc-lit-test/types"
|
||||
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
|
||||
<types>
|
||||
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://soapbuilders.org/rpc-lit-test/types">
|
||||
|
||||
<element name="stringItem" type="xsd:string" />
|
||||
<complexType name="ArrayOfstring">
|
||||
<sequence>
|
||||
<element ref="types:stringItem" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="ArrayOfint">
|
||||
<sequence>
|
||||
<element name="integer" type="xsd:int" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<element name="structItem" type="types:SOAPStruct" />
|
||||
<complexType name="SOAPStruct">
|
||||
<all>
|
||||
<element name="varString" type="xsd:string"/>
|
||||
<element name="varInt" type="xsd:int"/>
|
||||
<element name="varFloat" type="xsd:float"/>
|
||||
</all>
|
||||
</complexType>
|
||||
|
||||
<complexType name="ArrayOfSOAPStruct">
|
||||
<sequence>
|
||||
<element ref="types:structItem" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="SOAPStructStruct">
|
||||
<all>
|
||||
<element name="varString" type="xsd:string"/>
|
||||
<element name="varInt" type="xsd:int"/>
|
||||
<element name="varFloat" type="xsd:float"/>
|
||||
<element ref="types:structItem" />
|
||||
</all>
|
||||
</complexType>
|
||||
|
||||
<complexType name="SOAPArrayStruct">
|
||||
<all>
|
||||
<element name="varString" type="xsd:string"/>
|
||||
<element name="varInt" type="xsd:int"/>
|
||||
<element name="varFloat" type="xsd:float"/>
|
||||
<element name="varArray" type="types:ArrayOfstring"/>
|
||||
</all>
|
||||
</complexType>
|
||||
|
||||
</schema>
|
||||
|
||||
</types>
|
||||
|
||||
<!-- echoStruct rpc operation -->
|
||||
<message name="echoStructRequest">
|
||||
<part name="inputStruct" type="types:SOAPStruct"/>
|
||||
</message>
|
||||
<message name="echoStructResponse">
|
||||
<part name="return" type="types:SOAPStruct"/>
|
||||
</message>
|
||||
|
||||
<!-- echoStructArray rpc operation -->
|
||||
<message name="echoStructArrayRequest">
|
||||
<part name="inputStructArray" type="types:ArrayOfSOAPStruct"/>
|
||||
</message>
|
||||
<message name="echoStructArrayResponse">
|
||||
<part name="return" type="types:ArrayOfSOAPStruct"/>
|
||||
</message>
|
||||
|
||||
<!-- echoStructAsSimpleTypes rpc operation -->
|
||||
<message name="echoStructAsSimpleTypesRequest">
|
||||
<part name="inputStruct" type="types:SOAPStruct"/>
|
||||
</message>
|
||||
<message name="echoStructAsSimpleTypesResponse">
|
||||
<part name="outputString" type="xsd:string"/>
|
||||
<part name="outputInteger" type="xsd:int"/>
|
||||
<part name="outputFloat" type="xsd:float"/>
|
||||
</message>
|
||||
|
||||
<!-- echoSimpleTypesAsStruct rpc operation -->
|
||||
<message name="echoSimpleTypesAsStructRequest">
|
||||
<part name="inputString" type="xsd:string"/>
|
||||
<part name="inputInteger" type="xsd:int"/>
|
||||
<part name="inputFloat" type="xsd:float"/>
|
||||
</message>
|
||||
<message name="echoSimpleTypesAsStructResponse">
|
||||
<part name="return" type="types:SOAPStruct"/>
|
||||
</message>
|
||||
|
||||
<!-- echoNestedStruct rpc operation -->
|
||||
<message name="echoNestedStructRequest">
|
||||
<part name="inputStruct" type="types:SOAPStructStruct"/>
|
||||
</message>
|
||||
<message name="echoNestedStructResponse">
|
||||
<part name="return" type="types:SOAPStructStruct"/>
|
||||
</message>
|
||||
|
||||
<!-- echoNestedArray rpc operation -->
|
||||
<message name="echoNestedArrayRequest">
|
||||
<part name="inputStruct" type="types:SOAPArrayStruct"/>
|
||||
</message>
|
||||
<message name="echoNestedArrayResponse">
|
||||
<part name="return" type="types:SOAPArrayStruct"/>
|
||||
</message>
|
||||
|
||||
<!-- echoStringArray rpc operation -->
|
||||
<message name="echoStringArrayRequest">
|
||||
<part name="inputStringArray" type="types:ArrayOfstring"/>
|
||||
</message>
|
||||
<message name="echoStringArrayResponse">
|
||||
<part name="return" type="types:ArrayOfstring"/>
|
||||
</message>
|
||||
|
||||
<!-- echoIntegerArray rpc operation -->
|
||||
<message name="echoIntegerArrayRequest">
|
||||
<part name="inputIntegerArray" type="types:ArrayOfint"/>
|
||||
</message>
|
||||
<message name="echoIntegerArrayResponse">
|
||||
<part name="return" type="types:ArrayOfint"/>
|
||||
</message>
|
||||
|
||||
<!-- echoBoolean rpc operation -->
|
||||
<message name="echoBooleanRequest">
|
||||
<part name="inputBoolean" type="xsd:boolean"/>
|
||||
</message>
|
||||
<message name="echoBooleanResponse">
|
||||
<part name="return" type="xsd:boolean"/>
|
||||
</message>
|
||||
|
||||
<!-- echoString rpc operation -->
|
||||
<message name="echoStringRequest">
|
||||
<part name="inputString" type="xsd:string"/>
|
||||
</message>
|
||||
<message name="echoStringResponse">
|
||||
<part name="return" type="xsd:string"/>
|
||||
</message>
|
||||
|
||||
|
||||
<portType name="SoapTestPortTypeRpc">
|
||||
|
||||
<!-- echoStruct rpc operation -->
|
||||
<operation name="echoStruct" parameterOrder="inputStruct">
|
||||
<input message="tns:echoStructRequest"/>
|
||||
<output message="tns:echoStructResponse"/>
|
||||
</operation>
|
||||
|
||||
<!-- echoStructArray rpc operation -->
|
||||
<operation name="echoStructArray" parameterOrder="inputStructArray">
|
||||
<input message="tns:echoStructArrayRequest"/>
|
||||
<output message="tns:echoStructArrayResponse"/>
|
||||
</operation>
|
||||
|
||||
<!-- echoStructAsSimpleTypes rpc operation -->
|
||||
<operation name="echoStructAsSimpleTypes" parameterOrder="inputStruct outputString outputInteger outputFloat">
|
||||
<input message="tns:echoStructAsSimpleTypesRequest"/>
|
||||
<output message="tns:echoStructAsSimpleTypesResponse"/>
|
||||
</operation>
|
||||
|
||||
<!-- echoSimpleTypesAsStruct rpc operation -->
|
||||
<operation name="echoSimpleTypesAsStruct" parameterOrder="inputString inputInteger inputFloat">
|
||||
<input message="tns:echoSimpleTypesAsStructRequest"/>
|
||||
<output message="tns:echoSimpleTypesAsStructResponse"/>
|
||||
</operation>
|
||||
|
||||
<!-- echoNestedStruct rpc operation -->
|
||||
<operation name="echoNestedStruct" parameterOrder="inputStruct">
|
||||
<input message="tns:echoNestedStructRequest"/>
|
||||
<output message="tns:echoNestedStructResponse"/>
|
||||
</operation>
|
||||
|
||||
<!-- echoNestedArray rpc operation -->
|
||||
<operation name="echoNestedArray" parameterOrder="inputStruct">
|
||||
<input message="tns:echoNestedArrayRequest"/>
|
||||
<output message="tns:echoNestedArrayResponse"/>
|
||||
</operation>
|
||||
|
||||
<!-- echoStringArray rpc operation -->
|
||||
<operation name="echoStringArray" parameterOrder="inputStringArray">
|
||||
<input message="tns:echoStringArrayRequest"/>
|
||||
<output message="tns:echoStringArrayResponse"/>
|
||||
</operation>
|
||||
|
||||
<!-- echoIntegerArray rpc operation -->
|
||||
<operation name="echoIntegerArray" parameterOrder="inputIntegerArray">
|
||||
<input message="tns:echoIntegerArrayRequest"/>
|
||||
<output message="tns:echoIntegerArrayResponse"/>
|
||||
</operation>
|
||||
|
||||
<!-- echoBoolean rpc operation -->
|
||||
<operation name="echoBoolean" parameterOrder="inputBoolean">
|
||||
<input message="tns:echoBooleanRequest"/>
|
||||
<output message="tns:echoBooleanResponse"/>
|
||||
</operation>
|
||||
|
||||
<!-- echoString rpc operation -->
|
||||
<operation name="echoString" parameterOrder="inputString">
|
||||
<input message="tns:echoStringRequest"/>
|
||||
<output message="tns:echoStringResponse"/>
|
||||
</operation>
|
||||
|
||||
</portType>
|
||||
|
||||
<binding name="Soap11TestRpcLitBinding" type="tns:SoapTestPortTypeRpc">
|
||||
<soap11:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||
|
||||
<!-- echoStruct rpc operation -->
|
||||
<operation name="echoStruct">
|
||||
<soap11:operation soapAction="http://soapinterop.org/"/>
|
||||
<input>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoStructArray rpc operation -->
|
||||
<operation name="echoStructArray">
|
||||
<soap11:operation soapAction="http://soapinterop.org/"/>
|
||||
<input>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoStructAsSimpleTypes rpc operation -->
|
||||
<operation name="echoStructAsSimpleTypes">
|
||||
<soap11:operation soapAction="http://soapinterop.org/"/>
|
||||
<input>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoSimpleTypesAsStruct rpc operation -->
|
||||
<operation name="echoSimpleTypesAsStruct">
|
||||
<soap11:operation soapAction="http://soapinterop.org/"/>
|
||||
<input>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoNestedStruct rpc operation -->
|
||||
<operation name="echoNestedStruct">
|
||||
<soap11:operation soapAction="http://soapinterop.org/"/>
|
||||
<input>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoNestedArray rpc operation -->
|
||||
<operation name="echoNestedArray">
|
||||
<soap11:operation soapAction="http://soapinterop.org/"/>
|
||||
<input>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoStringArray rpc operation -->
|
||||
<operation name="echoStringArray">
|
||||
<soap11:operation soapAction="http://soapinterop.org/"/>
|
||||
<input>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoIntegerArray rpc operation -->
|
||||
<operation name="echoIntegerArray">
|
||||
<soap11:operation soapAction="http://soapinterop.org/"/>
|
||||
<input>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoBoolean rpc operation -->
|
||||
<operation name="echoBoolean">
|
||||
<soap11:operation soapAction="http://soapinterop.org/"/>
|
||||
<input>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoString rpc operation -->
|
||||
<operation name="echoString">
|
||||
<soap11:operation soapAction="http://soapinterop.org/"/>
|
||||
<input>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
</binding>
|
||||
|
||||
<binding name="Soap12TestRpcLitBinding" type="tns:SoapTestPortTypeRpc">
|
||||
<soap12:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||
|
||||
<!-- echoStruct rpc operation -->
|
||||
<operation name="echoStruct">
|
||||
<soap12:operation/>
|
||||
<input>
|
||||
<soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoStructArray rpc operation -->
|
||||
<operation name="echoStructArray">
|
||||
<soap12:operation/>
|
||||
<input>
|
||||
<soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoStructAsSimpleTypes rpc operation -->
|
||||
<operation name="echoStructAsSimpleTypes">
|
||||
<soap12:operation/>
|
||||
<input>
|
||||
<soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoSimpleTypesAsStruct rpc operation -->
|
||||
<operation name="echoSimpleTypesAsStruct">
|
||||
<soap12:operation/>
|
||||
<input>
|
||||
<soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoNestedStruct rpc operation -->
|
||||
<operation name="echoNestedStruct">
|
||||
<soap12:operation/>
|
||||
<input>
|
||||
<soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoNestedArray rpc operation -->
|
||||
<operation name="echoNestedArray">
|
||||
<soap12:operation/>
|
||||
<input>
|
||||
<soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoStringArray rpc operation -->
|
||||
<operation name="echoStringArray">
|
||||
<soap12:operation/>
|
||||
<input>
|
||||
<soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoIntegerArray rpc operation -->
|
||||
<operation name="echoIntegerArray">
|
||||
<soap12:operation/>
|
||||
<input>
|
||||
<soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoBoolean rpc operation -->
|
||||
<operation name="echoBoolean">
|
||||
<soap12:operation/>
|
||||
<input>
|
||||
<soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<!-- echoString rpc operation -->
|
||||
<operation name="echoString">
|
||||
<soap12:operation/>
|
||||
<input>
|
||||
<soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</input>
|
||||
<output>
|
||||
<soap12:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" />
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
</binding>
|
||||
|
||||
<service name="WhiteMesaSoapRpcLitTestSvc">
|
||||
|
||||
<port name="Soap12TestRpcLitPort" binding="tns:Soap12TestRpcLitBinding">
|
||||
<soap12:address location="http://www.whitemesa.net/soap12/test-rpc-lit"/>
|
||||
</port>
|
||||
<port name="Soap11TestRpcLitPort" binding="tns:Soap11TestRpcLitBinding">
|
||||
<soap11:address location="http://www.whitemesa.net/test-rpc-lit"/>
|
||||
</port>
|
||||
|
||||
</service>
|
||||
|
||||
</definitions>
|
||||
399
test/wsdl/rpc/test_rpc_lit.rb
Normal file
399
test/wsdl/rpc/test_rpc_lit.rb
Normal file
|
|
@ -0,0 +1,399 @@
|
|||
require 'test/unit'
|
||||
require 'wsdl/soap/wsdl2ruby'
|
||||
require 'soap/rpc/standaloneServer'
|
||||
require 'soap/wsdlDriver'
|
||||
|
||||
if defined?(HTTPAccess2) and defined?(OpenSSL)
|
||||
|
||||
module WSDL; module RPC
|
||||
|
||||
|
||||
class TestRPCLIT < Test::Unit::TestCase
|
||||
class Server < ::SOAP::RPC::StandaloneServer
|
||||
Namespace = "http://soapbuilders.org/rpc-lit-test"
|
||||
|
||||
def on_init
|
||||
self.generate_explicit_type = false
|
||||
add_rpc_operation(self,
|
||||
XSD::QName.new(Namespace, 'echoStringArray'),
|
||||
nil,
|
||||
'echoStringArray', [
|
||||
['in', 'inputStringArray', nil],
|
||||
['retval', 'return', nil]
|
||||
],
|
||||
{
|
||||
:request_style => :rpc,
|
||||
:request_use => :literal,
|
||||
:response_style => :rpc,
|
||||
:response_use => :literal
|
||||
}
|
||||
)
|
||||
add_rpc_operation(self,
|
||||
XSD::QName.new(Namespace, 'echoStringArrayInline'),
|
||||
nil,
|
||||
'echoStringArrayInline', [
|
||||
['in', 'inputStringArray', nil],
|
||||
['retval', 'return', nil]
|
||||
],
|
||||
{
|
||||
:request_style => :rpc,
|
||||
:request_use => :literal,
|
||||
:response_style => :rpc,
|
||||
:response_use => :literal
|
||||
}
|
||||
)
|
||||
add_rpc_operation(self,
|
||||
XSD::QName.new(Namespace, 'echoNestedStruct'),
|
||||
nil,
|
||||
'echoNestedStruct', [
|
||||
['in', 'inputNestedStruct', nil],
|
||||
['retval', 'return', nil]
|
||||
],
|
||||
{
|
||||
:request_style => :rpc,
|
||||
:request_use => :literal,
|
||||
:response_style => :rpc,
|
||||
:response_use => :literal
|
||||
}
|
||||
)
|
||||
add_rpc_operation(self,
|
||||
XSD::QName.new(Namespace, 'echoStructArray'),
|
||||
nil,
|
||||
'echoStructArray', [
|
||||
['in', 'inputStructArray', nil],
|
||||
['retval', 'return', nil]
|
||||
],
|
||||
{
|
||||
:request_style => :rpc,
|
||||
:request_use => :literal,
|
||||
:response_style => :rpc,
|
||||
:response_use => :literal
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
def echoStringArray(strings)
|
||||
# strings.stringItem => Array
|
||||
ArrayOfstring[*strings.stringItem]
|
||||
end
|
||||
|
||||
def echoStringArrayInline(strings)
|
||||
ArrayOfstringInline[*strings.stringItem]
|
||||
end
|
||||
|
||||
def echoNestedStruct(struct)
|
||||
struct
|
||||
end
|
||||
|
||||
def echoStructArray(ary)
|
||||
ary
|
||||
end
|
||||
end
|
||||
|
||||
DIR = File.dirname(File.expand_path(__FILE__))
|
||||
|
||||
Port = 17171
|
||||
|
||||
def setup
|
||||
setup_server
|
||||
setup_classdef
|
||||
@client = nil
|
||||
end
|
||||
|
||||
def teardown
|
||||
teardown_server
|
||||
unless $DEBUG
|
||||
File.unlink(pathname('RPC-Literal-TestDefinitions.rb'))
|
||||
File.unlink(pathname('RPC-Literal-TestDefinitionsDriver.rb'))
|
||||
end
|
||||
@client.reset_stream if @client
|
||||
end
|
||||
|
||||
def setup_server
|
||||
@server = Server.new('Test', Server::Namespace, '0.0.0.0', Port)
|
||||
@server.level = Logger::Severity::ERROR
|
||||
@server_thread = start_server_thread(@server)
|
||||
end
|
||||
|
||||
def setup_classdef
|
||||
gen = WSDL::SOAP::WSDL2Ruby.new
|
||||
gen.location = pathname("test-rpc-lit.wsdl")
|
||||
gen.basedir = DIR
|
||||
gen.logger.level = Logger::FATAL
|
||||
gen.opt['classdef'] = nil
|
||||
gen.opt['driver'] = nil
|
||||
gen.opt['force'] = true
|
||||
gen.run
|
||||
backupdir = Dir.pwd
|
||||
begin
|
||||
Dir.chdir(DIR)
|
||||
require pathname('RPC-Literal-TestDefinitions.rb')
|
||||
require pathname('RPC-Literal-TestDefinitionsDriver.rb')
|
||||
ensure
|
||||
Dir.chdir(backupdir)
|
||||
end
|
||||
end
|
||||
|
||||
def teardown_server
|
||||
@server.shutdown
|
||||
@server_thread.kill
|
||||
@server_thread.join
|
||||
end
|
||||
|
||||
def start_server_thread(server)
|
||||
t = Thread.new {
|
||||
Thread.current.abort_on_exception = true
|
||||
server.start
|
||||
}
|
||||
t
|
||||
end
|
||||
|
||||
def pathname(filename)
|
||||
File.join(DIR, filename)
|
||||
end
|
||||
|
||||
def test_wsdl_echoStringArray
|
||||
wsdl = pathname('test-rpc-lit.wsdl')
|
||||
@client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
|
||||
@client.endpoint_url = "http://localhost:#{Port}/"
|
||||
@client.wiredump_dev = STDOUT if $DEBUG
|
||||
# response contains only 1 part.
|
||||
result = @client.echoStringArray(ArrayOfstring["a", "b", "c"])[0]
|
||||
assert_equal(["a", "b", "c"], result.stringItem)
|
||||
end
|
||||
|
||||
ECHO_STRING_ARRAY_REQUEST =
|
||||
%q[<?xml version="1.0" encoding="utf-8" ?>
|
||||
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<env:Body>
|
||||
<n1:echoStringArray xmlns:n1="http://soapbuilders.org/rpc-lit-test">
|
||||
<inputStringArray xmlns:n2="http://soapbuilders.org/rpc-lit-test/types">
|
||||
<n2:stringItem>a</n2:stringItem>
|
||||
<n2:stringItem>b</n2:stringItem>
|
||||
<n2:stringItem>c</n2:stringItem>
|
||||
</inputStringArray>
|
||||
</n1:echoStringArray>
|
||||
</env:Body>
|
||||
</env:Envelope>]
|
||||
|
||||
ECHO_STRING_ARRAY_RESPONSE =
|
||||
%q[<?xml version="1.0" encoding="utf-8" ?>
|
||||
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<env:Body>
|
||||
<n1:echoStringArrayResponse xmlns:n1="http://soapbuilders.org/rpc-lit-test">
|
||||
<return xmlns:n2="http://soapbuilders.org/rpc-lit-test/types">
|
||||
<n2:stringItem>a</n2:stringItem>
|
||||
<n2:stringItem>b</n2:stringItem>
|
||||
<n2:stringItem>c</n2:stringItem>
|
||||
</return>
|
||||
</n1:echoStringArrayResponse>
|
||||
</env:Body>
|
||||
</env:Envelope>]
|
||||
|
||||
def test_stub_echoStringArray
|
||||
drv = SoapTestPortTypeRpc.new("http://localhost:#{Port}/")
|
||||
drv.wiredump_dev = str = ''
|
||||
# response contains only 1 part.
|
||||
result = drv.echoStringArray(ArrayOfstring["a", "b", "c"])[0]
|
||||
assert_equal(["a", "b", "c"], result.stringItem)
|
||||
assert_equal(ECHO_STRING_ARRAY_REQUEST, parse_requestxml(str))
|
||||
assert_equal(ECHO_STRING_ARRAY_RESPONSE, parse_responsexml(str))
|
||||
end
|
||||
|
||||
ECHO_STRING_ARRAY_INLINE_REQUEST =
|
||||
%q[<?xml version="1.0" encoding="utf-8" ?>
|
||||
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<env:Body>
|
||||
<n1:echoStringArrayInline xmlns:n1="http://soapbuilders.org/rpc-lit-test">
|
||||
<inputStringArray>
|
||||
<stringItem>a</stringItem>
|
||||
<stringItem>b</stringItem>
|
||||
<stringItem>c</stringItem>
|
||||
</inputStringArray>
|
||||
</n1:echoStringArrayInline>
|
||||
</env:Body>
|
||||
</env:Envelope>]
|
||||
|
||||
ECHO_STRING_ARRAY_INLINE_RESPONSE =
|
||||
%q[<?xml version="1.0" encoding="utf-8" ?>
|
||||
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<env:Body>
|
||||
<n1:echoStringArrayInlineResponse xmlns:n1="http://soapbuilders.org/rpc-lit-test">
|
||||
<return>
|
||||
<stringItem>a</stringItem>
|
||||
<stringItem>b</stringItem>
|
||||
<stringItem>c</stringItem>
|
||||
</return>
|
||||
</n1:echoStringArrayInlineResponse>
|
||||
</env:Body>
|
||||
</env:Envelope>]
|
||||
|
||||
def test_stub_echoStringArrayInline
|
||||
drv = SoapTestPortTypeRpc.new("http://localhost:#{Port}/")
|
||||
drv.wiredump_dev = str = ''
|
||||
# response contains only 1 part.
|
||||
result = drv.echoStringArrayInline(ArrayOfstringInline["a", "b", "c"])[0]
|
||||
assert_equal(["a", "b", "c"], result.stringItem)
|
||||
assert_equal(ECHO_STRING_ARRAY_INLINE_REQUEST, parse_requestxml(str))
|
||||
assert_equal(ECHO_STRING_ARRAY_INLINE_RESPONSE, parse_responsexml(str))
|
||||
end
|
||||
|
||||
ECHO_NESTED_STRUCT_REQUEST =
|
||||
%q[<?xml version="1.0" encoding="utf-8" ?>
|
||||
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<env:Body>
|
||||
<n1:echoNestedStruct xmlns:n1="http://soapbuilders.org/rpc-lit-test">
|
||||
<inputStruct xmlns:n2="http://soapbuilders.org/rpc-lit-test/types">
|
||||
<varString>str</varString>
|
||||
<varInt>1</varInt>
|
||||
<varFloat>+1</varFloat>
|
||||
<n2:structItem>
|
||||
<varString>str</varString>
|
||||
<varInt>1</varInt>
|
||||
<varFloat>+1</varFloat>
|
||||
</n2:structItem>
|
||||
</inputStruct>
|
||||
</n1:echoNestedStruct>
|
||||
</env:Body>
|
||||
</env:Envelope>]
|
||||
|
||||
ECHO_NESTED_STRUCT_RESPONSE =
|
||||
%q[<?xml version="1.0" encoding="utf-8" ?>
|
||||
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<env:Body>
|
||||
<n1:echoNestedStructResponse xmlns:n1="http://soapbuilders.org/rpc-lit-test">
|
||||
<return xmlns:n2="http://soapbuilders.org/rpc-lit-test/types">
|
||||
<varString>str</varString>
|
||||
<varInt>1</varInt>
|
||||
<varFloat>+1</varFloat>
|
||||
<n2:structItem>
|
||||
<varString>str</varString>
|
||||
<varInt>1</varInt>
|
||||
<varFloat>+1</varFloat>
|
||||
</n2:structItem>
|
||||
</return>
|
||||
</n1:echoNestedStructResponse>
|
||||
</env:Body>
|
||||
</env:Envelope>]
|
||||
|
||||
def test_wsdl_echoNestedStruct
|
||||
wsdl = pathname('test-rpc-lit.wsdl')
|
||||
@client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
|
||||
@client.endpoint_url = "http://localhost:#{Port}/"
|
||||
@client.wiredump_dev = str = ''
|
||||
# response contains only 1 part.
|
||||
result = @client.echoNestedStruct(SOAPStructStruct.new("str", 1, 1.0, SOAPStruct.new("str", 1, 1.0)))[0]
|
||||
assert_equal('str', result.varString)
|
||||
assert_equal('1', result.varInt)
|
||||
assert_equal('+1', result.varFloat)
|
||||
assert_equal('str', result.structItem.varString)
|
||||
assert_equal('1', result.structItem.varInt)
|
||||
assert_equal('+1', result.structItem.varFloat)
|
||||
assert_equal(ECHO_NESTED_STRUCT_REQUEST, parse_requestxml(str))
|
||||
assert_equal(ECHO_NESTED_STRUCT_RESPONSE, parse_responsexml(str))
|
||||
end
|
||||
|
||||
def test_stub_echoNestedStruct
|
||||
drv = SoapTestPortTypeRpc.new("http://localhost:#{Port}/")
|
||||
drv.wiredump_dev = str = ''
|
||||
# response contains only 1 part.
|
||||
result = drv.echoNestedStruct(SOAPStructStruct.new("str", 1, 1.0, SOAPStruct.new("str", 1, 1.0)))[0]
|
||||
assert_equal('str', result.varString)
|
||||
assert_equal('1', result.varInt)
|
||||
assert_equal('+1', result.varFloat)
|
||||
assert_equal('str', result.structItem.varString)
|
||||
assert_equal('1', result.structItem.varInt)
|
||||
assert_equal('+1', result.structItem.varFloat)
|
||||
assert_equal(ECHO_NESTED_STRUCT_REQUEST, parse_requestxml(str))
|
||||
assert_equal(ECHO_NESTED_STRUCT_RESPONSE, parse_responsexml(str))
|
||||
end
|
||||
|
||||
ECHO_STRUCT_ARRAY_REQUEST =
|
||||
%q[<?xml version="1.0" encoding="utf-8" ?>
|
||||
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<env:Body>
|
||||
<n1:echoStructArray xmlns:n1="http://soapbuilders.org/rpc-lit-test">
|
||||
<inputStructArray xmlns:n2="http://soapbuilders.org/rpc-lit-test/types">
|
||||
<n2:structItem>
|
||||
<varString>str</varString>
|
||||
<varInt>2</varInt>
|
||||
<varFloat>+2.1</varFloat>
|
||||
</n2:structItem>
|
||||
<n2:structItem>
|
||||
<varString>str</varString>
|
||||
<varInt>2</varInt>
|
||||
<varFloat>+2.1</varFloat>
|
||||
</n2:structItem>
|
||||
</inputStructArray>
|
||||
</n1:echoStructArray>
|
||||
</env:Body>
|
||||
</env:Envelope>]
|
||||
|
||||
ECHO_STRUCT_ARRAY_RESPONSE =
|
||||
%q[<?xml version="1.0" encoding="utf-8" ?>
|
||||
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<env:Body>
|
||||
<n1:echoStructArrayResponse xmlns:n1="http://soapbuilders.org/rpc-lit-test">
|
||||
<return xmlns:n2="http://soapbuilders.org/rpc-lit-test/types">
|
||||
<n2:structItem>
|
||||
<varString>str</varString>
|
||||
<varInt>2</varInt>
|
||||
<varFloat>+2.1</varFloat>
|
||||
</n2:structItem>
|
||||
<n2:structItem>
|
||||
<varString>str</varString>
|
||||
<varInt>2</varInt>
|
||||
<varFloat>+2.1</varFloat>
|
||||
</n2:structItem>
|
||||
</return>
|
||||
</n1:echoStructArrayResponse>
|
||||
</env:Body>
|
||||
</env:Envelope>]
|
||||
|
||||
def test_wsdl_echoStructArray
|
||||
wsdl = pathname('test-rpc-lit.wsdl')
|
||||
@client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
|
||||
@client.endpoint_url = "http://localhost:#{Port}/"
|
||||
@client.wiredump_dev = str = ''
|
||||
# response contains only 1 part.
|
||||
e = SOAPStruct.new("str", 2, 2.1)
|
||||
result = @client.echoStructArray(ArrayOfSOAPStruct[e, e])
|
||||
assert_equal(ECHO_STRUCT_ARRAY_REQUEST, parse_requestxml(str))
|
||||
assert_equal(ECHO_STRUCT_ARRAY_RESPONSE, parse_responsexml(str))
|
||||
end
|
||||
|
||||
def test_stub_echoStructArray
|
||||
drv = SoapTestPortTypeRpc.new("http://localhost:#{Port}/")
|
||||
drv.wiredump_dev = str = ''
|
||||
# response contains only 1 part.
|
||||
e = SOAPStruct.new("str", 2, 2.1)
|
||||
result = drv.echoStructArray(ArrayOfSOAPStruct[e, e])
|
||||
assert_equal(ECHO_STRUCT_ARRAY_REQUEST, parse_requestxml(str))
|
||||
assert_equal(ECHO_STRUCT_ARRAY_RESPONSE, parse_responsexml(str))
|
||||
end
|
||||
|
||||
def parse_requestxml(str)
|
||||
str.split(/\r?\n\r?\n/)[3]
|
||||
end
|
||||
|
||||
def parse_responsexml(str)
|
||||
str.split(/\r?\n\r?\n/)[6]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end; end
|
||||
|
||||
end
|
||||
34
test/wsdl/simpletype/rpc/expectedClient.rb
Normal file
34
test/wsdl/simpletype/rpc/expectedClient.rb
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env ruby
|
||||
require 'echo_versionDriver.rb'
|
||||
|
||||
endpoint_url = ARGV.shift
|
||||
obj = Echo_version_port_type.new(endpoint_url)
|
||||
|
||||
# run ruby with -d to see SOAP wiredumps.
|
||||
obj.wiredump_dev = STDERR if $DEBUG
|
||||
|
||||
# SYNOPSIS
|
||||
# echo_version(version)
|
||||
#
|
||||
# ARGS
|
||||
# version Version - {urn:example.com:simpletype-rpc-type}version
|
||||
#
|
||||
# RETURNS
|
||||
# version_struct Version_struct - {urn:example.com:simpletype-rpc-type}version_struct
|
||||
#
|
||||
version = nil
|
||||
puts obj.echo_version(version)
|
||||
|
||||
# SYNOPSIS
|
||||
# echo_version_r(version_struct)
|
||||
#
|
||||
# ARGS
|
||||
# version_struct Version_struct - {urn:example.com:simpletype-rpc-type}version_struct
|
||||
#
|
||||
# RETURNS
|
||||
# version Version - {urn:example.com:simpletype-rpc-type}version
|
||||
#
|
||||
version_struct = nil
|
||||
puts obj.echo_version_r(version_struct)
|
||||
|
||||
|
||||
62
test/wsdl/simpletype/rpc/expectedDriver.rb
Normal file
62
test/wsdl/simpletype/rpc/expectedDriver.rb
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
require 'echo_version.rb'
|
||||
|
||||
require 'soap/rpc/driver'
|
||||
|
||||
class Echo_version_port_type < ::SOAP::RPC::Driver
|
||||
DefaultEndpointUrl = "http://localhost:10080"
|
||||
MappingRegistry = ::SOAP::Mapping::Registry.new
|
||||
|
||||
MappingRegistry.set(
|
||||
Version_struct,
|
||||
::SOAP::SOAPStruct,
|
||||
::SOAP::Mapping::Registry::TypedStructFactory,
|
||||
{ :type => XSD::QName.new("urn:example.com:simpletype-rpc-type", "version_struct") }
|
||||
)
|
||||
|
||||
Methods = [
|
||||
[ XSD::QName.new("urn:example.com:simpletype-rpc", "echo_version"),
|
||||
"urn:example.com:simpletype-rpc",
|
||||
"echo_version",
|
||||
[ ["in", "version", ["::SOAP::SOAPString"]],
|
||||
["retval", "version_struct", ["Version_struct", "urn:example.com:simpletype-rpc-type", "version_struct"]] ],
|
||||
{ :request_style => :rpc, :request_use => :encoded,
|
||||
:response_style => :rpc, :response_use => :encoded }
|
||||
],
|
||||
[ XSD::QName.new("urn:example.com:simpletype-rpc", "echo_version_r"),
|
||||
"urn:example.com:simpletype-rpc",
|
||||
"echo_version_r",
|
||||
[ ["in", "version_struct", ["Version_struct", "urn:example.com:simpletype-rpc-type", "version_struct"]],
|
||||
["retval", "version", ["::SOAP::SOAPString"]] ],
|
||||
{ :request_style => :rpc, :request_use => :encoded,
|
||||
:response_style => :rpc, :response_use => :encoded }
|
||||
]
|
||||
]
|
||||
|
||||
def initialize(endpoint_url = nil)
|
||||
endpoint_url ||= DefaultEndpointUrl
|
||||
super(endpoint_url, nil)
|
||||
self.mapping_registry = MappingRegistry
|
||||
init_methods
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def init_methods
|
||||
Methods.each do |definitions|
|
||||
opt = definitions.last
|
||||
if opt[:request_style] == :document
|
||||
add_document_operation(*definitions)
|
||||
else
|
||||
add_rpc_operation(*definitions)
|
||||
qname = definitions[0]
|
||||
name = definitions[2]
|
||||
if qname.name != name and qname.name.capitalize == name.capitalize
|
||||
::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
|
||||
__send__(name, *arg)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
23
test/wsdl/simpletype/rpc/expectedEchoVersion.rb
Normal file
23
test/wsdl/simpletype/rpc/expectedEchoVersion.rb
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
require 'xsd/qname'
|
||||
|
||||
# {urn:example.com:simpletype-rpc-type}version_struct
|
||||
class Version_struct
|
||||
@@schema_type = "version_struct"
|
||||
@@schema_ns = "urn:example.com:simpletype-rpc-type"
|
||||
@@schema_element = [["version", ["SOAP::SOAPString", XSD::QName.new(nil, "version")]], ["msg", ["SOAP::SOAPString", XSD::QName.new(nil, "msg")]]]
|
||||
|
||||
attr_accessor :version
|
||||
attr_accessor :msg
|
||||
|
||||
def initialize(version = nil, msg = nil)
|
||||
@version = version
|
||||
@msg = msg
|
||||
end
|
||||
end
|
||||
|
||||
# {urn:example.com:simpletype-rpc-type}version
|
||||
module Version
|
||||
C_16 = "1.6"
|
||||
C_18 = "1.8"
|
||||
C_19 = "1.9"
|
||||
end
|
||||
32
test/wsdl/simpletype/rpc/expectedServant.rb
Normal file
32
test/wsdl/simpletype/rpc/expectedServant.rb
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
require 'echo_version.rb'
|
||||
|
||||
class Echo_version_port_type
|
||||
# SYNOPSIS
|
||||
# echo_version(version)
|
||||
#
|
||||
# ARGS
|
||||
# version Version - {urn:example.com:simpletype-rpc-type}version
|
||||
#
|
||||
# RETURNS
|
||||
# version_struct Version_struct - {urn:example.com:simpletype-rpc-type}version_struct
|
||||
#
|
||||
def echo_version(version)
|
||||
p [version]
|
||||
raise NotImplementedError.new
|
||||
end
|
||||
|
||||
# SYNOPSIS
|
||||
# echo_version_r(version_struct)
|
||||
#
|
||||
# ARGS
|
||||
# version_struct Version_struct - {urn:example.com:simpletype-rpc-type}version_struct
|
||||
#
|
||||
# RETURNS
|
||||
# version Version - {urn:example.com:simpletype-rpc-type}version
|
||||
#
|
||||
def echo_version_r(version_struct)
|
||||
p [version_struct]
|
||||
raise NotImplementedError.new
|
||||
end
|
||||
end
|
||||
|
||||
60
test/wsdl/simpletype/rpc/expectedService.rb
Normal file
60
test/wsdl/simpletype/rpc/expectedService.rb
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
#!/usr/bin/env ruby
|
||||
require 'echo_versionServant.rb'
|
||||
|
||||
require 'soap/rpc/standaloneServer'
|
||||
require 'soap/mapping/registry'
|
||||
|
||||
class Echo_version_port_type
|
||||
MappingRegistry = ::SOAP::Mapping::Registry.new
|
||||
|
||||
MappingRegistry.set(
|
||||
Version_struct,
|
||||
::SOAP::SOAPStruct,
|
||||
::SOAP::Mapping::Registry::TypedStructFactory,
|
||||
{ :type => XSD::QName.new("urn:example.com:simpletype-rpc-type", "version_struct") }
|
||||
)
|
||||
|
||||
Methods = [
|
||||
[ XSD::QName.new("urn:example.com:simpletype-rpc", "echo_version"),
|
||||
"urn:example.com:simpletype-rpc",
|
||||
"echo_version",
|
||||
[ ["in", "version", ["::SOAP::SOAPString"]],
|
||||
["retval", "version_struct", ["Version_struct", "urn:example.com:simpletype-rpc-type", "version_struct"]] ],
|
||||
{ :request_style => :rpc, :request_use => :encoded,
|
||||
:response_style => :rpc, :response_use => :encoded }
|
||||
],
|
||||
[ XSD::QName.new("urn:example.com:simpletype-rpc", "echo_version_r"),
|
||||
"urn:example.com:simpletype-rpc",
|
||||
"echo_version_r",
|
||||
[ ["in", "version_struct", ["Version_struct", "urn:example.com:simpletype-rpc-type", "version_struct"]],
|
||||
["retval", "version", ["::SOAP::SOAPString"]] ],
|
||||
{ :request_style => :rpc, :request_use => :encoded,
|
||||
:response_style => :rpc, :response_use => :encoded }
|
||||
]
|
||||
]
|
||||
end
|
||||
|
||||
class Echo_version_port_typeApp < ::SOAP::RPC::StandaloneServer
|
||||
def initialize(*arg)
|
||||
super(*arg)
|
||||
servant = Echo_version_port_type.new
|
||||
Echo_version_port_type::Methods.each do |definitions|
|
||||
opt = definitions.last
|
||||
if opt[:request_style] == :document
|
||||
@router.add_document_operation(servant, *definitions)
|
||||
else
|
||||
@router.add_rpc_operation(servant, *definitions)
|
||||
end
|
||||
end
|
||||
self.mapping_registry = Echo_version_port_type::MappingRegistry
|
||||
end
|
||||
end
|
||||
|
||||
if $0 == __FILE__
|
||||
# Change listen port.
|
||||
server = Echo_version_port_typeApp.new('app', nil, '0.0.0.0', 10080)
|
||||
trap(:INT) do
|
||||
server.shutdown
|
||||
end
|
||||
server.start
|
||||
end
|
||||
80
test/wsdl/simpletype/rpc/rpc.wsdl
Normal file
80
test/wsdl/simpletype/rpc/rpc.wsdl
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<definitions name="echo_version"
|
||||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:tns="urn:example.com:simpletype-rpc"
|
||||
xmlns:txd="urn:example.com:simpletype-rpc-type"
|
||||
targetNamespace="urn:example.com:simpletype-rpc"
|
||||
xmlns="http://schemas.xmlsoap.org/wsdl/">
|
||||
<types>
|
||||
<xsd:schema targetNamespace="urn:example.com:simpletype-rpc-type">
|
||||
<xsd:complexType name="version_struct">
|
||||
<xsd:all>
|
||||
<xsd:element name="version" type="txd:version" />
|
||||
<xsd:element name="msg" type="xsd:string" />
|
||||
</xsd:all>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:simpleType name="version">
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="1.6"/>
|
||||
<xsd:enumeration value="1.8"/>
|
||||
<xsd:enumeration value="1.9"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:schema>
|
||||
</types>
|
||||
|
||||
<message name="msg_version">
|
||||
<part name="version" type="txd:version"/>
|
||||
</message>
|
||||
|
||||
<message name="msg_version_struct">
|
||||
<part name="version_struct" type="txd:version_struct"/>
|
||||
</message>
|
||||
|
||||
<portType name="echo_version_port_type">
|
||||
<operation name="echo_version">
|
||||
<input message="tns:msg_version"/>
|
||||
<output message="tns:msg_version_struct"/>
|
||||
</operation>
|
||||
|
||||
<operation name="echo_version_r">
|
||||
<input message="tns:msg_version_struct"/>
|
||||
<output message="tns:msg_version"/>
|
||||
</operation>
|
||||
</portType>
|
||||
|
||||
<binding name="echo_version_binding" type="tns:echo_version_port_type">
|
||||
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
|
||||
<operation name="echo_version">
|
||||
<soap:operation soapAction="urn:example.com:simpletype-rpc"/>
|
||||
<input>
|
||||
<soap:body use="encoded" namespace="urn:example.com:simpletype-rpc"
|
||||
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</input>
|
||||
<output>
|
||||
<soap:body use="encoded" namespace="urn:example.com:simpletype-rpc"
|
||||
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</output>
|
||||
</operation>
|
||||
|
||||
<operation name="echo_version_r">
|
||||
<soap:operation soapAction="urn:example.com:simpletype-rpc"/>
|
||||
<input>
|
||||
<soap:body use="encoded" namespace="urn:example.com:simpletype-rpc"
|
||||
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</input>
|
||||
<output>
|
||||
<soap:body use="encoded" namespace="urn:example.com:simpletype-rpc"
|
||||
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</output>
|
||||
</operation>
|
||||
</binding>
|
||||
|
||||
<service name="echo_version_service">
|
||||
<port name="echo_version_port" binding="tns:echo_version_binding">
|
||||
<soap:address location="http://localhost:10080"/>
|
||||
</port>
|
||||
</service>
|
||||
</definitions>
|
||||
50
test/wsdl/simpletype/rpc/test_rpc.rb
Normal file
50
test/wsdl/simpletype/rpc/test_rpc.rb
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
require 'test/unit'
|
||||
require 'wsdl/parser'
|
||||
require 'wsdl/soap/wsdl2ruby'
|
||||
|
||||
|
||||
module WSDL; module SimpleType
|
||||
|
||||
|
||||
class TestRPC < Test::Unit::TestCase
|
||||
DIR = File.dirname(File.expand_path(__FILE__))
|
||||
def pathname(filename)
|
||||
File.join(DIR, filename)
|
||||
end
|
||||
|
||||
def test_rpc
|
||||
gen = WSDL::SOAP::WSDL2Ruby.new
|
||||
gen.location = pathname("rpc.wsdl")
|
||||
gen.basedir = DIR
|
||||
gen.logger.level = Logger::FATAL
|
||||
gen.opt['classdef'] = nil
|
||||
gen.opt['driver'] = nil
|
||||
gen.opt['client_skelton'] = nil
|
||||
gen.opt['servant_skelton'] = nil
|
||||
gen.opt['standalone_server_stub'] = nil
|
||||
gen.opt['force'] = true
|
||||
gen.run
|
||||
compare("expectedEchoVersion.rb", "echo_version.rb")
|
||||
compare("expectedDriver.rb", "echo_versionDriver.rb")
|
||||
compare("expectedService.rb", "echo_version_service.rb")
|
||||
compare("expectedClient.rb", "echo_version_serviceClient.rb")
|
||||
compare("expectedServant.rb", "echo_versionServant.rb")
|
||||
|
||||
File.unlink(pathname("echo_version.rb"))
|
||||
File.unlink(pathname("echo_versionDriver.rb"))
|
||||
File.unlink(pathname("echo_version_service.rb"))
|
||||
File.unlink(pathname("echo_version_serviceClient.rb"))
|
||||
File.unlink(pathname("echo_versionServant.rb"))
|
||||
end
|
||||
|
||||
def compare(expected, actual)
|
||||
assert_equal(loadfile(expected), loadfile(actual), actual)
|
||||
end
|
||||
|
||||
def loadfile(file)
|
||||
File.open(pathname(file)) { |f| f.read }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end; end
|
||||
Loading…
Add table
Add a link
Reference in a new issue