1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/soap/**/*.rb, lib/wsdl/**/*.rb, lib/xsd/**/*.rb: changed license; GPL2 -> Ruby's.

* lib/soap/rpc/driver.rb, lib/soap/wsdlDriver.rb, lib/soap/streamHandler.rb: add interface to streamhandler.

* lib/soap/marshal.rb: raise error if parse fails.

* lib/soap/netHttpClient.rb: add https support.  Patched by Oliver M. Bolzer.

* lib/soap/netHttpClient.rb: dump HTTP response message body by itself.

* lib/soap/rpc/driver.rb, lib/soap/rpc/proxy.rb, lib/soap/wsdlDriver.rb: add driver#mandatorycharset interface to foce using charset for parsing response from buggy server.

* lib/soap/encodingstyle/soapHandler.rb: support Apache Axis's half typed multi-ref array.

* lib/soap/mapping/factory.rb, lib/soap/mapping/registry.rb: map SOAPStruct which has multi-accessors which name are the same, to an array.

* lib/soap/rpc/element.rb: fixed illegal parameter order.

* lib/soap/rpc/element.rb: element name of response message could have the name other than 'return'.

* lib/wsdl/operation.rb, lib/wsdl/operationBinding.rb, lib/wsdl/soap/classDefCreator.rb, lib/wsdl/soap/methodDefCreator.rb, lib/wsdl/soap/methodDefCreatorSupport.rb: WSDL/1.1 allows plural fault definition in a operation. [ruby-talk:84948]

* test/wsdl/multiplefault.wsdl, test/wsdl/test_multiplefault.rb: add test for above fix.

* lib/wsdl/soap/complexType.rb: support WSDL array definition with maxOccures="unbound".

* lib/xsd/charset.rb: use cp932 under emx.  Patched by Siena. / SHINAGAWA, Norihide in [ruby-dev:21972]

* lib/xsd/xmlparser/parser.rb: set @charset nil by default.  Nil means 'follow encoding declaration in XML'.

* sample/soap/digraph.rb, sample/wsdl/amazon/wsdlDriver.rb, sample/wsdl/googleSearch/sampleClient.rb, sample/wsdl/googleSearch/wsdlDriver.rb, test/wsdl/test_emptycomplextype.rb, test/wsdl/marshal/test_wsdlmarshal.rb, test/xsd/test_xmlschemaparser.rb: use File.open(...) { |f| f.read } instead of File.open(...).read. [ruby-dev:21964]

* test/wsdl/emptycomplextype.wsdl, test/wsdl/test_emptycomplextype.rb: simplify the test case.

* test/wsdl/axisArray/*: add tests for axis's array encoding.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nahi 2003-11-25 07:31:33 +00:00
parent ec373c3e1c
commit 6a09e1d966
98 changed files with 1020 additions and 1558 deletions

View file

@ -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>

View file

@ -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

View file

@ -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

View file

@ -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>

View file

@ -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>

View file

@ -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

View file

@ -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