diff options
author | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-20 14:41:10 +0000 |
---|---|---|
committer | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-20 14:41:10 +0000 |
commit | e8ed175fe02aecab21ce50e85e27fe79137d8c31 (patch) | |
tree | 8a6d14560604b592f177ffaaa0c146c756edb2e9 /test/wsdl | |
parent | 330a8e51c56f5386753f55ba8e656a62471a36ba (diff) |
* added files:
* lib/soap/mapping/wsdl*.rb
* lib/wsdl/soap/element.rb
* lib/wsdl/xmlSchema/simpleContent.rb
* modified files:
* lib/soap/*
* lib/wsdl/*
* lib/xsd/*
* test/soap/*
* test/wsdl/*
* test/xsd/*
* sample/soap/*
* sample/sdl/*
* summary
* imported from the soap4r repository. Version: 1.5.3-ruby1.8.2
* added several XSD basetype support: nonPositiveInteger,
negativeInteger, nonNegativeInteger, unsignedLong, unsignedInt,
unsignedShort, unsignedByte, positiveInteger
* HTTP client connection/send/receive timeout support.
* HTTP client/server gzipped content encoding support.
* improved WSDL schema definition support; still is far from
complete, but is making step by step improovement.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/wsdl')
-rw-r--r-- | test/wsdl/map/map.wsdl | 50 | ||||
-rw-r--r-- | test/wsdl/map/test_map.rb | 75 |
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 |