summaryrefslogtreecommitdiff
path: root/test/wsdl/map
diff options
context:
space:
mode:
Diffstat (limited to 'test/wsdl/map')
-rw-r--r--test/wsdl/map/map.wsdl66
-rw-r--r--test/wsdl/map/map.xml43
-rw-r--r--test/wsdl/map/test_map.rb37
3 files changed, 146 insertions, 0 deletions
diff --git a/test/wsdl/map/map.wsdl b/test/wsdl/map/map.wsdl
new file mode 100644
index 0000000000..7b1a140827
--- /dev/null
+++ b/test/wsdl/map/map.wsdl
@@ -0,0 +1,66 @@
+<?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: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="anyType" />
+ <element name="value" type="anyType" />
+ </sequence>
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+ </schema>
+ </types>
+
+ <message name="mapRequest"/>
+ <message name="mapResponse">
+ <part name="return" type="apachesoap:Map"/>
+ </message>
+
+ <portType name="RAABaseServicePortType">
+ <operation name="map" parameterOrder="">
+ <input message="tns:mapRequest"/>
+ <output message="tns:mapResponse"/>
+ </operation>
+ </portType>
+
+ <binding name="RAABaseServicePortBinding" type="tns:RAABaseServicePortType">
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="map">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="encoded"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ namespace="http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.2/"/>
+ </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/test/wsdl/map/map.xml b/test/wsdl/map/map.xml
new file mode 100644
index 0000000000..7106735ffc
--- /dev/null
+++ b/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/test/wsdl/map/test_map.rb b/test/wsdl/map/test_map.rb
new file mode 100644
index 0000000000..b0f2fb5a53
--- /dev/null
+++ b/test/wsdl/map/test_map.rb
@@ -0,0 +1,37 @@
+require 'test/unit'
+require 'soap/processor'
+require 'soap/mapping'
+require 'soap/rpc/element'
+require 'wsdl/importer'
+
+
+module WSDL
+
+
+class TestMap < Test::Unit::TestCase
+ def setup
+ 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
+end
+
+
+end