summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author(no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-01-25 20:19:17 +0000
committer(no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-01-25 20:19:17 +0000
commitcf34b589384bebdcd424ee276a607d2c72b949da (patch)
tree4a1b29755bbf4186971f5caea6258553f957976b /test
parent1f930a0ad7c2a1aa51047d29118cf3cd82e187c2 (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@5551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/wsdl/soap/soapbodyparts.wsdl103
-rw-r--r--test/wsdl/soap/test_soapbodyparts.rb86
2 files changed, 189 insertions, 0 deletions
diff --git a/test/wsdl/soap/soapbodyparts.wsdl b/test/wsdl/soap/soapbodyparts.wsdl
new file mode 100644
index 0000000000..0e6da0ebee
--- /dev/null
+++ b/test/wsdl/soap/soapbodyparts.wsdl
@@ -0,0 +1,103 @@
+<?xml version="1.0"?>
+<definitions
+ name="soapbodyparts"
+ targetNamespace="urn:www.example.com:soapbodyparts:v1"
+ xmlns:tns="urn:www.example.com:soapbodyparts:v1"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+
+ <types>
+ <schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="urn:www.example.com:soapbodyparts:v1">
+ <import namespace = "http://schemas.xmlsoap.org/soap/encoding/"/>
+ <complexType name="StringArray">
+ <complexContent>
+ <restriction base="soapenc:Array">
+ <attribute ref="soapenc:arrayType" wsdl:arrayType="string[]"/>
+ </restriction>
+ </complexContent>
+ </complexType>
+ </schema>
+ </types>
+
+ <message name="fooRequest">
+ <part name="param1" type="xsd:string"/>
+ <part name="param2" type="xsd:string"/>
+ <part name="param3" type="xsd:string"/>
+ </message>
+
+ <message name="fooResponse">
+ <part name="return" type="tns:StringArray"/>
+ </message>
+
+ <portType name="FooServicePortType">
+ <operation name="foo"
+ parameterOrder="param3 param2 param1">
+ <input message="tns:fooRequest"/>
+ <output message="tns:fooResponse"/>
+ </operation>
+ <operation name="bar"
+ parameterOrder="param1 param2 param3">
+ <input message="tns:fooRequest"/>
+ <output message="tns:fooResponse"/>
+ </operation>
+ <operation name="baz">
+ <input message="tns:fooRequest"/>
+ <output message="tns:fooResponse"/>
+ </operation>
+ </portType>
+
+ <binding name="FooServicePortBinding" type="tns:FooServicePortType">
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="foo">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="encoded"
+ parts="param1 param3"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ namespace="urn:www.example.com:soapbodyparts:v1"/>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ namespace="urn:www.example.com:soapbodyparts:v1"/>
+ </output>
+ </operation>
+ <operation name="bar">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="encoded"
+ parts="param3 param2"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ namespace="urn:www.example.com:soapbodyparts:v1"/>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ namespace="urn:www.example.com:soapbodyparts:v1"/>
+ </output>
+ </operation>
+ <operation name="baz">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="encoded"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ namespace="urn:www.example.com:soapbodyparts:v1"/>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ namespace="urn:www.example.com:soapbodyparts:v1"/>
+ </output>
+ </operation>
+ </binding>
+
+ <service name="FooService">
+ <port name="FooServicePort" binding="tns:FooServicePortBinding">
+ <soap:address location="http://raa.ruby-lang.org/soap/1.0.2/"/>
+ </port>
+ </service>
+</definitions>
diff --git a/test/wsdl/soap/test_soapbodyparts.rb b/test/wsdl/soap/test_soapbodyparts.rb
new file mode 100644
index 0000000000..efead18301
--- /dev/null
+++ b/test/wsdl/soap/test_soapbodyparts.rb
@@ -0,0 +1,86 @@
+require 'test/unit'
+require 'soap/rpc/standaloneServer'
+require 'soap/wsdlDriver'
+
+
+module WSDL
+module SOAP
+
+
+class TestSOAPBodyParts < Test::Unit::TestCase
+ class Server < ::SOAP::RPC::StandaloneServer
+ def on_init
+ add_method(self, 'foo', 'p1', 'p2')
+ add_method(self, 'bar', 'p1', 'p2')
+ add_method(self, 'baz', 'p1', 'p2', 'p3')
+ end
+
+ def foo(p1, p2)
+ [p1, p2]
+ end
+
+ alias bar foo
+
+ def baz(p1, p2, p3)
+ [p1, p2, p3]
+ end
+ end
+
+ DIR = File.dirname(File.expand_path(__FILE__))
+
+ Port = 17171
+
+ def setup
+ setup_server
+ setup_client
+ end
+
+ def setup_server
+ @server = Server.new('Test', "urn:www.example.com:soapbodyparts:v1", '0.0.0.0', Port)
+ @server.level = Logger::Severity::ERROR
+ @t = Thread.new {
+ Thread.current.abort_on_exception = true
+ @server.start
+ }
+ while @server.status != :Running
+ sleep 0.1
+ unless @t.alive?
+ @t.join
+ raise
+ end
+ end
+ end
+
+ def setup_client
+ wsdl = File.join(DIR, 'soapbodyparts.wsdl')
+ @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_driver
+ @client.endpoint_url = "http://localhost:#{Port}/"
+ @client.wiredump_dev = STDERR if $DEBUG
+ 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_soapbodyparts
+ assert_equal(["2", "1"], @client.foo("1", "2"))
+ assert_equal(["1", "2"], @client.foo("2", "1"))
+ assert_equal(["2", "3"], @client.bar("2", "3"))
+ assert_equal(["1", "2", "3"], @client.baz("1", "2", "3"))
+ end
+end
+
+
+end
+end