summaryrefslogtreecommitdiff
path: root/test/wsdl
diff options
context:
space:
mode:
Diffstat (limited to 'test/wsdl')
-rw-r--r--test/wsdl/map/map.wsdl50
-rw-r--r--test/wsdl/map/test_map.rb75
2 files changed, 109 insertions, 16 deletions
diff --git a/test/wsdl/map/map.wsdl b/test/wsdl/map/map.wsdl
index 7b1a140827..e418a4cbbd 100644
--- a/test/wsdl/map/map.wsdl
+++ b/test/wsdl/map/map.wsdl
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<definitions
- name="RAA"
- targetNamespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"
- xmlns:tns="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"
- xmlns:txd="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"
+ name="map"
+ targetNamespace="urn:map"
+ xmlns:tns="urn:map"
+ xmlns:txd="urn:map"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
@@ -19,8 +19,8 @@
<element name="item" minOccurs="0" maxOccurs="unbounded">
<complexType>
<sequence>
- <element name="key" type="anyType" />
- <element name="value" type="anyType" />
+ <element name="key" type="xsd:anyType" />
+ <element name="value" type="xsd:anyType" />
</sequence>
</complexType>
</element>
@@ -34,32 +34,58 @@
<part name="return" type="apachesoap:Map"/>
</message>
- <portType name="RAABaseServicePortType">
+ <message name="map2Request">
+ <part name="arg" type="apachesoap:Map"/>
+ </message>
+ <message name="map2Response">
+ <part name="return" type="apachesoap:Map"/>
+ </message>
+
+ <portType name="MapServicePortType">
<operation name="map" parameterOrder="">
<input message="tns:mapRequest"/>
<output message="tns:mapResponse"/>
</operation>
+
+ <operation name="map2" parameterOrder="">
+ <input message="tns:map2Request"/>
+ <output message="tns:map2Response"/>
+ </operation>
</portType>
- <binding name="RAABaseServicePortBinding" type="tns:RAABaseServicePortType">
+ <binding name="MapServicePortBinding" type="tns:MapServicePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="map">
<soap:operation soapAction=""/>
<input>
<soap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
+ namespace="urn:map"/>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ namespace="urn:map"/>
+ </output>
+ </operation>
+
+ <operation name="map2">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="encoded"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ namespace="urn:map"/>
</input>
<output>
<soap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
- namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
+ namespace="urn:map"/>
</output>
</operation>
</binding>
- <service name="RAAService">
- <port name="RAABaseServicePort" binding="tns:RAABaseServicePortBinding">
+ <service name="MapService">
+ <port name="MapServicePort" binding="tns:MapServicePortBinding">
<soap:address location="http://raa.ruby-lang.org/soap/1.0.2/"/>
</port>
</service>
diff --git a/test/wsdl/map/test_map.rb b/test/wsdl/map/test_map.rb
index b0f2fb5a53..bee3a75892 100644
--- a/test/wsdl/map/test_map.rb
+++ b/test/wsdl/map/test_map.rb
@@ -1,15 +1,75 @@
require 'test/unit'
-require 'soap/processor'
-require 'soap/mapping'
-require 'soap/rpc/element'
-require 'wsdl/importer'
+require 'soap/rpc/httpserver'
+require 'soap/wsdlDriver'
module WSDL
class TestMap < Test::Unit::TestCase
+ Port = 17171
+ DIR = File.dirname(File.expand_path(__FILE__))
+
+ class Server < ::SOAP::RPC::HTTPServer
+ def on_init
+ add_method(self, 'map')
+ add_method(self, 'map2', 'arg')
+ end
+
+ def map
+ {1 => "a", 2 => "b"}
+ end
+
+ def map2(arg)
+ arg
+ end
+ end
+
def setup
+ setup_server
+ setup_client
+ end
+
+ def setup_server
+ @server = Server.new(
+ :Port => Port,
+ :AccessLog => [],
+ :SOAPDefaultNamespace => "urn:map"
+ )
+ @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, 'map.wsdl')
+ @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_driver
+ @client.endpoint_url = "http://localhost:#{Port}/"
+ @client.generate_explicit_type = true
+ 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_by_wsdl
@@ -31,6 +91,13 @@ class TestMap < Test::Unit::TestCase
assert_equal(["b1"], map["b"]["b1"])
assert_equal(["b2"], map["b"]["b2"])
end
+
+ def test_wsdldriver
+ assert_equal({1 => "a", 2 => "b"}, @client.map)
+ assert_equal({1 => 2}, @client.map2({1 => 2}))
+ assert_equal({1 => {2 => 3}}, @client.map2({1 => {2 => 3}}))
+ assert_equal({["a", 2] => {2 => 3}}, @client.map2({["a", 2] => {2 => 3}}))
+ end
end