diff options
Diffstat (limited to 'test/wsdl')
-rw-r--r-- | test/wsdl/axisArray/axisArray.wsdl | 60 | ||||
-rw-r--r-- | test/wsdl/axisArray/itemList.rb | 27 | ||||
-rw-r--r-- | test/wsdl/axisArray/test_axisarray.rb | 72 | ||||
-rw-r--r-- | test/wsdl/emptycomplextype.wsdl | 94 | ||||
-rw-r--r-- | test/wsdl/multiplefault.wsdl | 68 | ||||
-rw-r--r-- | test/wsdl/test_emptycomplextype.rb | 8 | ||||
-rw-r--r-- | test/wsdl/test_multiplefault.rb | 39 |
7 files changed, 294 insertions, 74 deletions
diff --git a/test/wsdl/axisArray/axisArray.wsdl b/test/wsdl/axisArray/axisArray.wsdl new file mode 100644 index 000000000..3602edb74 --- /dev/null +++ b/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/test/wsdl/axisArray/itemList.rb b/test/wsdl/axisArray/itemList.rb new file mode 100644 index 000000000..b81297ed3 --- /dev/null +++ b/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/test/wsdl/axisArray/test_axisarray.rb b/test/wsdl/axisArray/test_axisarray.rb new file mode 100644 index 000000000..9c7b42564 --- /dev/null +++ b/test/wsdl/axisArray/test_axisarray.rb @@ -0,0 +1,72 @@ +require 'test/unit' +require 'soap/processor' +require 'soap/mapping' +require 'soap/rpc/element' +require 'wsdl/importer' + + +module WSDL + + +class TestAxisArray < Test::Unit::TestCase + def setup + dir = File.dirname(File.expand_path(__FILE__)) + $:.push(dir) + require 'itemList.rb' + $:.delete(dir) + @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/test/wsdl/emptycomplextype.wsdl b/test/wsdl/emptycomplextype.wsdl index afd8dc239..4f8dc4849 100644 --- a/test/wsdl/emptycomplextype.wsdl +++ b/test/wsdl/emptycomplextype.wsdl @@ -1,77 +1,31 @@ <?xml version="1.0" encoding="utf-8"?> -<definitions - xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" - xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" - xmlns:i1="http://www.winfessor.com/SoapBoxWebService/RosterDataSet.xsd" - xmlns:s="http://www.w3.org/2001/XMLSchema" - xmlns:s0="http://www.winfessor.com/SoapBoxWebService/SoapBoxWebService" - xmlns:i2="http://www.winfessor.com/SoapBoxWebService/ExceptionDataSet.xsd" - xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" - xmlns:i0="http://www.winfessor.com/SoapBoxWebService/MessageDataSet.xsd" - xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" - targetNamespace="http://www.winfessor.com/SoapBoxWebService/SoapBoxWebService" +<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> - <s:schema - elementFormDefault="qualified" - targetNamespace="http://www.winfessor.com/SoapBoxWebService/SoapBoxWebService"> - <s:element name="typeIn"> - <s:complexType /> - </s:element> + <xsd:schema elementFormDefault="qualified" + targetNamespace="urn:jp.gr.jin.rrr.example.emptycomplextype"> + <xsd:element name="typeIn"> + <xsd:complexType /> + </xsd:element> - <s:element name="typeOut"> - <s:complexType> - <s:sequence> - <s:element minOccurs="0" maxOccurs="1" name="str1" type="s:string" /> - <s:element minOccurs="0" maxOccurs="1" name="str2" type="s:string" /> - <s:element minOccurs="0" maxOccurs="1" name="seq"> - <s:complexType> - <s:sequence> - <s:any /> - </s:sequence> - </s:complexType> - </s:element> - </s:sequence> - </s:complexType> - </s:element> - </s:schema> + <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> - - <message name="doIn"> - <part name="parameters" element="s0:typeIn" /> - </message> - <message name="doOut"> - <part name="parameters" element="s0:typeOut" /> - </message> - - <portType name="DotNetPortType"> - <operation name="do"> - <input message="s0:doIn" /> - <output message="s0:doOut" /> - </operation> - </portType> - - <binding name="DotNetBinding" type="s0:DotNetPortType"> - <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> - <operation name="do"> - <soap:operation soapAction="http://www.winfessor.com/SoapBoxWebService/SoapBoxWebService/SessionClose" style="document" /> - <input> - <soap:body use="literal" /> - <soap:header message="s0:SessionCloseSoapBoxHeader" part="SoapBoxHeader" use="literal" /> - </input> - <output> - <soap:body use="literal" /> - <soap:header message="s0:SessionCloseSoapBoxHeader" part="SoapBoxHeader" use="literal" /> - </output> - </operation> - </binding> - - <service name="DotNetService"> - <documentation>doc doc doc.</documentation> - <port name="DotNetPort" binding="s0:DotNetBinding"> - <soap:address location="http://localhost:8808" /> - <!-- <soap:address location="http://www.winfessor.com/SoapBoxWebservice/SoapBoxWebService.asmx" /> --> - </port> - </service> </definitions> diff --git a/test/wsdl/multiplefault.wsdl b/test/wsdl/multiplefault.wsdl new file mode 100644 index 000000000..2d928b60b --- /dev/null +++ b/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/test/wsdl/test_emptycomplextype.rb b/test/wsdl/test_emptycomplextype.rb index fffc8c85e..45136b417 100644 --- a/test/wsdl/test_emptycomplextype.rb +++ b/test/wsdl/test_emptycomplextype.rb @@ -6,16 +6,16 @@ module WSDL class TestWSDL < Test::Unit::TestCase - def self.setup(filename) - @@filename = filename + def setup + @file = File.join(File.dirname(__FILE__), 'emptycomplextype.wsdl') end def test_wsdl - @wsdl = WSDL::Parser.new.parse(File.open(@@filename).read) + @wsdl = WSDL::Parser.new.parse(File.open(@file) { |f| f.read }) + assert_equal("#<WSDL::Definitions:{urn:jp.gr.jin.rrr.example.emptycomplextype}emptycomplextype>", @wsdl.inspect) end end -TestWSDL.setup(File.join(File.dirname(__FILE__), 'emptycomplextype.wsdl')) end diff --git a/test/wsdl/test_multiplefault.rb b/test/wsdl/test_multiplefault.rb new file mode 100644 index 000000000..7004297dc --- /dev/null +++ b/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 |