summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author(no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-15 14:47:07 +0000
committer(no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-15 14:47:07 +0000
commitcaf6ad3a760f4fb0a27bb8e483f3f6ad9de707f0 (patch)
tree7eb17be0ca672f580224b641611a99ddc8e9b897 /test
parentb8bc87839d722c8cf89b6fbfbb8b4a59c8f6b6a9 (diff)
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
Diffstat (limited to 'test')
-rw-r--r--test/soap/asp.net/hello.wsdl96
-rw-r--r--test/soap/asp.net/test_aspdotnet.rb111
-rw-r--r--test/soap/header/test_simplehandler.rb116
-rw-r--r--test/soap/test_envelopenamespace.rb92
-rw-r--r--test/soap/test_httpconfigloader.rb39
-rw-r--r--test/soap/test_no_indent.rb86
-rw-r--r--test/wsdl/any/any.wsdl50
-rw-r--r--test/wsdl/any/expectedDriver.rb54
-rw-r--r--test/wsdl/any/expectedEcho.rb14
-rw-r--r--test/wsdl/any/expectedService.rb52
-rw-r--r--test/wsdl/any/test_any.rb46
-rw-r--r--test/wsdl/qualified/lp.wsdl47
-rw-r--r--test/wsdl/qualified/lp.xsd26
-rw-r--r--test/wsdl/qualified/np.wsdl50
-rw-r--r--test/wsdl/qualified/test_qualified.rb154
-rw-r--r--test/wsdl/qualified/test_unqualified.rb143
-rw-r--r--test/wsdl/ref/expectedProduct.rb90
-rw-r--r--test/wsdl/ref/product.wsdl86
-rw-r--r--test/wsdl/ref/test_ref.rb42
-rw-r--r--test/wsdl/rpc/test-rpc-lit.wsdl364
-rw-r--r--test/wsdl/rpc/test-rpc-lit12.wsdl455
-rw-r--r--test/wsdl/rpc/test_rpc_lit.rb399
-rw-r--r--test/wsdl/simpletype/rpc/expectedClient.rb34
-rw-r--r--test/wsdl/simpletype/rpc/expectedDriver.rb62
-rw-r--r--test/wsdl/simpletype/rpc/expectedEchoVersion.rb23
-rw-r--r--test/wsdl/simpletype/rpc/expectedServant.rb32
-rw-r--r--test/wsdl/simpletype/rpc/expectedService.rb60
-rw-r--r--test/wsdl/simpletype/rpc/rpc.wsdl80
-rw-r--r--test/wsdl/simpletype/rpc/test_rpc.rb50
29 files changed, 2953 insertions, 0 deletions
diff --git a/test/soap/asp.net/hello.wsdl b/test/soap/asp.net/hello.wsdl
new file mode 100644
index 0000000000..b94129c152
--- /dev/null
+++ b/test/soap/asp.net/hello.wsdl
@@ -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>
diff --git a/test/soap/asp.net/test_aspdotnet.rb b/test/soap/asp.net/test_aspdotnet.rb
new file mode 100644
index 0000000000..7d5f3fd288
--- /dev/null
+++ b/test/soap/asp.net/test_aspdotnet.rb
@@ -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
diff --git a/test/soap/header/test_simplehandler.rb b/test/soap/header/test_simplehandler.rb
new file mode 100644
index 0000000000..75dbd4a550
--- /dev/null
+++ b/test/soap/header/test_simplehandler.rb
@@ -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
diff --git a/test/soap/test_envelopenamespace.rb b/test/soap/test_envelopenamespace.rb
new file mode 100644
index 0000000000..5b7d281341
--- /dev/null
+++ b/test/soap/test_envelopenamespace.rb
@@ -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
diff --git a/test/soap/test_httpconfigloader.rb b/test/soap/test_httpconfigloader.rb
new file mode 100644
index 0000000000..b06243f661
--- /dev/null
+++ b/test/soap/test_httpconfigloader.rb
@@ -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
diff --git a/test/soap/test_no_indent.rb b/test/soap/test_no_indent.rb
new file mode 100644
index 0000000000..f49fb7389f
--- /dev/null
+++ b/test/soap/test_no_indent.rb
@@ -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
diff --git a/test/wsdl/any/any.wsdl b/test/wsdl/any/any.wsdl
new file mode 100644
index 0000000000..4d1f73a8cd
--- /dev/null
+++ b/test/wsdl/any/any.wsdl
@@ -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>
diff --git a/test/wsdl/any/expectedDriver.rb b/test/wsdl/any/expectedDriver.rb
new file mode 100644
index 0000000000..6d1827fb94
--- /dev/null
+++ b/test/wsdl/any/expectedDriver.rb
@@ -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
+
diff --git a/test/wsdl/any/expectedEcho.rb b/test/wsdl/any/expectedEcho.rb
new file mode 100644
index 0000000000..456950dfef
--- /dev/null
+++ b/test/wsdl/any/expectedEcho.rb
@@ -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
diff --git a/test/wsdl/any/expectedService.rb b/test/wsdl/any/expectedService.rb
new file mode 100644
index 0000000000..e3885e7c6c
--- /dev/null
+++ b/test/wsdl/any/expectedService.rb
@@ -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
diff --git a/test/wsdl/any/test_any.rb b/test/wsdl/any/test_any.rb
new file mode 100644
index 0000000000..7b0e480be9
--- /dev/null
+++ b/test/wsdl/any/test_any.rb
@@ -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
diff --git a/test/wsdl/qualified/lp.wsdl b/test/wsdl/qualified/lp.wsdl
new file mode 100644
index 0000000000..b107b7b392
--- /dev/null
+++ b/test/wsdl/qualified/lp.wsdl
@@ -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>
diff --git a/test/wsdl/qualified/lp.xsd b/test/wsdl/qualified/lp.xsd
new file mode 100644
index 0000000000..12bcbd8cef
--- /dev/null
+++ b/test/wsdl/qualified/lp.xsd
@@ -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>
diff --git a/test/wsdl/qualified/np.wsdl b/test/wsdl/qualified/np.wsdl
new file mode 100644
index 0000000000..e2b7253d0e
--- /dev/null
+++ b/test/wsdl/qualified/np.wsdl
@@ -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> \ No newline at end of file
diff --git a/test/wsdl/qualified/test_qualified.rb b/test/wsdl/qualified/test_qualified.rb
new file mode 100644
index 0000000000..d6c1159a87
--- /dev/null
+++ b/test/wsdl/qualified/test_qualified.rb
@@ -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
diff --git a/test/wsdl/qualified/test_unqualified.rb b/test/wsdl/qualified/test_unqualified.rb
new file mode 100644
index 0000000000..bcfed73e58
--- /dev/null
+++ b/test/wsdl/qualified/test_unqualified.rb
@@ -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
diff --git a/test/wsdl/ref/expectedProduct.rb b/test/wsdl/ref/expectedProduct.rb
new file mode 100644
index 0000000000..91c6e4c566
--- /dev/null
+++ b/test/wsdl/ref/expectedProduct.rb
@@ -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
diff --git a/test/wsdl/ref/product.wsdl b/test/wsdl/ref/product.wsdl
new file mode 100644
index 0000000000..993fe217aa
--- /dev/null
+++ b/test/wsdl/ref/product.wsdl
@@ -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>
diff --git a/test/wsdl/ref/test_ref.rb b/test/wsdl/ref/test_ref.rb
new file mode 100644
index 0000000000..165a8643e9
--- /dev/null
+++ b/test/wsdl/ref/test_ref.rb
@@ -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
diff --git a/test/wsdl/rpc/test-rpc-lit.wsdl b/test/wsdl/rpc/test-rpc-lit.wsdl
new file mode 100644
index 0000000000..72de747e36
--- /dev/null
+++ b/test/wsdl/rpc/test-rpc-lit.wsdl
@@ -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>
diff --git a/test/wsdl/rpc/test-rpc-lit12.wsdl b/test/wsdl/rpc/test-rpc-lit12.wsdl
new file mode 100644
index 0000000000..901cde6f9c
--- /dev/null
+++ b/test/wsdl/rpc/test-rpc-lit12.wsdl
@@ -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>
diff --git a/test/wsdl/rpc/test_rpc_lit.rb b/test/wsdl/rpc/test_rpc_lit.rb
new file mode 100644
index 0000000000..080dbb82cf
--- /dev/null
+++ b/test/wsdl/rpc/test_rpc_lit.rb
@@ -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
diff --git a/test/wsdl/simpletype/rpc/expectedClient.rb b/test/wsdl/simpletype/rpc/expectedClient.rb
new file mode 100644
index 0000000000..55eb58c3dd
--- /dev/null
+++ b/test/wsdl/simpletype/rpc/expectedClient.rb
@@ -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)
+
+
diff --git a/test/wsdl/simpletype/rpc/expectedDriver.rb b/test/wsdl/simpletype/rpc/expectedDriver.rb
new file mode 100644
index 0000000000..81c72d1acf
--- /dev/null
+++ b/test/wsdl/simpletype/rpc/expectedDriver.rb
@@ -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
+
diff --git a/test/wsdl/simpletype/rpc/expectedEchoVersion.rb b/test/wsdl/simpletype/rpc/expectedEchoVersion.rb
new file mode 100644
index 0000000000..806ece1626
--- /dev/null
+++ b/test/wsdl/simpletype/rpc/expectedEchoVersion.rb
@@ -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
diff --git a/test/wsdl/simpletype/rpc/expectedServant.rb b/test/wsdl/simpletype/rpc/expectedServant.rb
new file mode 100644
index 0000000000..81cf50218e
--- /dev/null
+++ b/test/wsdl/simpletype/rpc/expectedServant.rb
@@ -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
+
diff --git a/test/wsdl/simpletype/rpc/expectedService.rb b/test/wsdl/simpletype/rpc/expectedService.rb
new file mode 100644
index 0000000000..be6f996562
--- /dev/null
+++ b/test/wsdl/simpletype/rpc/expectedService.rb
@@ -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
diff --git a/test/wsdl/simpletype/rpc/rpc.wsdl b/test/wsdl/simpletype/rpc/rpc.wsdl
new file mode 100644
index 0000000000..91f71a8831
--- /dev/null
+++ b/test/wsdl/simpletype/rpc/rpc.wsdl
@@ -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>
diff --git a/test/wsdl/simpletype/rpc/test_rpc.rb b/test/wsdl/simpletype/rpc/test_rpc.rb
new file mode 100644
index 0000000000..1d6a3eb4bc
--- /dev/null
+++ b/test/wsdl/simpletype/rpc/test_rpc.rb
@@ -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