diff options
Diffstat (limited to 'ruby_1_8_6/test/wsdl/rpc')
-rw-r--r-- | ruby_1_8_6/test/wsdl/rpc/echoDriver.rb | 55 | ||||
-rw-r--r-- | ruby_1_8_6/test/wsdl/rpc/echo_serviceClient.rb | 23 | ||||
-rw-r--r-- | ruby_1_8_6/test/wsdl/rpc/rpc.wsdl | 75 | ||||
-rw-r--r-- | ruby_1_8_6/test/wsdl/rpc/test-rpc-lit.wsdl | 364 | ||||
-rw-r--r-- | ruby_1_8_6/test/wsdl/rpc/test-rpc-lit12.wsdl | 455 | ||||
-rw-r--r-- | ruby_1_8_6/test/wsdl/rpc/test_rpc.rb | 118 | ||||
-rw-r--r-- | ruby_1_8_6/test/wsdl/rpc/test_rpc_lit.rb | 399 |
7 files changed, 1489 insertions, 0 deletions
diff --git a/ruby_1_8_6/test/wsdl/rpc/echoDriver.rb b/ruby_1_8_6/test/wsdl/rpc/echoDriver.rb new file mode 100644 index 0000000000..51e82076e7 --- /dev/null +++ b/ruby_1_8_6/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_6/test/wsdl/rpc/echo_serviceClient.rb b/ruby_1_8_6/test/wsdl/rpc/echo_serviceClient.rb new file mode 100644 index 0000000000..40264834e9 --- /dev/null +++ b/ruby_1_8_6/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_6/test/wsdl/rpc/rpc.wsdl b/ruby_1_8_6/test/wsdl/rpc/rpc.wsdl new file mode 100644 index 0000000000..b0ee5c5e56 --- /dev/null +++ b/ruby_1_8_6/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_6/test/wsdl/rpc/test-rpc-lit.wsdl b/ruby_1_8_6/test/wsdl/rpc/test-rpc-lit.wsdl new file mode 100644 index 0000000000..72de747e36 --- /dev/null +++ b/ruby_1_8_6/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_6/test/wsdl/rpc/test-rpc-lit12.wsdl b/ruby_1_8_6/test/wsdl/rpc/test-rpc-lit12.wsdl new file mode 100644 index 0000000000..901cde6f9c --- /dev/null +++ b/ruby_1_8_6/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_6/test/wsdl/rpc/test_rpc.rb b/ruby_1_8_6/test/wsdl/rpc/test_rpc.rb new file mode 100644 index 0000000000..7c4c3a7ad6 --- /dev/null +++ b/ruby_1_8_6/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_6/test/wsdl/rpc/test_rpc_lit.rb b/ruby_1_8_6/test/wsdl/rpc/test_rpc_lit.rb new file mode 100644 index 0000000000..080dbb82cf --- /dev/null +++ b/ruby_1_8_6/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 |