diff options
Diffstat (limited to 'ruby_1_8_5/test/wsdl')
65 files changed, 5570 insertions, 0 deletions
diff --git a/ruby_1_8_5/test/wsdl/any/any.wsdl b/ruby_1_8_5/test/wsdl/any/any.wsdl new file mode 100644 index 0000000000..4d1f73a8cd --- /dev/null +++ b/ruby_1_8_5/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/ruby_1_8_5/test/wsdl/any/expectedDriver.rb b/ruby_1_8_5/test/wsdl/any/expectedDriver.rb new file mode 100644 index 0000000000..6d1827fb94 --- /dev/null +++ b/ruby_1_8_5/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/ruby_1_8_5/test/wsdl/any/expectedEcho.rb b/ruby_1_8_5/test/wsdl/any/expectedEcho.rb new file mode 100644 index 0000000000..456950dfef --- /dev/null +++ b/ruby_1_8_5/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/ruby_1_8_5/test/wsdl/any/expectedService.rb b/ruby_1_8_5/test/wsdl/any/expectedService.rb new file mode 100644 index 0000000000..e3885e7c6c --- /dev/null +++ b/ruby_1_8_5/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/ruby_1_8_5/test/wsdl/any/test_any.rb b/ruby_1_8_5/test/wsdl/any/test_any.rb new file mode 100644 index 0000000000..aab5eb631f --- /dev/null +++ b/ruby_1_8_5/test/wsdl/any/test_any.rb @@ -0,0 +1,58 @@ +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 + suppress_warning do + gen.run + end + 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 + + def suppress_warning + back = $VERBOSE + $VERBOSE = nil + begin + yield + ensure + $VERBOSE = back + end + end +end + + +end; end diff --git a/ruby_1_8_5/test/wsdl/axisArray/axisArray.wsdl b/ruby_1_8_5/test/wsdl/axisArray/axisArray.wsdl new file mode 100644 index 0000000000..3602edb748 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/axisArray/axisArray.wsdl @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<wsdl:definitions name = "itemList" + targetNamespace="urn:jp.gr.jin.rrr.example.itemList" + xmlns:tns="urn:jp.gr.jin.rrr.example.itemList" + xmlns:typens="urn:jp.gr.jin.rrr.example.itemListType" + xmlns="http://schemas.xmlsoap.org/wsdl/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <wsdl:types> + <schema targetNamespace="urn:jp.gr.jin.rrr.example.itemListType" + xmlns="http://www.w3.org/2001/XMLSchema"> + <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/> + <complexType name="Item"> + <sequence> + <element name="name" type="xsd:string"/> + </sequence> + </complexType> + <complexType name="ItemList"> + <sequence> + <element maxOccurs="unbounded" minOccurs="0" name="Item" type="typens:Item"/> + </sequence> + </complexType> + </schema> + </wsdl:types> + + <wsdl:message name="listItemRequest"/> + + <wsdl:message name="listItemResponse"> + <wsdl:part name="list" type="typens:ItemList"/> + </wsdl:message> + + <wsdl:portType name="ItemListPortType"> + <wsdl:operation name="listItem"> + <wsdl:input message="tns:listItemRequest" name="listItemRequest"/> + <wsdl:output message="tns:listItemResponse" name="listItemResponse"/> + </wsdl:operation> + </wsdl:portType> + + <wsdl:binding name="ItemListBinding" type="tns:ItemListPortType"> + <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> + <wsdl:operation name="listItem"> + <soap:operation soapAction=""/> + <wsdl:input name="listItemRequest"> + <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" + namespace="urn:jp.gr.jin.rrr.example.itemList" use="encoded"/> + </wsdl:input> + <wsdl:output name="listItemResponse"> + <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" + namespace="urn:jp.gr.jin.rrr.example.itemList" use="encoded"/> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + + <wsdl:service name="ItemListService"> + <wsdl:port binding="tns:ItemListBinding" name="ItemListPort"> + <soap:address location="http://localhost:10080/"/> + </wsdl:port> + </wsdl:service> +</wsdl:definitions> diff --git a/ruby_1_8_5/test/wsdl/axisArray/itemList.rb b/ruby_1_8_5/test/wsdl/axisArray/itemList.rb new file mode 100644 index 0000000000..b81297ed37 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/axisArray/itemList.rb @@ -0,0 +1,27 @@ +# Generated by wsdl2ruby.rb with axisArray.wsdl. + +# urn:jp.gr.jin.rrr.example.itemListType +class Item + @@schema_type = "Item" + @@schema_ns = "urn:jp.gr.jin.rrr.example.itemListType" + + def name + @name + end + + def name=(value) + @name = value + end + + def initialize(name = nil) + @name = name + end +end + +# urn:jp.gr.jin.rrr.example.itemListType +class ItemList < Array + # Contents type should be dumped here... + @@schema_type = "ItemList" + @@schema_ns = "urn:jp.gr.jin.rrr.example.itemListType" +end + diff --git a/ruby_1_8_5/test/wsdl/axisArray/test_axisarray.rb b/ruby_1_8_5/test/wsdl/axisArray/test_axisarray.rb new file mode 100644 index 0000000000..9f220bb48a --- /dev/null +++ b/ruby_1_8_5/test/wsdl/axisArray/test_axisarray.rb @@ -0,0 +1,69 @@ +require 'test/unit' +require 'soap/processor' +require 'soap/mapping' +require 'soap/rpc/element' +require 'wsdl/importer' +require 'itemList.rb' + + +module WSDL + + +class TestAxisArray < Test::Unit::TestCase + def setup + @xml =<<__EOX__ +<?xml version="1.0" encoding="UTF-8"?> +<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <soapenv:Body> + <ns1:listItemResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:jp.gr.jin.rrr.example.itemList"> + <list href="#id0"/> + </ns1:listItemResponse> + <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:ItemList" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="urn:jp.gr.jin.rrr.example.itemListType"> + <Item href="#id1"/> + <Item href="#id2"/> + <Item href="#id3"/> + </multiRef> + <multiRef id="id3" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:Item" xmlns:ns3="urn:jp.gr.jin.rrr.example.itemListType" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"> + <name xsi:type="xsd:string">name3</name> + </multiRef> + <multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns4:Item" xmlns:ns4="urn:jp.gr.jin.rrr.example.itemListType" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"> + <name xsi:type="xsd:string">name1</name> + </multiRef> + <multiRef id="id2" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns5:Item" xmlns:ns5="urn:jp.gr.jin.rrr.example.itemListType" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"> + <name xsi:type="xsd:string">name2</name> + </multiRef> + </soapenv:Body> +</soapenv:Envelope> +__EOX__ + end + + def test_by_stub + header, body = ::SOAP::Processor.unmarshal(@xml) + ary = ::SOAP::Mapping.soap2obj(body.response) + assert_equal(3, ary.size) + assert_equal("name1", ary[0].name) + assert_equal("name2", ary[1].name) + assert_equal("name3", ary[2].name) + end + + def test_by_wsdl + wsdlfile = File.join(File.dirname(File.expand_path(__FILE__)), 'axisArray.wsdl') + wsdl = WSDL::Importer.import(wsdlfile) + service = wsdl.services[0] + port = service.ports[0] + wsdl_types = wsdl.collect_complextypes + rpc_decode_typemap = wsdl_types + wsdl.soap_rpc_complextypes(port.find_binding) + opt = {} + opt[:default_encodingstyle] = ::SOAP::EncodingNamespace + opt[:decode_typemap] = rpc_decode_typemap + header, body = ::SOAP::Processor.unmarshal(@xml, opt) + ary = ::SOAP::Mapping.soap2obj(body.response) + assert_equal(3, ary.size) + assert_equal("name1", ary[0].name) + assert_equal("name2", ary[1].name) + assert_equal("name3", ary[2].name) + end +end + + +end diff --git a/ruby_1_8_5/test/wsdl/datetime/DatetimeService.rb b/ruby_1_8_5/test/wsdl/datetime/DatetimeService.rb new file mode 100644 index 0000000000..800e06d66f --- /dev/null +++ b/ruby_1_8_5/test/wsdl/datetime/DatetimeService.rb @@ -0,0 +1,44 @@ +#!/usr/bin/env ruby +require 'datetimeServant.rb' + +require 'soap/rpc/standaloneServer' +require 'soap/mapping/registry' + +class DatetimePortType + MappingRegistry = ::SOAP::Mapping::Registry.new + + Methods = [ + ["now", "now", + [ + ["in", "now", [::SOAP::SOAPDateTime]], + ["retval", "now", [::SOAP::SOAPDateTime]] + ], + "", "urn:jp.gr.jin.rrr.example.datetime", :rpc + ] + ] +end + +class DatetimePortTypeApp < ::SOAP::RPC::StandaloneServer + def initialize(*arg) + super(*arg) + servant = DatetimePortType.new + DatetimePortType::Methods.each do |name_as, name, param_def, soapaction, namespace, style| + if style == :document + @router.add_document_operation(servant, soapaction, name, param_def) + else + qname = XSD::QName.new(namespace, name_as) + @router.add_rpc_operation(servant, qname, soapaction, name, param_def) + end + end + self.mapping_registry = DatetimePortType::MappingRegistry + end +end + +if $0 == __FILE__ + # Change listen port. + server = DatetimePortTypeApp.new('app', nil, '0.0.0.0', 10080) + trap(:INT) do + server.shutdown + end + server.start +end diff --git a/ruby_1_8_5/test/wsdl/datetime/datetime.rb b/ruby_1_8_5/test/wsdl/datetime/datetime.rb new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/datetime/datetime.rb diff --git a/ruby_1_8_5/test/wsdl/datetime/datetime.wsdl b/ruby_1_8_5/test/wsdl/datetime/datetime.wsdl new file mode 100644 index 0000000000..4998dc48d6 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/datetime/datetime.wsdl @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<wsdl:definitions name = "datetime" + targetNamespace="urn:jp.gr.jin.rrr.example.datetime" + xmlns:tns="urn:jp.gr.jin.rrr.example.datetime" + xmlns="http://schemas.xmlsoap.org/wsdl/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + + <wsdl:message name="nowRequest"> + <wsdl:part name="now" type="xsd:dateTime"/> + </wsdl:message> + + <wsdl:message name="nowResponse"> + <wsdl:part name="now" type="xsd:dateTime"/> + </wsdl:message> + + <wsdl:portType name="DatetimePortType"> + <wsdl:operation name="now"> + <wsdl:input message="tns:nowRequest" name="nowRequest"/> + <wsdl:output message="tns:nowResponse" name="nowResponse"/> + </wsdl:operation> + </wsdl:portType> + + <wsdl:binding name="DatetimeBinding" type="tns:DatetimePortType"> + <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> + <wsdl:operation name="now"> + <soap:operation soapAction=""/> + <wsdl:input name="nowRequest"> + <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" + namespace="urn:jp.gr.jin.rrr.example.datetime" use="encoded"/> + </wsdl:input> + <wsdl:output name="nowResponse"> + <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" + namespace="urn:jp.gr.jin.rrr.example.datetime" use="encoded"/> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + + <wsdl:service name="DatetimeService"> + <wsdl:port binding="tns:DatetimeBinding" name="DatetimePort"> + <soap:address location="http://localhost:10080/"/> + </wsdl:port> + </wsdl:service> +</wsdl:definitions> diff --git a/ruby_1_8_5/test/wsdl/datetime/datetimeServant.rb b/ruby_1_8_5/test/wsdl/datetime/datetimeServant.rb new file mode 100644 index 0000000000..14145c42e5 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/datetime/datetimeServant.rb @@ -0,0 +1,21 @@ +require 'datetime.rb' + +class DatetimePortType + # SYNOPSIS + # now(now) + # + # ARGS + # now - {http://www.w3.org/2001/XMLSchema}dateTime + # + # RETURNS + # now - {http://www.w3.org/2001/XMLSchema}dateTime + # + # RAISES + # (undefined) + # + def now(now) + #raise NotImplementedError.new + now + 1 + end +end + diff --git a/ruby_1_8_5/test/wsdl/datetime/test_datetime.rb b/ruby_1_8_5/test/wsdl/datetime/test_datetime.rb new file mode 100644 index 0000000000..7652318205 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/datetime/test_datetime.rb @@ -0,0 +1,82 @@ +require 'test/unit' +require 'soap/wsdlDriver' +require 'DatetimeService.rb' + + +module WSDL +module Datetime + + +class TestDatetime < Test::Unit::TestCase + DIR = File.dirname(File.expand_path(__FILE__)) + + Port = 17171 + + def setup + setup_server + setup_client + end + + def setup_server + @server = DatetimePortTypeApp.new('Datetime server', nil, '0.0.0.0', Port) + @server.level = Logger::Severity::ERROR + @t = Thread.new { + Thread.current.abort_on_exception = true + @server.start + } + end + + def setup_client + wsdl = File.join(DIR, 'datetime.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.generate_explicit_type = true + @client.wiredump_dev = STDOUT 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_datetime + d = DateTime.now + d1 = d + 1 + d2 = @client.now(d) + assert_equal(d1.year, d2.year) + assert_equal(d1.month, d2.month) + assert_equal(d1.day, d2.day) + assert_equal(d1.hour, d2.hour) + assert_equal(d1.min, d2.min) + assert_equal(d1.sec, d2.sec) + assert_equal(d1.sec, d2.sec) + end + + def test_time + d = DateTime.now + t = Time.gm(d.year, d.month, d.day, d.hour, d.min, d.sec) + d1 = d + 1 + d2 = @client.now(t) + assert_equal(d1.year, d2.year) + assert_equal(d1.month, d2.month) + assert_equal(d1.day, d2.day) + assert_equal(d1.hour, d2.hour) + assert_equal(d1.min, d2.min) + assert_equal(d1.sec, d2.sec) + assert_equal(d1.sec, d2.sec) + end +end + + +end +end diff --git a/ruby_1_8_5/test/wsdl/document/document.wsdl b/ruby_1_8_5/test/wsdl/document/document.wsdl new file mode 100644 index 0000000000..fbf03fae8b --- /dev/null +++ b/ruby_1_8_5/test/wsdl/document/document.wsdl @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="utf-8"?> +<definitions + name="echo" + targetNamespace="urn:docrpc" + xmlns:tns="urn:docrpc" + 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 elementFormDefault="unqualified" targetNamespace="urn:docrpc"> + <xsd:complexType name="echo_struct"> + <xsd:sequence> + <xsd:element minOccurs="0" maxOccurs="1" name="m_string" type="xsd:string" /> + <xsd:element minOccurs="0" maxOccurs="1" name="m_datetime" type="xsd:dateTime" /> + </xsd:sequence> + <xsd:attribute name="m_attr" type="xsd:string" /> + </xsd:complexType> + + <xsd:element name="echoele"> + <xsd:complexType> + <xsd:sequence> + <xsd:element minOccurs="0" maxOccurs="1" name="struct1" type="tns:echo_struct" /> + <xsd:element minOccurs="0" maxOccurs="1" name="struct-2" type="tns:echo_struct" /> + </xsd:sequence> + <xsd:attribute name="attr_string" type="xsd:string" /> + <xsd:attribute name="attr-int" type="xsd:int" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="echo_response"> + <xsd:complexType> + <xsd:sequence> + <xsd:element minOccurs="0" maxOccurs="1" name="struct1" type="tns:echo_struct" /> + <xsd:element minOccurs="0" maxOccurs="1" name="struct-2" type="tns:echo_struct" /> + </xsd:sequence> + <xsd:attribute name="attr_string" type="xsd:string" /> + <xsd:attribute name="attr-int" type="xsd:int" /> + </xsd:complexType> + </xsd:element> + </xsd:schema> + </types> + + <message name="echo_in"> + <part name="parameters" element="tns:echoele" /> + </message> + <message name="echo_out"> + <part name="parameters" element="tns:echo_response" /> + </message> + + <portType name="docrpc_porttype"> + <operation name="echo"> + <input message="tns:echo_in" /> + <output message="tns:echo_out" /> + </operation> + </portType> + + <binding name="docrpc_binding" type="tns:docrpc_porttype"> + <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> + <operation name="echo"> + <soap:operation soapAction="urn:docrpc:echo" style="document" /> + <input> + <soap:body use="literal" /> + </input> + <output> + <soap:body use="literal" /> + </output> + </operation> + </binding> + + <service name="docrpc_service"> + <port name="docprc_service_port" binding="tns:docrpc_binding"> + <soap:address location="http://localhost:17171/" /> + </port> + </service> +</definitions> diff --git a/ruby_1_8_5/test/wsdl/document/echo.rb b/ruby_1_8_5/test/wsdl/document/echo.rb new file mode 100644 index 0000000000..c6df75aca0 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/document/echo.rb @@ -0,0 +1,92 @@ +require 'xsd/qname' + +# {urn:docrpc}echoele +class Echoele + @@schema_type = "echoele" + @@schema_ns = "urn:docrpc" + @@schema_attribute = {XSD::QName.new(nil, "attr_string") => "SOAP::SOAPString", XSD::QName.new(nil, "attr-int") => "SOAP::SOAPInt"} + @@schema_element = [["struct1", ["Echo_struct", XSD::QName.new(nil, "struct1")]], ["struct_2", ["Echo_struct", XSD::QName.new(nil, "struct-2")]]] + + attr_accessor :struct1 + attr_accessor :struct_2 + + def xmlattr_attr_string + (@__xmlattr ||= {})[XSD::QName.new(nil, "attr_string")] + end + + def xmlattr_attr_string=(value) + (@__xmlattr ||= {})[XSD::QName.new(nil, "attr_string")] = value + end + + def xmlattr_attr_int + (@__xmlattr ||= {})[XSD::QName.new(nil, "attr-int")] + end + + def xmlattr_attr_int=(value) + (@__xmlattr ||= {})[XSD::QName.new(nil, "attr-int")] = value + end + + def initialize(struct1 = nil, struct_2 = nil) + @struct1 = struct1 + @struct_2 = struct_2 + @__xmlattr = {} + end +end + +# {urn:docrpc}echo_response +class Echo_response + @@schema_type = "echo_response" + @@schema_ns = "urn:docrpc" + @@schema_attribute = {XSD::QName.new(nil, "attr_string") => "SOAP::SOAPString", XSD::QName.new(nil, "attr-int") => "SOAP::SOAPInt"} + @@schema_element = [["struct1", ["Echo_struct", XSD::QName.new(nil, "struct1")]], ["struct_2", ["Echo_struct", XSD::QName.new(nil, "struct-2")]]] + + attr_accessor :struct1 + attr_accessor :struct_2 + + def xmlattr_attr_string + (@__xmlattr ||= {})[XSD::QName.new(nil, "attr_string")] + end + + def xmlattr_attr_string=(value) + (@__xmlattr ||= {})[XSD::QName.new(nil, "attr_string")] = value + end + + def xmlattr_attr_int + (@__xmlattr ||= {})[XSD::QName.new(nil, "attr-int")] + end + + def xmlattr_attr_int=(value) + (@__xmlattr ||= {})[XSD::QName.new(nil, "attr-int")] = value + end + + def initialize(struct1 = nil, struct_2 = nil) + @struct1 = struct1 + @struct_2 = struct_2 + @__xmlattr = {} + end +end + +# {urn:docrpc}echo_struct +class Echo_struct + @@schema_type = "echo_struct" + @@schema_ns = "urn:docrpc" + @@schema_attribute = {XSD::QName.new(nil, "m_attr") => "SOAP::SOAPString"} + @@schema_element = [["m_string", ["SOAP::SOAPString", XSD::QName.new(nil, "m_string")]], ["m_datetime", ["SOAP::SOAPDateTime", XSD::QName.new(nil, "m_datetime")]]] + + attr_accessor :m_string + attr_accessor :m_datetime + + def xmlattr_m_attr + (@__xmlattr ||= {})[XSD::QName.new(nil, "m_attr")] + end + + def xmlattr_m_attr=(value) + (@__xmlattr ||= {})[XSD::QName.new(nil, "m_attr")] = value + end + + def initialize(m_string = nil, m_datetime = nil) + @m_string = m_string + @m_datetime = m_datetime + @__xmlattr = {} + end +end diff --git a/ruby_1_8_5/test/wsdl/document/number.wsdl b/ruby_1_8_5/test/wsdl/document/number.wsdl new file mode 100644 index 0000000000..cc3dd8e9f0 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/document/number.wsdl @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="utf-8"?> +<definitions + name="foo" + targetNamespace="urn:foo" + xmlns:tns="urn:foo" + 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 elementFormDefault="unqualified" targetNamespace="urn:foo"> + <xsd:element name="get_foo"> + <xsd:complexType> + <xsd:sequence> + <xsd:element minOccurs="0" maxOccurs="1" name="number" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + </xsd:schema> + </types> + + <message name="get_foo_in"> + <part name="parameters" element="tns:get_foo" /> + </message> + <message name="get_foo_out"> + <part name="parameters" type="xsd:string" /> + </message> + + <portType name="foo_porttype"> + <operation name="get_foo"> + <input message="tns:get_foo_in" /> + <output message="tns:get_foo_out" /> + </operation> + </portType> + + <binding name="foo_binding" type="tns:foo_porttype"> + <soap:binding transport="http://schemas.xmlsoap.org/soap/http" + style="document" /> + <operation name="get_foo"> + <soap:operation soapAction="urn:foo:get_foo" style="document" /> + <input> + <soap:body use="literal" /> + </input> + <output> + <soap:body use="literal" /> + </output> + </operation> + </binding> + + <service name="foo_service"> + <port name="foo_service_port" binding="tns:foo_binding"> + <soap:address location="http://localhost:17171/" /> + </port> + </service> +</definitions> diff --git a/ruby_1_8_5/test/wsdl/document/ping_nosoapaction.wsdl b/ruby_1_8_5/test/wsdl/document/ping_nosoapaction.wsdl new file mode 100644 index 0000000000..ab9529e456 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/document/ping_nosoapaction.wsdl @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<definitions xmlns:tns="http://xmlsoap.org/Ping" +xmlns="http://schemas.xmlsoap.org/wsdl/" +xmlns:xsd="http://www.w3.org/2001/XMLSchema" +xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" +targetNamespace="http://xmlsoap.org/Ping" name="Ping"> + <types> + <schema targetNamespace="http://xmlsoap.org/Ping" + xmlns="http://www.w3.org/2001/XMLSchema" + elementFormDefault="qualified"> + <complexType name="ping"> + <sequence> + <element name="scenario" type="xsd:string" + nillable="true"/> + <element name="origin" type="xsd:string" + nillable="true"/> + <element name="text" type="xsd:string" + nillable="true"/> + </sequence> + </complexType> + <complexType name="pingResponse"> + <sequence> + <element name="scenario" type="xsd:string" + nillable="true"/> + <element name="origin" type="xsd:string" + nillable="true"/> + <element name="text" type="xsd:string" + nillable="true"/> + </sequence> + </complexType> + <element name="Ping" type="tns:ping"/> + <element name="PingResponse" type="tns:pingResponse"/> + </schema> + </types> + <message name="PingRequest"> + <part name="ping" element="tns:Ping"/> + </message> + <message name="PingResponse"> + <part name="pingResponse" element="tns:PingResponse"/> + </message> + <portType name="PingPort"> + <operation name="Ping"> + <input message="tns:PingRequest"/> + <output message="tns:PingResponse"/> + </operation> + </portType> + <binding name="PingBinding" type="tns:PingPort"> + <soap:binding style="document" + transport="http://schemas.xmlsoap.org/soap/http"/> + <operation name="Ping"> + <soap:operation/> + <input> + <soap:body use="literal"/> + </input> + <output> + <soap:body use="literal"/> + </output> + </operation> + </binding> + <service name="PingService"> + <port name="PingPort" binding="tns:PingBinding"> + <soap:address + location="http://127.0.0.1:8080/axis/services/PingPort"/> + </port> + </service> +</definitions> diff --git a/ruby_1_8_5/test/wsdl/document/test_nosoapaction.rb b/ruby_1_8_5/test/wsdl/document/test_nosoapaction.rb new file mode 100644 index 0000000000..77f642fe1b --- /dev/null +++ b/ruby_1_8_5/test/wsdl/document/test_nosoapaction.rb @@ -0,0 +1,109 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' +require 'soap/rpc/driver' + + +module WSDL; module Document + + +class TestNoSOAPAction < Test::Unit::TestCase + class Server < ::SOAP::RPC::StandaloneServer + Namespace = 'http://xmlsoap.org/Ping' + + def on_init + add_document_method( + self, + Namespace + '/ping', + 'ping_with_soapaction', + XSD::QName.new(Namespace, 'Ping'), + XSD::QName.new(Namespace, 'PingResponse') + ) + + add_document_method( + self, + nil, + 'ping', + XSD::QName.new(Namespace, 'Ping'), + XSD::QName.new(Namespace, 'PingResponse') + ) + + # When no SOAPAction given, latter method(ping) is called. + end + + def ping(arg) + arg.text = 'ping' + arg + end + + def ping_with_soapaction(arg) + arg.text = 'ping_with_soapaction' + arg + end + end + + DIR = File.dirname(File.expand_path(__FILE__)) + + Port = 17171 + + 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_with_soapaction + wsdl = File.join(DIR, 'ping_nosoapaction.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.wiredump_dev = STDOUT if $DEBUG + rv = @client.ping(:scenario => 'scenario', :origin => 'origin', + :text => 'text') + assert_equal('scenario', rv.scenario) + assert_equal('origin', rv.origin) + assert_equal('ping', rv.text) + end + + def test_without_soapaction + @client = ::SOAP::RPC::Driver.new("http://localhost:#{Port}/", + Server::Namespace) + @client.add_document_method('ping', Server::Namespace + '/ping', + XSD::QName.new(Server::Namespace, 'Ping'), + XSD::QName.new(Server::Namespace, 'PingResponse')) + @client.wiredump_dev = STDOUT if $DEBUG + rv = @client.ping(:scenario => 'scenario', :origin => 'origin', + :text => 'text') + assert_equal('scenario', rv.scenario) + assert_equal('origin', rv.origin) + assert_equal('ping_with_soapaction', rv.text) + end +end + + +end; end diff --git a/ruby_1_8_5/test/wsdl/document/test_number.rb b/ruby_1_8_5/test/wsdl/document/test_number.rb new file mode 100644 index 0000000000..a640ef2a25 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/document/test_number.rb @@ -0,0 +1,99 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' + + +module WSDL; module Document + + +class TestNumber < Test::Unit::TestCase + class Server < ::SOAP::RPC::StandaloneServer + Namespace = 'urn:foo' + + def on_init + add_document_method( + self, + Namespace + ':get_foo', + 'get_foo', + XSD::QName.new(Namespace, 'get_foo'), + XSD::QName.new(Namespace, 'get_foo_response') + ) + end + + def get_foo(arg) + arg.number + end + end + + DIR = File.dirname(File.expand_path(__FILE__)) + Port = 17171 + + def setup + setup_server + setup_classdef + @client = nil + end + + def teardown + teardown_server + File.unlink(pathname('foo.rb')) + @client.reset_stream if @client + end + + def setup_server + @server = Server.new('Test', "urn:rpc", '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("number.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['classdef'] = nil + gen.opt['force'] = true + gen.run + require pathname('foo') + 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 + wsdl = File.join(DIR, 'number.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.wiredump_dev = STDOUT if $DEBUG + + # with the Struct defined in foo.rb, which is generated from WSDL + assert_equal("12345", @client.get_foo(Get_foo.new("12345"))) + + # with Hash + assert_equal("12345", @client.get_foo({:number => "12345"})) + + # with Original struct + get_foo_struct = Struct.new(:number) + assert_equal("12345", @client.get_foo(get_foo_struct.new("12345"))) + end +end + + +end; end diff --git a/ruby_1_8_5/test/wsdl/document/test_rpc.rb b/ruby_1_8_5/test/wsdl/document/test_rpc.rb new file mode 100644 index 0000000000..56cd0677ad --- /dev/null +++ b/ruby_1_8_5/test/wsdl/document/test_rpc.rb @@ -0,0 +1,177 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' + + +module WSDL; module Document + + +class TestRPC < Test::Unit::TestCase + class Server < ::SOAP::RPC::StandaloneServer + Namespace = 'urn:docrpc' + + def on_init + add_document_method( + self, + Namespace + ':echo', + 'echo', + XSD::QName.new(Namespace, 'echo'), + XSD::QName.new(Namespace, 'echo_response') + ) + end + + def echo(arg) + if arg.is_a?(Echoele) + # swap args + tmp = arg.struct1 + arg.struct1 = arg.struct_2 + arg.struct_2 = tmp + arg + else + # swap args + tmp = arg["struct1"] + arg["struct1"] = arg["struct-2"] + arg["struct-2"] = tmp + arg + end + end + end + + DIR = File.dirname(File.expand_path(__FILE__)) + + Port = 17171 + + def setup + setup_server + setup_classdef + @client = nil + end + + def teardown + teardown_server + #File.unlink(pathname('echo.rb')) + @client.reset_stream if @client + end + + def setup_server + @server = Server.new('Test', "urn:rpc", '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("document.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['classdef'] = nil + gen.opt['force'] = true + gen.run + require pathname('echo') + 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 + wsdl = File.join(DIR, 'document.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.wiredump_dev = STDOUT if $DEBUG + + struct1 = Echo_struct.new("mystring1", now1 = Time.now) + struct1.xmlattr_m_attr = 'myattr1' + struct2 = Echo_struct.new("mystring2", now2 = Time.now) + struct2.xmlattr_m_attr = 'myattr2' + echo = Echoele.new(struct1, struct2) + echo.xmlattr_attr_string = 'attr_string' + echo.xmlattr_attr_int = 5 + ret = @client.echo(echo) + + # struct#m_datetime in a response is a DateTime even though + # struct#m_datetime in a request is a Time. + timeformat = "%Y-%m-%dT%H:%M:%S" + assert_equal("mystring2", ret.struct1.m_string) + assert_equal(now2.strftime(timeformat), + date2time(ret.struct1.m_datetime).strftime(timeformat)) + assert_equal("mystring1", ret.struct_2.m_string) + assert_equal(now1.strftime(timeformat), + date2time(ret.struct_2.m_datetime).strftime(timeformat)) + assert_equal("attr_string", ret.xmlattr_attr_string) + assert_equal(5, ret.xmlattr_attr_int) + end + + def date2time(date) + if date.respond_to?(:to_time) + date.to_time + else + d = date.new_offset(0) + d.instance_eval { + Time.utc(year, mon, mday, hour, min, sec, + (sec_fraction * 86400000000).to_i) + }.getlocal + end + end + + include ::SOAP + def test_naive + @client = ::SOAP::RPC::Driver.new("http://localhost:#{Port}/") + @client.add_document_method('echo', 'urn:docrpc:echo', + XSD::QName.new('urn:docrpc', 'echoele'), + XSD::QName.new('urn:docrpc', 'echo_response')) + @client.wiredump_dev = STDOUT if $DEBUG + + echo = SOAPElement.new('foo') + echo.extraattr['attr_string'] = 'attr_string' + echo.extraattr['attr-int'] = 5 + echo.add(struct1 = SOAPElement.new('struct1')) + struct1.add(SOAPElement.new('m_string', 'mystring1')) + struct1.add(SOAPElement.new('m_datetime', '2005-03-17T19:47:31+01:00')) + struct1.extraattr['m_attr'] = 'myattr1' + echo.add(struct2 = SOAPElement.new('struct-2')) + struct2.add(SOAPElement.new('m_string', 'mystring2')) + struct2.add(SOAPElement.new('m_datetime', '2005-03-17T19:47:32+02:00')) + struct2.extraattr['m_attr'] = 'myattr2' + ret = @client.echo(echo) + timeformat = "%Y-%m-%dT%H:%M:%S" + assert_equal('mystring2', ret.struct1.m_string) + assert_equal('2005-03-17T19:47:32', + ret.struct1.m_datetime.strftime(timeformat)) + assert_equal("mystring1", ret.struct_2.m_string) + assert_equal('2005-03-17T19:47:31', + ret.struct_2.m_datetime.strftime(timeformat)) + assert_equal('attr_string', ret.xmlattr_attr_string) + assert_equal(5, ret.xmlattr_attr_int) + + echo = {'struct1' => {'m_string' => 'mystring1', 'm_datetime' => '2005-03-17T19:47:31+01:00'}, + 'struct-2' => {'m_string' => 'mystring2', 'm_datetime' => '2005-03-17T19:47:32+02:00'}} + ret = @client.echo(echo) + timeformat = "%Y-%m-%dT%H:%M:%S" + assert_equal('mystring2', ret.struct1.m_string) + assert_equal('2005-03-17T19:47:32', + ret.struct1.m_datetime.strftime(timeformat)) + assert_equal("mystring1", ret.struct_2.m_string) + assert_equal('2005-03-17T19:47:31', + ret.struct_2.m_datetime.strftime(timeformat)) + end +end + + +end; end diff --git a/ruby_1_8_5/test/wsdl/emptycomplextype.wsdl b/ruby_1_8_5/test/wsdl/emptycomplextype.wsdl new file mode 100644 index 0000000000..4f8dc4849c --- /dev/null +++ b/ruby_1_8_5/test/wsdl/emptycomplextype.wsdl @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<definitions name = "emptycomplextype" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="urn:jp.gr.jin.rrr.example.emptycomplextype" + xmlns="http://schemas.xmlsoap.org/wsdl/"> + + <types> + <xsd:schema elementFormDefault="qualified" + targetNamespace="urn:jp.gr.jin.rrr.example.emptycomplextype"> + <xsd:element name="typeIn"> + <xsd:complexType /> + </xsd:element> + + <xsd:element name="typeOut"> + <xsd:complexType> + <xsd:sequence> + <xsd:element minOccurs="0" maxOccurs="1" name="str1" type="xsd:string" /> + <xsd:element minOccurs="0" maxOccurs="1" name="str2" type="xsd:string" /> + <xsd:element minOccurs="0" maxOccurs="1" name="seq"> + <xsd:complexType> + <xsd:sequence> + <xsd:any /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + </xsd:schema> + </types> +</definitions> diff --git a/ruby_1_8_5/test/wsdl/map/map.wsdl b/ruby_1_8_5/test/wsdl/map/map.wsdl new file mode 100644 index 0000000000..e418a4cbbd --- /dev/null +++ b/ruby_1_8_5/test/wsdl/map/map.wsdl @@ -0,0 +1,92 @@ +<?xml version="1.0"?> +<definitions + 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" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:apachesoap="http://xml.apache.org/xml-soap"> + + <types> + <schema + xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://xml.apache.org/xml-soap"> + <complexType name="Map"> + <sequence> + <element name="item" minOccurs="0" maxOccurs="unbounded"> + <complexType> + <sequence> + <element name="key" type="xsd:anyType" /> + <element name="value" type="xsd:anyType" /> + </sequence> + </complexType> + </element> + </sequence> + </complexType> + </schema> + </types> + + <message name="mapRequest"/> + <message name="mapResponse"> + <part name="return" type="apachesoap:Map"/> + </message> + + <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="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="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="urn:map"/> + </output> + </operation> + </binding> + + <service name="MapService"> + <port name="MapServicePort" binding="tns:MapServicePortBinding"> + <soap:address location="http://raa.ruby-lang.org/soap/1.0.2/"/> + </port> + </service> +</definitions> diff --git a/ruby_1_8_5/test/wsdl/map/map.xml b/ruby_1_8_5/test/wsdl/map/map.xml new file mode 100644 index 0000000000..7106735ffc --- /dev/null +++ b/ruby_1_8_5/test/wsdl/map/map.xml @@ -0,0 +1,43 @@ +<?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> + <n2:mapResponse xmlns:n1="http://schemas.xmlsoap.org/soap/encoding/" xmlns:n2="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/" env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> + <return xmlns:n3="http://xml.apache.org/xml-soap" xsi:type="n3:Map"> + <item> + <key xsi:type="xsd:string">a</key> + <value xsi:type="n3:Map"> + <item> + <key xsi:type="xsd:string">a1</key> + <value xsi:type="n1:Array" n1:arrayType="xsd:anyType[1]"> + <item xsi:type="xsd:string">a1</item> + </value> + </item> + <item> + <key xsi:type="xsd:string">a2</key> + <value xsi:type="n1:Array" n1:arrayType="xsd:anyType[1]"> + <item xsi:type="xsd:string">a2</item> + </value> + </item> + </value> + </item> + <item> + <key xsi:type="xsd:string">b</key> + <value xsi:type="n3:Map"> + <item> + <key xsi:type="xsd:string">b1</key> + <value xsi:type="n1:Array" n1:arrayType="xsd:anyType[1]"> + <item xsi:type="xsd:string">b1</item> + </value> + </item> + <item> + <key xsi:type="xsd:string">b2</key> + <value xsi:type="n1:Array" n1:arrayType="xsd:anyType[1]"> + <item xsi:type="xsd:string">b2</item> + </value> + </item> + </value> + </item> + </return> + </n2:mapResponse> + </env:Body> +</env:Envelope> diff --git a/ruby_1_8_5/test/wsdl/map/test_map.rb b/ruby_1_8_5/test/wsdl/map/test_map.rb new file mode 100644 index 0000000000..68f7d76e05 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/map/test_map.rb @@ -0,0 +1,99 @@ +require 'test/unit' +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( + :BindAddress => "0.0.0.0", + :Port => Port, + :AccessLog => [], + :SOAPDefaultNamespace => "urn:map" + ) + @server.level = Logger::Severity::ERROR + @t = Thread.new { + Thread.current.abort_on_exception = true + @server.start + } + end + + def setup_client + wsdl = File.join(DIR, 'map.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.generate_explicit_type = true + @client.wiredump_dev = STDOUT 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_by_wsdl + dir = File.dirname(File.expand_path(__FILE__)) + wsdlfile = File.join(dir, 'map.wsdl') + xml = File.open(File.join(dir, 'map.xml')) { |f| f.read } + wsdl = WSDL::Importer.import(wsdlfile) + service = wsdl.services[0] + port = service.ports[0] + wsdl_types = wsdl.collect_complextypes + rpc_decode_typemap = wsdl_types + wsdl.soap_rpc_complextypes(port.find_binding) + opt = {} + opt[:default_encodingstyle] = ::SOAP::EncodingNamespace + opt[:decode_typemap] = rpc_decode_typemap + header, body = ::SOAP::Processor.unmarshal(xml, opt) + map = ::SOAP::Mapping.soap2obj(body.response) + assert_equal(["a1"], map["a"]["a1"]) + assert_equal(["a2"], map["a"]["a2"]) + 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 + + +end diff --git a/ruby_1_8_5/test/wsdl/marshal/person.wsdl b/ruby_1_8_5/test/wsdl/marshal/person.wsdl new file mode 100644 index 0000000000..6ea8a04825 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/marshal/person.wsdl @@ -0,0 +1,21 @@ +<?xml version="1.0"?> +<definitions name="Person" + targetNamespace="http://www.jin.gr.jp/~nahi/xmlns/sample/Person" + xmlns:tns="http://www.jin.gr.jp/~nahi/xmlns/sample/Person" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns="http://schemas.xmlsoap.org/wsdl/"> + <types> + <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.jin.gr.jp/~nahi/xmlns/sample/Person"> + <complexType name="Person"> + <all> + <element name="familyname" type="xsd:string"/> + <element name="givenname" type="xsd:string"/> + <element name="var1" type="xsd:int"/> + <element name="var2" type="xsd:double"/> + <element name="var3" type="xsd:string"/> + </all> + </complexType> + </xsd:schema> + </types> +</definitions> diff --git a/ruby_1_8_5/test/wsdl/marshal/person_org.rb b/ruby_1_8_5/test/wsdl/marshal/person_org.rb new file mode 100644 index 0000000000..f8c0e0db76 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/marshal/person_org.rb @@ -0,0 +1,22 @@ +require 'xsd/qname' + +# {http://www.jin.gr.jp/~nahi/xmlns/sample/Person}Person +class Person + @@schema_type = "Person" + @@schema_ns = "http://www.jin.gr.jp/~nahi/xmlns/sample/Person" + @@schema_element = [["familyname", ["SOAP::SOAPString", XSD::QName.new(nil, "familyname")]], ["givenname", ["SOAP::SOAPString", XSD::QName.new(nil, "givenname")]], ["var1", ["SOAP::SOAPInt", XSD::QName.new(nil, "var1")]], ["var2", ["SOAP::SOAPDouble", XSD::QName.new(nil, "var2")]], ["var3", ["SOAP::SOAPString", XSD::QName.new(nil, "var3")]]] + + attr_accessor :familyname + attr_accessor :givenname + attr_accessor :var1 + attr_accessor :var2 + attr_accessor :var3 + + def initialize(familyname = nil, givenname = nil, var1 = nil, var2 = nil, var3 = nil) + @familyname = familyname + @givenname = givenname + @var1 = var1 + @var2 = var2 + @var3 = var3 + end +end diff --git a/ruby_1_8_5/test/wsdl/marshal/test_wsdlmarshal.rb b/ruby_1_8_5/test/wsdl/marshal/test_wsdlmarshal.rb new file mode 100644 index 0000000000..cd2bdb198a --- /dev/null +++ b/ruby_1_8_5/test/wsdl/marshal/test_wsdlmarshal.rb @@ -0,0 +1,80 @@ +require 'test/unit' +require 'wsdl/parser' +require 'soap/mapping/wsdlencodedregistry' +require 'soap/marshal' +require 'wsdl/soap/wsdl2ruby' + +class WSDLMarshaller + include SOAP + + def initialize(wsdlfile) + wsdl = WSDL::Parser.new.parse(File.open(wsdlfile) { |f| f.read }) + types = wsdl.collect_complextypes + @opt = { + :decode_typemap => types, + :generate_explicit_type => false, + :pretty => true + } + @mapping_registry = Mapping::WSDLEncodedRegistry.new(types) + end + + def dump(obj, io = nil) + type = Mapping.class2element(obj.class) + ele = Mapping.obj2soap(obj, @mapping_registry, type) + ele.elename = ele.type + Processor.marshal(SOAPEnvelope.new(nil, SOAPBody.new(ele)), @opt, io) + end + + def load(io) + header, body = Processor.unmarshal(io, @opt) + Mapping.soap2obj(body.root_node) + end +end + + +require File.join(File.dirname(__FILE__), 'person_org') + +class Person + def ==(rhs) + @familyname == rhs.familyname and @givenname == rhs.givenname and + @var1 == rhs.var1 and @var2 == rhs.var2 and @var3 == rhs.var3 + end +end + + +class TestWSDLMarshal < Test::Unit::TestCase + DIR = File.dirname(File.expand_path(__FILE__)) + + def test_marshal + marshaller = WSDLMarshaller.new(pathname('person.wsdl')) + obj = Person.new("NAKAMURA", "Hiroshi", 1, 1.0, "1") + str = marshaller.dump(obj) + obj2 = marshaller.load(str) + assert_equal(obj, obj2) + assert_equal(str, marshaller.dump(obj2)) + end + + def test_classdef + gen = WSDL::SOAP::WSDL2Ruby.new + gen.location = pathname("person.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['classdef'] = nil + gen.opt['force'] = true + gen.run + compare("person_org.rb", "Person.rb") + File.unlink(pathname('Person.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 diff --git a/ruby_1_8_5/test/wsdl/multiplefault.wsdl b/ruby_1_8_5/test/wsdl/multiplefault.wsdl new file mode 100644 index 0000000000..2d928b60b0 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/multiplefault.wsdl @@ -0,0 +1,68 @@ +<?xml version="1.0"?> +<definitions name="MultipleFaultTest" + targetNamespace="urn:jp.gr.jin.rrr.example.ele" + xmlns:tns="urn:jp.gr.jin.rrr.example.ele" + xmlns:typens="urn:jp.gr.jin.rrr.example.datatypes" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns="http://schemas.xmlsoap.org/wsdl/"> + + <types> + <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="urn:jp.gr.jin.rrr.example.datatypes"> + <xsd:complexType name="AuthenticationError"> + <all> + <element name="message" type="xsd:string" /> + <element name="backtrace" type="xoapenc:Array" /> + </all> + </xsd:complexType> + <xsd:complexType name="AuthorizationError"> + <all> + <element name="message" type="xsd:string" /> + <element name="backtrace" type="xoapenc:Array" /> + </all> + </xsd:complexType> + </xsd:schema> + </types> + + <message name="inputmsg"/> + <message name="outputmsg"/> + <message name="faultmsg1" > + <part name="exception" type="typens:AuthenticationError" /> + </message> + <message name="faultmsg2" > + <part name="exception" type="typens:AuthorizationError" /> + </message> + + <portType name="MultipleFaultPortType"> + <operation name="myoperation"> + <input message="tns:inputmsg"/> + <output message="tns:outputmsg"/> + <fault message="tns:faultmsg1"/> + <fault message="tns:faultmsg2"/> + </operation> + </portType> + + <binding name="MultipleFaultBinding" type="tns:MultipleFaultPortType"> + <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> + <operation name="myoperation"> + <soap:operation soapAction="urn:jp.gr.jin.rrr.example.ele"/> + <input> + <soap:body use="encoded" namespace="urn:jp.gr.jin.rrr.example.ele" + encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> + </input> + <output> + <soap:body use="encoded" namespace="urn:jp.gr.jin.rrr.example.ele" + encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> + </output> + </operation> + </binding> + + <service name="MultipleFaultService"> + <port name="MultipleFaultPortType" binding="tns:MultipleFaultBinding"> + <soap:address location="http://localhost:17171/"/> + </port> + </service> +</definitions> diff --git a/ruby_1_8_5/test/wsdl/qualified/lp.rb b/ruby_1_8_5/test/wsdl/qualified/lp.rb new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/qualified/lp.rb diff --git a/ruby_1_8_5/test/wsdl/qualified/lp.wsdl b/ruby_1_8_5/test/wsdl/qualified/lp.wsdl new file mode 100644 index 0000000000..b107b7b392 --- /dev/null +++ b/ruby_1_8_5/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/ruby_1_8_5/test/wsdl/qualified/lp.xsd b/ruby_1_8_5/test/wsdl/qualified/lp.xsd new file mode 100644 index 0000000000..12bcbd8cef --- /dev/null +++ b/ruby_1_8_5/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/ruby_1_8_5/test/wsdl/qualified/np.wsdl b/ruby_1_8_5/test/wsdl/qualified/np.wsdl new file mode 100644 index 0000000000..e2b7253d0e --- /dev/null +++ b/ruby_1_8_5/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/ruby_1_8_5/test/wsdl/qualified/test_qualified.rb b/ruby_1_8_5/test/wsdl/qualified/test_qualified.rb new file mode 100644 index 0000000000..d6c1159a87 --- /dev/null +++ b/ruby_1_8_5/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/ruby_1_8_5/test/wsdl/qualified/test_unqualified.rb b/ruby_1_8_5/test/wsdl/qualified/test_unqualified.rb new file mode 100644 index 0000000000..bcfed73e58 --- /dev/null +++ b/ruby_1_8_5/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/ruby_1_8_5/test/wsdl/raa/RAA.rb b/ruby_1_8_5/test/wsdl/raa/RAA.rb new file mode 100644 index 0000000000..aff0525480 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/raa/RAA.rb @@ -0,0 +1,243 @@ +# http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/ +class Category + @@schema_type = "Category" + @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/" + + def major + @major + end + + def major=(value) + @major = value + end + + def minor + @minor + end + + def minor=(value) + @minor = value + end + + def initialize(major = nil, + minor = nil) + @major = major + @minor = minor + end +end + +# http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/ +class Product + @@schema_type = "Product" + @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/" + + def id + @id + end + + def id=(value) + @id = value + end + + def name + @name + end + + def name=(value) + @name = value + end + + def short_description + @short_description + end + + def short_description=(value) + @short_description = value + end + + def version + @version + end + + def version=(value) + @version = value + end + + def status + @status + end + + def status=(value) + @status = value + end + + def homepage + @homepage + end + + def homepage=(value) + @homepage = value + end + + def download + @download + end + + def download=(value) + @download = value + end + + def license + @license + end + + def license=(value) + @license = value + end + + def description + @description + end + + def description=(value) + @description = value + end + + def initialize(id = nil, + name = nil, + short_description = nil, + version = nil, + status = nil, + homepage = nil, + download = nil, + license = nil, + description = nil) + @id = id + @name = name + @short_description = short_description + @version = version + @status = status + @homepage = homepage + @download = download + @license = license + @description = description + end +end + +# http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/ +class Owner + @@schema_type = "Owner" + @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/" + + def id + @id + end + + def id=(value) + @id = value + end + + def email + @email + end + + def email=(value) + @email = value + end + + def name + @name + end + + def name=(value) + @name = value + end + + def initialize(id = nil, + email = nil, + name = nil) + @id = id + @email = email + @name = name + end +end + +# http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/ +class Info + @@schema_type = "Info" + @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/" + + def category + @category + end + + def category=(value) + @category = value + end + + def product + @product + end + + def product=(value) + @product = value + end + + def owner + @owner + end + + def owner=(value) + @owner = value + end + + def created + @created + end + + def created=(value) + @created = value + end + + def updated + @updated + end + + def updated=(value) + @updated = value + end + + def initialize(category = nil, + product = nil, + owner = nil, + created = nil, + updated = nil) + @category = category + @product = product + @owner = owner + @created = created + @updated = updated + end +end + +# http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/ +class InfoArray < Array + # Contents type should be dumped here... + @@schema_type = "InfoArray" + @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/" +end + +# http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/ +class StringArray < Array + # Contents type should be dumped here... + @@schema_type = "StringArray" + @@schema_ns = "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/" +end + +# http://xml.apache.org/xml-soap +class Map < Array + # Contents type should be dumped here... + @@schema_type = "Map" + @@schema_ns = "http://xml.apache.org/xml-soap" +end + diff --git a/ruby_1_8_5/test/wsdl/raa/RAAServant.rb b/ruby_1_8_5/test/wsdl/raa/RAAServant.rb new file mode 100644 index 0000000000..68380f8e48 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/raa/RAAServant.rb @@ -0,0 +1,99 @@ +class RAABaseServicePortType + # SYNOPSIS + # getAllListings + # + # ARGS + # N/A + # + # RETURNS + # return StringArray - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}StringArray + # + # RAISES + # (undefined) + # + def getAllListings + #raise NotImplementedError.new + ["ruby", "soap4r"] + end + + # SYNOPSIS + # getProductTree + # + # ARGS + # N/A + # + # RETURNS + # return Map - {http://xml.apache.org/xml-soap}Map + # + # RAISES + # (undefined) + # + def getProductTree + raise NotImplementedError.new + end + + # SYNOPSIS + # getInfoFromCategory(category) + # + # ARGS + # category Category - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}Category + # + # RETURNS + # return InfoArray - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}InfoArray + # + # RAISES + # (undefined) + # + def getInfoFromCategory(category) + raise NotImplementedError.new + end + + # SYNOPSIS + # getModifiedInfoSince(timeInstant) + # + # ARGS + # timeInstant - {http://www.w3.org/2001/XMLSchema}dateTime + # + # RETURNS + # return InfoArray - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}InfoArray + # + # RAISES + # (undefined) + # + def getModifiedInfoSince(timeInstant) + raise NotImplementedError.new + end + + # SYNOPSIS + # getInfoFromName(productName) + # + # ARGS + # productName - {http://www.w3.org/2001/XMLSchema}string + # + # RETURNS + # return Info - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}Info + # + # RAISES + # (undefined) + # + def getInfoFromName(productName) + raise NotImplementedError.new + end + + # SYNOPSIS + # getInfoFromOwnerId(ownerId) + # + # ARGS + # ownerId - {http://www.w3.org/2001/XMLSchema}int + # + # RETURNS + # return InfoArray - {http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/}InfoArray + # + # RAISES + # (undefined) + # + def getInfoFromOwnerId(ownerId) + raise NotImplementedError.new + end +end + diff --git a/ruby_1_8_5/test/wsdl/raa/RAAService.rb b/ruby_1_8_5/test/wsdl/raa/RAAService.rb new file mode 100644 index 0000000000..9d0813304c --- /dev/null +++ b/ruby_1_8_5/test/wsdl/raa/RAAService.rb @@ -0,0 +1,100 @@ +#!/usr/bin/env ruby +require 'RAAServant.rb' + +require 'soap/rpc/standaloneServer' + +class RAABaseServicePortType + MappingRegistry = SOAP::Mapping::Registry.new + + MappingRegistry.set( + StringArray, + ::SOAP::SOAPArray, + ::SOAP::Mapping::Registry::TypedArrayFactory, + { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "string") } + ) + MappingRegistry.set( + Map, + ::SOAP::SOAPArray, + ::SOAP::Mapping::Registry::TypedArrayFactory, + { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "anyType") } + ) + MappingRegistry.set( + Category, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Category") } + ) + MappingRegistry.set( + InfoArray, + ::SOAP::SOAPArray, + ::SOAP::Mapping::Registry::TypedArrayFactory, + { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info") } + ) + MappingRegistry.set( + Info, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info") } + ) + MappingRegistry.set( + Product, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Product") } + ) + MappingRegistry.set( + Owner, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Owner") } + ) + + + Methods = [ + ["getAllListings", "getAllListings", [ + ["retval", "return", + [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "string"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"], + ["getProductTree", "getProductTree", [ + ["retval", "return", + [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "anyType"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"], + ["getInfoFromCategory", "getInfoFromCategory", [ + ["in", "category", + [::SOAP::SOAPStruct, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Category"]], + ["retval", "return", + [::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"], + ["getModifiedInfoSince", "getModifiedInfoSince", [ + ["in", "timeInstant", + [SOAP::SOAPDateTime]], + ["retval", "return", + [::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"], + ["getInfoFromName", "getInfoFromName", [ + ["in", "productName", + [SOAP::SOAPString]], + ["retval", "return", + [::SOAP::SOAPStruct, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"], + ["getInfoFromOwnerId", "getInfoFromOwnerId", [ + ["in", "ownerId", + [SOAP::SOAPInt]], + ["retval", "return", + [::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"] + ] +end + +class App < SOAP::RPC::StandaloneServer + def initialize(*arg) + super + + servant = RAABaseServicePortType.new + RAABaseServicePortType::Methods.each do |name_as, name, params, soapaction, namespace| + qname = XSD::QName.new(namespace, name_as) + @router.add_method(servant, qname, soapaction, name, params) + end + + self.mapping_registry = RAABaseServicePortType::MappingRegistry + end +end + +# Change listen port. +if $0 == __FILE__ + App.new('app', nil, '0.0.0.0', 10080).start +end diff --git a/ruby_1_8_5/test/wsdl/raa/README.txt b/ruby_1_8_5/test/wsdl/raa/README.txt new file mode 100644 index 0000000000..efbaf9d87c --- /dev/null +++ b/ruby_1_8_5/test/wsdl/raa/README.txt @@ -0,0 +1,8 @@ +RAAServant.rb: based on the file which is generated with the following command; + bin/wsdl2ruby.rb --wsdl raa.wsdl --servant_skelton --force + +RAAService.rb: generated with the following command; + bin/wsdl2ruby.rb --wsdl raa.wsdl --standalone_server_stub --force + +RAA.rb: generated with the following command; + bin/wsdl2ruby.rb --wsdl raa.wsdl --classdef --force diff --git a/ruby_1_8_5/test/wsdl/raa/raa.wsdl b/ruby_1_8_5/test/wsdl/raa/raa.wsdl new file mode 100644 index 0000000000..78376893dd --- /dev/null +++ b/ruby_1_8_5/test/wsdl/raa/raa.wsdl @@ -0,0 +1,264 @@ +<?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/" + xmlns="http://schemas.xmlsoap.org/wsdl/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" + xmlns:apachesoap="http://xml.apache.org/xml-soap"> + + <types> + <schema + xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"> + + <complexType name="Category"> + <all> + <element name="major" type="string"/> + <element name="minor" type="string"/> + </all> + </complexType> + + <complexType name="Product"> + <all> + <element name="id" type="int"/> + <element name="name" type="string"/> + <element name="short_description" type="string"/> + <element name="version" type="string"/> + <element name="status" type="string"/> + <element name="homepage" type="anyURI"/> + <element name="download" type="anyURI"/> + <element name="license" type="string"/> + <element name="description" type="string"/> + </all> + </complexType> + + <complexType name="Owner"> + <all> + <element name="id" type="int"/> + <element name="email" type="anyURI"/> + <element name="name" type="string"/> + </all> + </complexType> + + <complexType name="Info"> + <all> + <element name="category" type="txd:Category"/> + <element name="product" type="txd:Product"/> + <element name="owner" type="txd:Owner"/> + <element name="created" type="xsd:dateTime"/> + <element name="updated" type="xsd:dateTime"/> + </all> + </complexType> + + <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/> + <complexType name="InfoArray"> + <complexContent> + <restriction base="soapenc:Array"> + <attribute ref="soapenc:arrayType" wsdl:arrayType="txd:Info[]"/> + </restriction> + </complexContent> + </complexType> + + <complexType name="StringArray"> + <complexContent> + <restriction base="soapenc:Array"> + <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/> + </restriction> + </complexContent> + </complexType> + </schema> + + <!-- type definition for ApacheSOAP's Map --> + <schema + xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://xml.apache.org/xml-soap"> + <complexType name="Map"> + <sequence> + <element name="item" minOccurs="0" maxOccurs="unbounded"> + <complexType> + <sequence> + <element name="key" type="anyType" /> + <element name="value" type="anyType" /> + </sequence> + </complexType> + </element> + </sequence> + </complexType> + </schema> + </types> + + <message name="getAllListingsRequest"/> + <message name="getAllListingsResponse"> + <part name="return" type="txd:StringArray"/> + </message> + + <message name="getProductTreeRequest"/> + <message name="getProductTreeResponse"> + <part name="return" type="apachesoap:Map"/> + </message> + + <message name="getInfoFromCategoryRequest"> + <part name="category" type="txd:Category"/> + </message> + <message name="getInfoFromCategoryResponse"> + <part name="return" type="txd:InfoArray"/> + </message> + + <message name="getModifiedInfoSinceRequest"> + <part name="timeInstant" type="xsd:dateTime"/> + </message> + <message name="getModifiedInfoSinceResponse"> + <part name="return" type="txd:InfoArray"/> + </message> + + <message name="getInfoFromNameRequest"> + <part name="productName" type="xsd:string"/> + </message> + <message name="getInfoFromNameResponse"> + <part name="return" type="txd:Info"/> + </message> + + <message name="getInfoFromOwnerIdRequest"> + <part name="ownerId" type="xsd:int"/> + </message> + <message name="getInfoFromOwnerIdResponse"> + <part name="return" type="txd:InfoArray"/> + </message> + + <portType name="RAABaseServicePortType"> + <operation name="getAllListings" + parameterOrder=""> + <input message="tns:getAllListingsRequest"/> + <output message="tns:getAllListingsResponse"/> + </operation> + + <operation name="getProductTree" + parameterOrder=""> + <input message="tns:getProductTreeRequest"/> + <output message="tns:getProductTreeResponse"/> + </operation> + + <operation name="getInfoFromCategory" + parameterOrder="category"> + <input message="tns:getInfoFromCategoryRequest"/> + <output message="tns:getInfoFromCategoryResponse"/> + </operation> + + <operation name="getModifiedInfoSince" + parameterOrder="timeInstant"> + <input message="tns:getModifiedInfoSinceRequest"/> + <output message="tns:getModifiedInfoSinceResponse"/> + </operation> + + <operation name="getInfoFromName" + parameterOrder="productName"> + <input message="tns:getInfoFromNameRequest"/> + <output message="tns:getInfoFromNameResponse"/> + </operation> + + <operation name="getInfoFromOwnerId" + parameterOrder="ownerId"> + <input message="tns:getInfoFromOwnerIdRequest"/> + <output message="tns:getInfoFromOwnerIdResponse"/> + </operation> + </portType> + + <binding name="RAABaseServicePortBinding" type="tns:RAABaseServicePortType"> + <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> + + <operation name="getAllListings"> + <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/"/> + </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/"/> + </output> + </operation> + + <operation name="getProductTree"> + <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/"/> + </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/"/> + </output> + </operation> + + <operation name="getInfoFromCategory"> + <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/"/> + </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/"/> + </output> + </operation> + + <operation name="getModifiedInfoSince"> + <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/"/> + </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/"/> + </output> + </operation> + + <operation name="getInfoFromName"> + <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/"/> + </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/"/> + </output> + </operation> + + <operation name="getInfoFromOwnerId"> + <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/"/> + </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/"/> + </output> + </operation> + </binding> + + <service name="RAAService"> + <port name="RAABaseServicePort" binding="tns:RAABaseServicePortBinding"> + <soap:address location="http://raa.ruby-lang.org/soap/1.0.2/"/> + </port> + </service> +</definitions> diff --git a/ruby_1_8_5/test/wsdl/raa/server.rb b/ruby_1_8_5/test/wsdl/raa/server.rb new file mode 100644 index 0000000000..87bbc6f569 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/raa/server.rb @@ -0,0 +1,103 @@ +#!/usr/bin/env ruby +require 'soap/rpc/standaloneServer' +require 'RAA.rb' + +class RAABaseServicePortType + MappingRegistry = SOAP::Mapping::Registry.new + + MappingRegistry.set( + StringArray, + ::SOAP::SOAPArray, + ::SOAP::Mapping::Registry::TypedArrayFactory, + { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "string") } + ) + MappingRegistry.set( + Map, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + { :type => XSD::QName.new("http://xml.apache.org/xml-soap", "Map") } + ) + MappingRegistry.set( + Category, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Category") } + ) + MappingRegistry.set( + InfoArray, + ::SOAP::SOAPArray, + ::SOAP::Mapping::Registry::TypedArrayFactory, + { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info") } + ) + MappingRegistry.set( + Info, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info") } + ) + MappingRegistry.set( + Product, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Product") } + ) + MappingRegistry.set( + Owner, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + { :type => XSD::QName.new("http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Owner") } + ) + + Methods = [ + ["getAllListings", "getAllListings", [ + ["retval", "return", + [::SOAP::SOAPArray, "http://www.w3.org/2001/XMLSchema", "string"]]], + "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"], + ["getProductTree", "getProductTree", [ + ["retval", "return", + [::SOAP::SOAPStruct, "http://xml.apache.org/xml-soap", "Map"]]], + "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"], + ["getInfoFromCategory", "getInfoFromCategory", [ + ["in", "category", + [::SOAP::SOAPStruct, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Category"]], + ["retval", "return", + [::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], + "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"], + ["getModifiedInfoSince", "getModifiedInfoSince", [ + ["in", "timeInstant", + [SOAP::SOAPDateTime]], + ["retval", "return", + [::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], + "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"], + ["getInfoFromName", "getInfoFromName", [ + ["in", "productName", + [SOAP::SOAPString]], + ["retval", "return", + [::SOAP::SOAPStruct, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], + "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"], + ["getInfoFromOwnerId", "getInfoFromOwnerId", [ + ["in", "ownerId", + [SOAP::SOAPInt]], + ["retval", "return", + [::SOAP::SOAPArray, "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/", "Info"]]], + "", "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"] + ] + + def getAllListings + ["ruby", "soap4r"] + end +end + +class RAABaseServiceServer < SOAP::RPC::StandaloneServer + def initialize(*arg) + super + + servant = RAABaseServicePortType.new + RAABaseServicePortType::Methods.each do |name_as, name, params, soapaction, namespace| + qname = XSD::QName.new(namespace, name_as) + @router.add_method(servant, qname, soapaction, name, params) + end + + self.mapping_registry = RAABaseServicePortType::MappingRegistry + end +end diff --git a/ruby_1_8_5/test/wsdl/raa/test_raa.rb b/ruby_1_8_5/test/wsdl/raa/test_raa.rb new file mode 100644 index 0000000000..0b00042ffb --- /dev/null +++ b/ruby_1_8_5/test/wsdl/raa/test_raa.rb @@ -0,0 +1,71 @@ +require 'test/unit' +require 'soap/wsdlDriver' +require 'RAA.rb' +require 'RAAServant.rb' +require 'RAAService.rb' + + +module WSDL +module RAA + + +class TestRAA < Test::Unit::TestCase + DIR = File.dirname(File.expand_path(__FILE__)) + + Port = 17171 + + def setup + setup_server + setup_client + end + + def setup_server + @server = App.new('RAA server', nil, '0.0.0.0', Port) + @server.level = Logger::Severity::ERROR + @t = Thread.new { + Thread.current.abort_on_exception = true + @server.start + } + end + + def setup_client + wsdl = File.join(DIR, 'raa.wsdl') + @raa = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @raa.endpoint_url = "http://localhost:#{Port}/" + end + + def teardown + teardown_server + teardown_client + end + + def teardown_server + @server.shutdown + @t.kill + @t.join + end + + def teardown_client + @raa.reset_stream + end + + def test_raa + assert_equal(["ruby", "soap4r"], @raa.getAllListings) + end + + def foo + p @raa.getProductTree() + p @raa.getInfoFromCategory(Category.new("Library", "XML")) + t = Time.at(Time.now.to_i - 24 * 3600) + p @raa.getModifiedInfoSince(t) + p @raa.getModifiedInfoSince(DateTime.new(t.year, t.mon, t.mday, t.hour, t.min, t.sec)) + o = @raa.getInfoFromName("SOAP4R") + p o.type + p o.owner.name + p o + end +end + + +end +end diff --git a/ruby_1_8_5/test/wsdl/ref/expectedProduct.rb b/ruby_1_8_5/test/wsdl/ref/expectedProduct.rb new file mode 100644 index 0000000000..91c6e4c566 --- /dev/null +++ b/ruby_1_8_5/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/ruby_1_8_5/test/wsdl/ref/product.wsdl b/ruby_1_8_5/test/wsdl/ref/product.wsdl new file mode 100644 index 0000000000..993fe217aa --- /dev/null +++ b/ruby_1_8_5/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/ruby_1_8_5/test/wsdl/ref/test_ref.rb b/ruby_1_8_5/test/wsdl/ref/test_ref.rb new file mode 100644 index 0000000000..9e29fa31e0 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/ref/test_ref.rb @@ -0,0 +1,54 @@ +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 + suppress_warning do + gen.run + end + 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 + + def suppress_warning + back = $VERBOSE + $VERBOSE = nil + begin + yield + ensure + $VERBOSE = back + end + end +end + + +end +end diff --git a/ruby_1_8_5/test/wsdl/rpc/echoDriver.rb b/ruby_1_8_5/test/wsdl/rpc/echoDriver.rb new file mode 100644 index 0000000000..51e82076e7 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/rpc/echoDriver.rb @@ -0,0 +1,55 @@ +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( + Person, + ::SOAP::SOAPStruct, + ::SOAP::Mapping::Registry::TypedStructFactory, + { :type => XSD::QName.new("urn:rpc-type", "person") } + ) + + Methods = [ + ["echo", "echo", + [ + ["in", "arg1", [::SOAP::SOAPStruct, "urn:rpc-type", "person"]], + ["in", "arg2", [::SOAP::SOAPStruct, "urn:rpc-type", "person"]], + ["retval", "return", [::SOAP::SOAPStruct, "urn:rpc-type", "person"]] + ], + "", "urn:rpc", :rpc + ] + ] + + 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 |name_as, name, params, soapaction, namespace, style| + qname = XSD::QName.new(namespace, name_as) + if style == :document + @proxy.add_document_method(soapaction, name, params) + add_document_method_interface(name, params) + else + @proxy.add_rpc_method(qname, soapaction, name, params) + add_rpc_method_interface(name, params) + end + if name_as != name and name_as.capitalize == name.capitalize + sclass = class << self; self; end + sclass.__send__(:define_method, name_as, proc { |*arg| + __send__(name, *arg) + }) + end + end + end +end + diff --git a/ruby_1_8_5/test/wsdl/rpc/echo_serviceClient.rb b/ruby_1_8_5/test/wsdl/rpc/echo_serviceClient.rb new file mode 100644 index 0000000000..40264834e9 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/rpc/echo_serviceClient.rb @@ -0,0 +1,23 @@ +#!/usr/bin/env ruby +require 'echoDriver.rb' + +endpoint_url = ARGV.shift +obj = Echo_port_type.new(endpoint_url) + +# Uncomment the below line to see SOAP wiredumps. +# obj.wiredump_dev = STDERR + +# SYNOPSIS +# echo(arg1, arg2) +# +# ARGS +# arg1 Person - {urn:rpc-type}person +# arg2 Person - {urn:rpc-type}person +# +# RETURNS +# v_return Person - {urn:rpc-type}person +# +arg1 = arg2 = nil +puts obj.echo(arg1, arg2) + + diff --git a/ruby_1_8_5/test/wsdl/rpc/rpc.wsdl b/ruby_1_8_5/test/wsdl/rpc/rpc.wsdl new file mode 100644 index 0000000000..b0ee5c5e56 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/rpc/rpc.wsdl @@ -0,0 +1,75 @@ +<?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:rpc" + xmlns:txd="urn:rpc-type" + targetNamespace="urn:rpc" + xmlns="http://schemas.xmlsoap.org/wsdl/"> + <types> + <xsd:schema targetNamespace="urn:rpc-type"> + <xsd:complexType name="person"> + <xsd:all> + <xsd:element name="family-name" type="xsd:string" /> + <xsd:element name="given_name" type="xsd:string" /> + <xsd:element name="age" type="xsd:int" /> + <xsd:element name="link" type="txd:person" /> + </xsd:all> + </xsd:complexType> + </xsd:schema> + </types> + + <message name="echo_in"> + <part name="arg1" type="txd:person"/> + <part name="arg2" type="txd:person"/> + </message> + + <message name="echo_out"> + <part name="return" type="txd:person"/> + </message> + + <portType name="echo_port_type"> + <operation name="echo"> + <input message="tns:echo_in"/> + <output message="tns:echo_out"/> + </operation> + + <operation name="echo_err"> + <input message="tns:echo_in"/> + <output message="tns:echo_out"/> + </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=""/> + <input> + <soap:body use="encoded" namespace="urn:rpc" + encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> + </input> + <output> + <soap:body use="encoded" namespace="urn:rpc" + encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> + </output> + </operation> + + <operation name="echo_err"> + <soap:operation soapAction=""/> + <input> + <soap:body use="encoded" namespace="urn:rpc" + encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> + </input> + <output> + <soap:body use="encoded" namespace="urn:rpc" + 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/ruby_1_8_5/test/wsdl/rpc/test-rpc-lit.wsdl b/ruby_1_8_5/test/wsdl/rpc/test-rpc-lit.wsdl new file mode 100644 index 0000000000..72de747e36 --- /dev/null +++ b/ruby_1_8_5/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/ruby_1_8_5/test/wsdl/rpc/test-rpc-lit12.wsdl b/ruby_1_8_5/test/wsdl/rpc/test-rpc-lit12.wsdl new file mode 100644 index 0000000000..901cde6f9c --- /dev/null +++ b/ruby_1_8_5/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/ruby_1_8_5/test/wsdl/rpc/test_rpc.rb b/ruby_1_8_5/test/wsdl/rpc/test_rpc.rb new file mode 100644 index 0000000000..7c4c3a7ad6 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/rpc/test_rpc.rb @@ -0,0 +1,118 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/wsdl2ruby' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' + + +module WSDL; module RPC + + +class TestRPC < Test::Unit::TestCase + class Server < ::SOAP::RPC::StandaloneServer + def on_init + self.generate_explicit_type = false + add_rpc_method(self, 'echo', 'arg1', 'arg2') + add_rpc_method(self, 'echo_err', 'arg1', 'arg2') + end + + DummyPerson = Struct.new("family-name".intern, :given_name) + def echo(arg1, arg2) + case arg1.family_name + when 'normal' + arg1.family_name = arg2.family_name + arg1.given_name = arg2.given_name + arg1.age = arg2.age + arg1 + when 'dummy' + DummyPerson.new("family-name", "given_name") + else + raise + end + end + + ErrPerson = Struct.new(:given_name, :no_such_element) + def echo_err(arg1, arg2) + ErrPerson.new(58, Time.now) + end + end + + DIR = File.dirname(File.expand_path(__FILE__)) + + Port = 17171 + + def setup + setup_server + setup_classdef + @client = nil + end + + def teardown + teardown_server + File.unlink(pathname('echo.rb')) + @client.reset_stream if @client + end + + def setup_server + @server = Server.new('Test', "urn:rpc", '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("rpc.wsdl") + gen.basedir = DIR + gen.logger.level = Logger::FATAL + gen.opt['classdef'] = nil + gen.opt['force'] = true + gen.run + require pathname('echo') + 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 + wsdl = File.join(DIR, 'rpc.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.wiredump_dev = STDOUT if $DEBUG + + ret = @client.echo(Person.new("normal", "", 12), Person.new("Hi", "Na", 21)) + assert_equal(Person, ret.class) + assert_equal("Hi", ret.family_name) + assert_equal("Na", ret.given_name) + assert_equal(21, ret.age) + + ret = @client.echo(Person.new("dummy", "", 12), Person.new("Hi", "Na", 21)) + assert_equal(Person, ret.class) + assert_equal("family-name", ret.family_name) + assert_equal("given_name", ret.given_name) + assert_equal(nil, ret.age) + + ret = @client.echo_err(Person.new("Na", "Hi"), Person.new("Hi", "Na")) + assert_equal(Person, ret.class) + assert_equal("58", ret.given_name) + assert_equal(nil, ret.family_name) + assert_equal(nil, ret.age) + end +end + + +end; end diff --git a/ruby_1_8_5/test/wsdl/rpc/test_rpc_lit.rb b/ruby_1_8_5/test/wsdl/rpc/test_rpc_lit.rb new file mode 100644 index 0000000000..080dbb82cf --- /dev/null +++ b/ruby_1_8_5/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/ruby_1_8_5/test/wsdl/simpletype/rpc/expectedClient.rb b/ruby_1_8_5/test/wsdl/simpletype/rpc/expectedClient.rb new file mode 100644 index 0000000000..55eb58c3dd --- /dev/null +++ b/ruby_1_8_5/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/ruby_1_8_5/test/wsdl/simpletype/rpc/expectedDriver.rb b/ruby_1_8_5/test/wsdl/simpletype/rpc/expectedDriver.rb new file mode 100644 index 0000000000..81c72d1acf --- /dev/null +++ b/ruby_1_8_5/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/ruby_1_8_5/test/wsdl/simpletype/rpc/expectedEchoVersion.rb b/ruby_1_8_5/test/wsdl/simpletype/rpc/expectedEchoVersion.rb new file mode 100644 index 0000000000..806ece1626 --- /dev/null +++ b/ruby_1_8_5/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/ruby_1_8_5/test/wsdl/simpletype/rpc/expectedServant.rb b/ruby_1_8_5/test/wsdl/simpletype/rpc/expectedServant.rb new file mode 100644 index 0000000000..81cf50218e --- /dev/null +++ b/ruby_1_8_5/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/ruby_1_8_5/test/wsdl/simpletype/rpc/expectedService.rb b/ruby_1_8_5/test/wsdl/simpletype/rpc/expectedService.rb new file mode 100644 index 0000000000..be6f996562 --- /dev/null +++ b/ruby_1_8_5/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/ruby_1_8_5/test/wsdl/simpletype/rpc/rpc.wsdl b/ruby_1_8_5/test/wsdl/simpletype/rpc/rpc.wsdl new file mode 100644 index 0000000000..91f71a8831 --- /dev/null +++ b/ruby_1_8_5/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/ruby_1_8_5/test/wsdl/simpletype/rpc/test_rpc.rb b/ruby_1_8_5/test/wsdl/simpletype/rpc/test_rpc.rb new file mode 100644 index 0000000000..fdd55552d0 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/simpletype/rpc/test_rpc.rb @@ -0,0 +1,62 @@ +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 + suppress_warning do + gen.run + end + 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 + + def suppress_warning + back = $VERBOSE + $VERBOSE = nil + begin + yield + ensure + $VERBOSE = back + end + end +end + + +end; end diff --git a/ruby_1_8_5/test/wsdl/simpletype/simpletype.wsdl b/ruby_1_8_5/test/wsdl/simpletype/simpletype.wsdl new file mode 100644 index 0000000000..623969c794 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/simpletype/simpletype.wsdl @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="utf-8"?> +<definitions name="ping_service" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:tns="urn:example.com:simpletype" + targetNamespace="urn:example.com:simpletype" + xmlns="http://schemas.xmlsoap.org/wsdl/"> + <types> + <xsd:schema targetNamespace="urn:example.com:simpletype"> + <xsd:element name="ruby"> + <xsd:complexType> + <xsd:sequence> + <xsd:element minOccurs="1" maxOccurs="1" name="myversion" type="tns:myversion"/> + <xsd:element minOccurs="0" maxOccurs="1" name="date" type="xsd:dateTime"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:simpleType name="myversion"> + <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:element name="myid" type="tns:ID"/> + + <xsd:simpleType name="ID"> + <xsd:restriction base="xsd:string"> + <xsd:length value="18"/> + <xsd:pattern value='[a-zA-Z0-9]{18}'/> + </xsd:restriction> + </xsd:simpleType> + </xsd:schema> + </types> + + <message name="ping_in"> + <part name="parameters" element="tns:ruby"/> + </message> + + <message name="ping_out"> + <part name="parameters" type="xsd:string"/> + </message> + + <message name="ping_id_in"> + <part name="parameters" element="tns:myid"/> + </message> + + <message name="ping_id_out"> + <part name="parameters" element="tns:myid"/> + </message> + + <message name="versionmsg"> + <part name="myversion" element="tns:myversion"/> + </message> + + <portType name="ping_port_type"> + <operation name="ping"> + <input message="tns:ping_in"/> + <output message="tns:ping_out"/> + </operation> + + <operation name="ping_id"> + <input message="tns:ping_id_in"/> + <output message="tns:ping_id_out"/> + </operation> + + <operation name="echo_version"> + <input message="tns:versionmsg"/> + <output message="tns:versionmsg"/> + </operation> + </portType> + + <binding name="ping_binding" type="tns:ping_port_type"> + <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> + <operation name="ping"> + <soap:operation soapAction="urn:example.com:simpletype:ping" style="document"/> + <input><soap:body use="literal"/></input> + <output><soap:body use="literal"/></output> + </operation> + + <operation name="ping_id"> + <soap:operation soapAction="urn:example.com:simpletype:ping_id" style="document"/> + <input><soap:body use="literal"/></input> + <output><soap:body use="literal"/></output> + </operation> + </binding> + + <service name="ping_service"> + <port name="ping_port" binding="tns:ping_binding"> + <soap:address location="http://localhost:10080"/> + </port> + </service> +</definitions> diff --git a/ruby_1_8_5/test/wsdl/simpletype/test_simpletype.rb b/ruby_1_8_5/test/wsdl/simpletype/test_simpletype.rb new file mode 100644 index 0000000000..7e644c3042 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/simpletype/test_simpletype.rb @@ -0,0 +1,99 @@ +require 'test/unit' +require 'soap/rpc/standaloneServer' +require 'soap/wsdlDriver' + + +module WSDL +module SimpleType + + +class TestSimpleType < Test::Unit::TestCase + class Server < ::SOAP::RPC::StandaloneServer + def on_init + add_document_method(self, 'urn:example.com:simpletype:ping', 'ping', + XSD::QName.new('urn:example.com:simpletype', 'ruby'), + XSD::QName.new('http://www.w3.org/2001/XMLSchema', 'string')) + add_document_method(self, 'urn:example.com:simpletype:ping_id', 'ping_id', + XSD::QName.new('urn:example.com:simpletype', 'myid'), + XSD::QName.new('urn:example.com:simpletype', 'myid')) + end + + def ping(ruby) + version = ruby["myversion"] + date = ruby["date"] + "#{version} (#{date})" + end + + def ping_id(id) + id + 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:example.com:simpletype", '0.0.0.0', Port) + @server.level = Logger::Severity::ERROR + @server_thread = start_server_thread(@server) + end + + def setup_client + wsdl = File.join(DIR, 'simpletype.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver + @client.endpoint_url = "http://localhost:#{Port}/" + @client.generate_explicit_type = false + @client.wiredump_dev = STDOUT if $DEBUG + end + + def teardown + teardown_server + teardown_client + 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 test_ping + ret = @client.ping({:myversion => "1.9", :date => "2004-01-01T00:00:00Z"}) + assert_equal("1.9 (2004-01-01T00:00:00Z)", ret) + end + + def test_ping_id + ret = @client.ping_id("012345678901234567") + assert_equal("012345678901234567", ret) + # length + assert_raise(XSD::ValueSpaceError) do + @client.ping_id("0123456789012345678") + end + # pattern + assert_raise(XSD::ValueSpaceError) do + @client.ping_id("01234567890123456;") + end + end +end + + +end +end diff --git a/ruby_1_8_5/test/wsdl/soap/soapbodyparts.wsdl b/ruby_1_8_5/test/wsdl/soap/soapbodyparts.wsdl new file mode 100644 index 0000000000..0e6da0ebee --- /dev/null +++ b/ruby_1_8_5/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/ruby_1_8_5/test/wsdl/soap/test_soapbodyparts.rb b/ruby_1_8_5/test/wsdl/soap/test_soapbodyparts.rb new file mode 100644 index 0000000000..291319aedf --- /dev/null +++ b/ruby_1_8_5/test/wsdl/soap/test_soapbodyparts.rb @@ -0,0 +1,79 @@ +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', 'p3') + add_method(self, 'bar', 'p1', 'p2', 'p3') + add_method(self, 'baz', 'p1', 'p2', 'p3') + end + + def foo(p1, p2, p3) + [p1, p2, p3] + end + + alias bar foo + + def baz(p1, p2, p3) + [p3, p2, p1] + 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 + } + end + + def setup_client + wsdl = File.join(DIR, 'soapbodyparts.wsdl') + @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_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(["1", "2", "3"], @client.foo("1", "2", "3")) + assert_equal(["3", "2", "1"], @client.foo("3", "2", "1")) + assert_equal(["1", "2", "3"], @client.bar("1", "2", "3")) + assert_equal(["3", "2", "1"], @client.baz("1", "2", "3")) + end +end + + +end +end diff --git a/ruby_1_8_5/test/wsdl/test_emptycomplextype.rb b/ruby_1_8_5/test/wsdl/test_emptycomplextype.rb new file mode 100644 index 0000000000..71d1b8641d --- /dev/null +++ b/ruby_1_8_5/test/wsdl/test_emptycomplextype.rb @@ -0,0 +1,21 @@ +require 'test/unit' +require 'wsdl/parser' + + +module WSDL + + +class TestWSDL < Test::Unit::TestCase + def setup + @file = File.join(File.dirname(File.expand_path(__FILE__)), 'emptycomplextype.wsdl') + end + + def test_wsdl + @wsdl = WSDL::Parser.new.parse(File.open(@file) { |f| f.read }) + assert(/\{urn:jp.gr.jin.rrr.example.emptycomplextype\}emptycomplextype/ =~ @wsdl.inspect) + end +end + + + +end diff --git a/ruby_1_8_5/test/wsdl/test_fault.rb b/ruby_1_8_5/test/wsdl/test_fault.rb new file mode 100644 index 0000000000..ec414528ee --- /dev/null +++ b/ruby_1_8_5/test/wsdl/test_fault.rb @@ -0,0 +1,51 @@ +require 'test/unit' +require 'soap/processor' +require 'soap/mapping' +require 'soap/rpc/element' +require 'wsdl/parser' + + +module WSDL + + +class TestFault < Test::Unit::TestCase + def setup + @xml =<<__EOX__ +<?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> + <env:Fault xmlns:n1="http://schemas.xmlsoap.org/soap/encoding/" + env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> + <faultcode xsi:type="xsd:string">Server</faultcode> + <faultstring xsi:type="xsd:string">faultstring</faultstring> + <faultactor xsi:type="xsd:string">faultactor</faultactor> + <detail xmlns:n2="http://www.ruby-lang.org/xmlns/ruby/type/custom" + xsi:type="n2:SOAPException"> + <excn_type_name xsi:type="xsd:string">type</excn_type_name> + <cause href="#id123"/> + </detail> + </env:Fault> + <cause id="id123" xsi:type="xsd:int">5</cause> + </env:Body> +</env:Envelope> +__EOX__ + end + + def test_by_wsdl + rpc_decode_typemap = WSDL::Definitions.soap_rpc_complextypes + opt = {} + opt[:default_encodingstyle] = ::SOAP::EncodingNamespace + opt[:decode_typemap] = rpc_decode_typemap + header, body = ::SOAP::Processor.unmarshal(@xml, opt) + fault = ::SOAP::Mapping.soap2obj(body.response) + assert_equal("Server", fault.faultcode) + assert_equal("faultstring", fault.faultstring) + assert_equal(URI.parse("faultactor"), fault.faultactor) + assert_equal(5, fault.detail.cause) + end +end + + +end diff --git a/ruby_1_8_5/test/wsdl/test_multiplefault.rb b/ruby_1_8_5/test/wsdl/test_multiplefault.rb new file mode 100644 index 0000000000..7004297dc9 --- /dev/null +++ b/ruby_1_8_5/test/wsdl/test_multiplefault.rb @@ -0,0 +1,39 @@ +require 'test/unit' +require 'wsdl/parser' +require 'wsdl/soap/classDefCreator' + + +module WSDL + + +class TestMultipleFault < Test::Unit::TestCase + def self.setup(filename) + @@filename = filename + end + + def test_multiplefault + @wsdl = WSDL::Parser.new.parse(File.open(@@filename) { |f| f.read }) + classdefstr = WSDL::SOAP::ClassDefCreator.new(@wsdl).dump + yield_eval_binding(classdefstr) do |b| + assert_equal( + WSDL::TestMultipleFault::AuthenticationError, + eval("AuthenticationError", b) + ) + assert_equal( + WSDL::TestMultipleFault::AuthorizationError, + eval("AuthorizationError", b) + ) + end + end + + def yield_eval_binding(evaled) + b = binding + eval(evaled, b) + yield(b) + end +end + +TestMultipleFault.setup(File.join(File.dirname(__FILE__), 'multiplefault.wsdl')) + + +end |