* 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
2003-11-25 02:31:33 -05:00
|
|
|
# SOAP4R - SOAP RPC driver
|
2004-07-03 09:33:20 -04:00
|
|
|
# Copyright (C) 2000, 2001, 2003, 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
|
2003-09-24 11:18:44 -04: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
2003-11-25 02:31:33 -05:00
|
|
|
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
|
|
|
|
# redistribute it and/or modify it under the same terms of Ruby's license;
|
|
|
|
# either the dual license version in 2003, or any later version.
|
2003-09-24 11:18:44 -04:00
|
|
|
|
|
|
|
|
|
|
|
require 'soap/soap'
|
|
|
|
require 'soap/mapping'
|
|
|
|
require 'soap/rpc/rpc'
|
|
|
|
require 'soap/rpc/proxy'
|
|
|
|
require 'soap/rpc/element'
|
|
|
|
require 'soap/streamHandler'
|
2003-12-03 23:05:51 -05:00
|
|
|
require 'soap/property'
|
2004-07-03 09:33:20 -04:00
|
|
|
require 'soap/header/handlerset'
|
2003-09-24 11:18:44 -04:00
|
|
|
|
|
|
|
|
|
|
|
module SOAP
|
|
|
|
module RPC
|
|
|
|
|
|
|
|
|
|
|
|
class Driver
|
|
|
|
class EmptyResponseError < Error; end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
class << self
|
|
|
|
def __attr_proxy(symbol, assignable = false)
|
|
|
|
name = symbol.to_s
|
|
|
|
module_eval <<-EOD
|
|
|
|
def #{name}
|
|
|
|
@servant.#{name}
|
|
|
|
end
|
|
|
|
EOD
|
|
|
|
if assignable
|
|
|
|
module_eval <<-EOD
|
|
|
|
def #{name}=(rhs)
|
|
|
|
@servant.#{name} = rhs
|
|
|
|
end
|
|
|
|
EOD
|
|
|
|
end
|
|
|
|
end
|
* 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
2003-11-25 02:31:33 -05:00
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
__attr_proxy :options
|
2004-07-03 09:33:20 -04:00
|
|
|
__attr_proxy :headerhandler
|
|
|
|
__attr_proxy :test_loopback_response
|
2003-12-03 23:05:51 -05:00
|
|
|
__attr_proxy :endpoint_url, true
|
|
|
|
__attr_proxy :mapping_registry, true
|
|
|
|
__attr_proxy :soapaction, true
|
|
|
|
__attr_proxy :default_encodingstyle, true
|
2003-09-24 11:18:44 -04:00
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def httpproxy
|
|
|
|
@servant.options["protocol.http.proxy"]
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def httpproxy=(httpproxy)
|
|
|
|
@servant.options["protocol.http.proxy"] = httpproxy
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def wiredump_dev
|
|
|
|
@servant.options["protocol.http.wiredump_dev"]
|
* 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
2003-11-25 02:31:33 -05:00
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def wiredump_dev=(wiredump_dev)
|
|
|
|
@servant.options["protocol.http.wiredump_dev"] = wiredump_dev
|
* 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
2003-11-25 02:31:33 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def mandatorycharset
|
2003-12-03 23:05:51 -05:00
|
|
|
@servant.options["protocol.mandatorycharset"]
|
* 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
2003-11-25 02:31:33 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def mandatorycharset=(mandatorycharset)
|
2003-12-03 23:05:51 -05:00
|
|
|
@servant.options["protocol.mandatorycharset"] = mandatorycharset
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def wiredump_file_base
|
|
|
|
@servant.options["protocol.wiredump_file_base"]
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def wiredump_file_base=(wiredump_file_base)
|
|
|
|
@servant.options["protocol.wiredump_file_base"] = wiredump_file_base
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def initialize(endpoint_url, namespace, soapaction = nil)
|
|
|
|
@servant = Servant__.new(self, endpoint_url, namespace)
|
|
|
|
@servant.soapaction = soapaction
|
|
|
|
@proxy = @servant.proxy
|
|
|
|
end
|
2003-09-24 11:18:44 -04:00
|
|
|
|
2004-07-03 09:33:20 -04:00
|
|
|
def loadproperty(propertyname)
|
|
|
|
unless options.loadproperty(propertyname)
|
|
|
|
raise LoadError.new("No such property to load -- #{propertyname}")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def inspect
|
|
|
|
"#<#{self.class}:#{@servant.streamhandler.inspect}>"
|
|
|
|
end
|
2003-09-24 11:18:44 -04:00
|
|
|
|
|
|
|
def add_method(name, *params)
|
2003-12-03 23:05:51 -05:00
|
|
|
add_method_with_soapaction_as(name, name, @servant.soapaction, *params)
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def add_method_as(name, name_as, *params)
|
2003-12-03 23:05:51 -05:00
|
|
|
add_method_with_soapaction_as(name, name_as, @servant.soapaction, *params)
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def add_method_with_soapaction(name, soapaction, *params)
|
|
|
|
add_method_with_soapaction_as(name, name, soapaction, *params)
|
|
|
|
end
|
|
|
|
|
|
|
|
def add_method_with_soapaction_as(name, name_as, soapaction, *params)
|
|
|
|
param_def = if params.size == 1 and params[0].is_a?(Array)
|
|
|
|
params[0]
|
|
|
|
else
|
|
|
|
SOAPMethod.create_param_def(params)
|
|
|
|
end
|
2003-12-03 23:05:51 -05:00
|
|
|
@servant.add_method(name_as, soapaction, name, param_def)
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def reset_stream
|
|
|
|
@servant.streamhandler.reset
|
|
|
|
end
|
2003-09-24 11:18:44 -04:00
|
|
|
|
|
|
|
def invoke(headers, body)
|
2003-12-03 23:05:51 -05:00
|
|
|
@servant.invoke(headers, body)
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def call(name, *params)
|
2003-12-03 23:05:51 -05:00
|
|
|
@servant.call(name, *params)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def add_rpc_method_interface(name, param_def)
|
|
|
|
@servant.add_rpc_method_interface(name, param_def)
|
|
|
|
end
|
|
|
|
|
|
|
|
class Servant__
|
|
|
|
attr_reader :options
|
|
|
|
attr_reader :streamhandler
|
2004-07-03 09:33:20 -04:00
|
|
|
attr_reader :headerhandler
|
2003-12-03 23:05:51 -05:00
|
|
|
attr_reader :proxy
|
|
|
|
|
|
|
|
def initialize(host, endpoint_url, namespace)
|
|
|
|
@host = host
|
|
|
|
@namespace = namespace
|
|
|
|
@mapping_registry = nil
|
|
|
|
@soapaction = nil
|
|
|
|
@wiredump_file_base = nil
|
2003-12-05 08:26:26 -05:00
|
|
|
@options = setup_options
|
2003-12-03 23:05:51 -05:00
|
|
|
@streamhandler = HTTPPostStreamHandler.new(endpoint_url,
|
|
|
|
@options["protocol.http"] ||= ::SOAP::Property.new)
|
2004-07-03 09:33:20 -04:00
|
|
|
@headerhandler = Header::HandlerSet.new
|
2003-12-03 23:05:51 -05:00
|
|
|
@proxy = Proxy.new(@streamhandler, @soapaction)
|
|
|
|
@proxy.allow_unqualified_element = true
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def endpoint_url
|
|
|
|
@streamhandler.endpoint_url
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def endpoint_url=(endpoint_url)
|
|
|
|
@streamhandler.endpoint_url = endpoint_url
|
|
|
|
@streamhandler.reset
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def mapping_registry
|
|
|
|
@mapping_registry
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def mapping_registry=(mapping_registry)
|
|
|
|
@mapping_registry = mapping_registry
|
|
|
|
end
|
2003-09-24 11:18:44 -04:00
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def soapaction
|
|
|
|
@soapaction
|
|
|
|
end
|
2003-09-24 11:18:44 -04:00
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def soapaction=(soapaction)
|
|
|
|
@soapaction = soapaction
|
|
|
|
end
|
|
|
|
|
|
|
|
def default_encodingstyle
|
|
|
|
@proxy.default_encodingstyle
|
|
|
|
end
|
|
|
|
|
|
|
|
def default_encodingstyle=(encodingstyle)
|
|
|
|
@proxy.default_encodingstyle = encodingstyle
|
|
|
|
end
|
|
|
|
|
2004-07-03 09:33:20 -04:00
|
|
|
def test_loopback_response
|
|
|
|
@streamhandler.test_loopback_response
|
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def invoke(headers, body)
|
|
|
|
set_wiredump_file_base(body.elename.name)
|
* import soap4r/1.5.2;
* lib/soap/{attachment.rb,baseData.rb,encodingstyle/soapHandler.rb}:
introduce SOAPExternalReference class as a referenct to SOAPEnvelope
external content.
* lib/soap/{attachment.rb,mimemessage.rb}: great SwA (SOAP messages
with Attachments) support code by Jamie Herre.
* lib/soap/{element.rb,marshal.rb,parser.rb,processor.rb,
streamHandler.rb,wsdlDriver.rb}: SwA support.
* lib/soap/rpc/{cgistub.rb,driver.rb,element.rb,proxy.rb,router.rb,
soaplet.rb}: SwA support and refactoring.
* lib/soap/generator.rb, lib/soap/mapping/mapping.rb: follow
SOAPReference#initialize signature change.
* lib/soap/mapping/factory.rb: deleted unused methods.
* lib/soap/mapping/rubytypeFactory.rb: do no ignore case while xsi:type
string <-> Ruby class name matching.
* lib/xsd/datatypes.rb: check the smallest positive non-zero
single-precision float exactly instead of packing with "f".
[ruby-talk:88822]
* test/soap/test_basetype.rb, test/xsd/test_xsd.rb: use 1.402e-45, not
1.4e-45. 1.4e-45 is smaller than 2 ** -149...
* test/soap/test_basetype.rb, test/soap/marshal/test_marshal.rb,
test/xsd/test_xsd.rb: use "(-1.0 / (1.0 / 0.0))" instead of "-0.0".
* test/soap/test_streamhandler.rb: revert to the previous test that
warns "basic_auth unsupported under net/http".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-05 21:20:51 -05:00
|
|
|
env = @proxy.invoke(headers, body)
|
|
|
|
if env.nil?
|
|
|
|
return nil, nil
|
|
|
|
else
|
|
|
|
return env.header, env.body
|
|
|
|
end
|
2003-12-03 23:05:51 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def call(name, *params)
|
|
|
|
set_wiredump_file_base(name)
|
|
|
|
# Convert parameters: params array => SOAPArray => members array
|
|
|
|
params = Mapping.obj2soap(params, @mapping_registry).to_a
|
2004-07-03 09:33:20 -04:00
|
|
|
env = @proxy.call(call_headers, name, *params)
|
* import soap4r/1.5.2;
* lib/soap/{attachment.rb,baseData.rb,encodingstyle/soapHandler.rb}:
introduce SOAPExternalReference class as a referenct to SOAPEnvelope
external content.
* lib/soap/{attachment.rb,mimemessage.rb}: great SwA (SOAP messages
with Attachments) support code by Jamie Herre.
* lib/soap/{element.rb,marshal.rb,parser.rb,processor.rb,
streamHandler.rb,wsdlDriver.rb}: SwA support.
* lib/soap/rpc/{cgistub.rb,driver.rb,element.rb,proxy.rb,router.rb,
soaplet.rb}: SwA support and refactoring.
* lib/soap/generator.rb, lib/soap/mapping/mapping.rb: follow
SOAPReference#initialize signature change.
* lib/soap/mapping/factory.rb: deleted unused methods.
* lib/soap/mapping/rubytypeFactory.rb: do no ignore case while xsi:type
string <-> Ruby class name matching.
* lib/xsd/datatypes.rb: check the smallest positive non-zero
single-precision float exactly instead of packing with "f".
[ruby-talk:88822]
* test/soap/test_basetype.rb, test/xsd/test_xsd.rb: use 1.402e-45, not
1.4e-45. 1.4e-45 is smaller than 2 ** -149...
* test/soap/test_basetype.rb, test/soap/marshal/test_marshal.rb,
test/xsd/test_xsd.rb: use "(-1.0 / (1.0 / 0.0))" instead of "-0.0".
* test/soap/test_streamhandler.rb: revert to the previous test that
warns "basic_auth unsupported under net/http".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-05 21:20:51 -05:00
|
|
|
raise EmptyResponseError.new("Empty response.") unless env
|
2004-07-03 09:33:20 -04:00
|
|
|
receive_headers(env.header)
|
2003-12-03 23:05:51 -05:00
|
|
|
begin
|
2004-07-03 09:33:20 -04:00
|
|
|
@proxy.check_fault(env.body)
|
2003-12-03 23:05:51 -05:00
|
|
|
rescue SOAP::FaultError => e
|
|
|
|
Mapping.fault2exception(e)
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
2003-12-03 23:05:51 -05:00
|
|
|
|
2004-07-03 09:33:20 -04:00
|
|
|
ret = env.body.response ?
|
|
|
|
Mapping.soap2obj(env.body.response, @mapping_registry) : nil
|
|
|
|
if env.body.outparams
|
|
|
|
outparams = env.body.outparams.collect { |outparam|
|
2003-12-03 23:05:51 -05:00
|
|
|
Mapping.soap2obj(outparam)
|
|
|
|
}
|
|
|
|
return [ret].concat(outparams)
|
|
|
|
else
|
|
|
|
return ret
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def add_method(name_as, soapaction, name, param_def)
|
|
|
|
qname = XSD::QName.new(@namespace, name_as)
|
|
|
|
@proxy.add_method(qname, soapaction, name, param_def)
|
|
|
|
add_rpc_method_interface(name, param_def)
|
|
|
|
end
|
|
|
|
|
|
|
|
def add_rpc_method_interface(name, param_def)
|
|
|
|
param_names = []
|
|
|
|
i = 0
|
|
|
|
@proxy.method[name].each_param_name(RPC::SOAPMethod::IN,
|
|
|
|
RPC::SOAPMethod::INOUT) do |param_name|
|
|
|
|
i += 1
|
|
|
|
param_names << "arg#{ i }"
|
|
|
|
end
|
|
|
|
callparam = (param_names.collect { |pname| ", " + pname }).join
|
|
|
|
@host.instance_eval <<-EOS
|
|
|
|
def #{ name }(#{ param_names.join(", ") })
|
|
|
|
@servant.call(#{ name.dump }#{ callparam })
|
|
|
|
end
|
|
|
|
EOS
|
2004-07-03 09:33:20 -04:00
|
|
|
@host.method(name)
|
2003-12-03 23:05:51 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2004-07-03 09:33:20 -04:00
|
|
|
def call_headers
|
|
|
|
headers = @headerhandler.on_outbound
|
|
|
|
if headers.empty?
|
|
|
|
nil
|
|
|
|
else
|
|
|
|
h = ::SOAP::SOAPHeader.new
|
|
|
|
headers.each do |header|
|
|
|
|
h.add(header.elename.name, header)
|
|
|
|
end
|
|
|
|
h
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def receive_headers(headers)
|
|
|
|
@headerhandler.on_inbound(headers) if headers
|
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def set_wiredump_file_base(name)
|
|
|
|
if @wiredump_file_base
|
|
|
|
@streamhandler.wiredump_file_base = @wiredump_file_base + "_#{ name }"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2003-12-05 08:26:26 -05:00
|
|
|
def setup_options
|
|
|
|
if opt = Property.loadproperty(::SOAP::PropertyName)
|
|
|
|
opt = opt["client"]
|
|
|
|
end
|
|
|
|
opt ||= Property.new
|
|
|
|
opt.add_hook("protocol.mandatorycharset") do |key, value|
|
2003-12-03 23:05:51 -05:00
|
|
|
@proxy.mandatorycharset = value
|
|
|
|
end
|
2003-12-05 08:26:26 -05:00
|
|
|
opt.add_hook("protocol.wiredump_file_base") do |key, value|
|
2003-12-03 23:05:51 -05:00
|
|
|
@wiredump_file_base = value
|
|
|
|
end
|
2003-12-05 08:26:26 -05:00
|
|
|
opt["protocol.http.charset"] ||= XSD::Charset.encoding_label
|
|
|
|
opt["protocol.http.proxy"] ||= Env::HTTP_PROXY
|
|
|
|
opt["protocol.http.no_proxy"] ||= Env::NO_PROXY
|
|
|
|
opt
|
2003-12-03 23:05:51 -05:00
|
|
|
end
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|