* 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'
|
2004-12-20 08:50:15 -05:00
|
|
|
require 'soap/mapping/wsdlliteralregistry'
|
2003-09-24 11:18:44 -04:00
|
|
|
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
|
2004-12-21 10:08:56 -05:00
|
|
|
self.__send__(:define_method, name, proc {
|
|
|
|
@servant.__send__(name)
|
|
|
|
})
|
2003-12-03 23:05:51 -05:00
|
|
|
if assignable
|
2004-12-21 10:08:56 -05:00
|
|
|
self.__send__(:define_method, name + '=', proc { |rhs|
|
|
|
|
@servant.__send__(name + '=', rhs)
|
|
|
|
})
|
2003-12-03 23:05:51 -05:00
|
|
|
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
|
2004-12-20 08:50:15 -05:00
|
|
|
__attr_proxy :streamhandler
|
2004-07-03 09:33:20 -04:00
|
|
|
__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
|
2004-12-20 08:50:15 -05:00
|
|
|
__attr_proxy :generate_explicit_type, true
|
|
|
|
__attr_proxy :allow_unqualified_element, true
|
2003-09-24 11:18:44 -04:00
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def httpproxy
|
2004-12-20 08:50:15 -05:00
|
|
|
options["protocol.http.proxy"]
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def httpproxy=(httpproxy)
|
2004-12-20 08:50:15 -05:00
|
|
|
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
|
2004-12-20 08:50:15 -05:00
|
|
|
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)
|
2004-12-20 08:50:15 -05:00
|
|
|
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
|
2004-12-20 08:50:15 -05:00
|
|
|
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)
|
2004-12-20 08:50:15 -05:00
|
|
|
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
|
2004-12-20 08:50:15 -05:00
|
|
|
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)
|
2004-12-20 08:50:15 -05:00
|
|
|
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
|
2004-12-20 08:50:15 -05:00
|
|
|
"#<#{self.class}:#{@servant.inspect}>"
|
2003-12-03 23:05:51 -05:00
|
|
|
end
|
2003-09-24 11:18:44 -04:00
|
|
|
|
2004-12-20 08:50:15 -05:00
|
|
|
def add_rpc_method(name, *params)
|
|
|
|
param_def = create_rpc_param_def(params)
|
|
|
|
@servant.add_rpc_method(name, @servant.soapaction, name, param_def)
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
2004-12-20 08:50:15 -05:00
|
|
|
def add_rpc_method_as(name, name_as, *params)
|
|
|
|
param_def = create_rpc_param_def(params)
|
|
|
|
@servant.add_rpc_method(name_as, @servant.soapaction, name, param_def)
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
2004-12-20 08:50:15 -05:00
|
|
|
def add_rpc_method_with_soapaction(name, soapaction, *params)
|
|
|
|
param_def = create_rpc_param_def(params)
|
|
|
|
@servant.add_rpc_method(name, soapaction, name, param_def)
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
2004-12-20 08:50:15 -05:00
|
|
|
def add_rpc_method_with_soapaction_as(name, name_as, soapaction, *params)
|
|
|
|
param_def = create_rpc_param_def(params)
|
|
|
|
@servant.add_rpc_method(name_as, soapaction, name, param_def)
|
|
|
|
end
|
|
|
|
|
|
|
|
# add_method is for shortcut of typical rpc/encoded method definition.
|
|
|
|
alias add_method add_rpc_method
|
|
|
|
alias add_method_as add_rpc_method_as
|
|
|
|
alias add_method_with_soapaction add_rpc_method_with_soapaction
|
|
|
|
alias add_method_with_soapaction_as add_rpc_method_with_soapaction_as
|
|
|
|
|
|
|
|
def add_document_method(name, req_qname, res_qname)
|
|
|
|
param_def = create_document_param_def(name, req_qname, res_qname)
|
|
|
|
@servant.add_document_method(name, @servant.soapaction, name, param_def)
|
|
|
|
end
|
|
|
|
|
|
|
|
def add_document_method_as(name, name_as, req_qname, res_qname)
|
|
|
|
param_def = create_document_param_def(name, req_qname, res_qname)
|
|
|
|
@servant.add_document_method(name_as, @servant.soapaction, name, param_def)
|
|
|
|
end
|
|
|
|
|
|
|
|
def add_document_method_with_soapaction(name, soapaction, req_qname,
|
|
|
|
res_qname)
|
|
|
|
param_def = create_document_param_def(name, req_qname, res_qname)
|
|
|
|
@servant.add_document_method(name, soapaction, name, param_def)
|
|
|
|
end
|
|
|
|
|
|
|
|
def add_document_method_with_soapaction_as(name, name_as, soapaction,
|
|
|
|
req_qname, res_qname)
|
|
|
|
param_def = create_document_param_def(name, req_qname, res_qname)
|
|
|
|
@servant.add_document_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
|
2004-12-20 08:50:15 -05:00
|
|
|
@servant.reset_stream
|
2003-12-03 23:05:51 -05:00
|
|
|
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
|
|
|
|
|
2004-12-20 08:50:15 -05:00
|
|
|
def create_rpc_param_def(params)
|
|
|
|
if params.size == 1 and params[0].is_a?(Array)
|
|
|
|
params[0]
|
|
|
|
else
|
|
|
|
SOAPMethod.create_param_def(params)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def create_document_param_def(name, req_qname, res_qname)
|
|
|
|
[
|
|
|
|
['input', name, [nil, req_qname.namespace, req_qname.name]],
|
|
|
|
['output', name, [nil, res_qname.namespace, res_qname.name]]
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def add_rpc_method_interface(name, param_def)
|
|
|
|
@servant.add_rpc_method_interface(name, param_def)
|
|
|
|
end
|
|
|
|
|
2004-12-20 08:50:15 -05:00
|
|
|
def add_document_method_interface(name, paramname)
|
|
|
|
@servant.add_document_method_interface(name, paramname)
|
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
class Servant__
|
|
|
|
attr_reader :proxy
|
2004-12-20 08:50:15 -05:00
|
|
|
attr_reader :options
|
|
|
|
attr_accessor :soapaction
|
2003-12-03 23:05:51 -05:00
|
|
|
|
|
|
|
def initialize(host, endpoint_url, namespace)
|
|
|
|
@host = host
|
|
|
|
@namespace = namespace
|
|
|
|
@soapaction = nil
|
2003-12-05 08:26:26 -05:00
|
|
|
@options = setup_options
|
2004-12-20 08:50:15 -05:00
|
|
|
@wiredump_file_base = nil
|
|
|
|
@endpoint_url = endpoint_url
|
|
|
|
@proxy = Proxy.new(endpoint_url, @soapaction, @options)
|
|
|
|
end
|
|
|
|
|
|
|
|
def inspect
|
|
|
|
"#<#{self.class}:#{@proxy.inspect}>"
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def endpoint_url
|
2004-12-20 08:50:15 -05:00
|
|
|
@proxy.endpoint_url
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def endpoint_url=(endpoint_url)
|
2004-12-20 08:50:15 -05:00
|
|
|
@proxy.endpoint_url = endpoint_url
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def mapping_registry
|
2004-12-20 08:50:15 -05:00
|
|
|
@proxy.mapping_registry
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def mapping_registry=(mapping_registry)
|
2004-12-20 08:50:15 -05:00
|
|
|
@proxy.mapping_registry = mapping_registry
|
2003-12-03 23:05:51 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def default_encodingstyle
|
|
|
|
@proxy.default_encodingstyle
|
|
|
|
end
|
|
|
|
|
|
|
|
def default_encodingstyle=(encodingstyle)
|
|
|
|
@proxy.default_encodingstyle = encodingstyle
|
|
|
|
end
|
|
|
|
|
2004-12-20 08:50:15 -05:00
|
|
|
def generate_explicit_type
|
|
|
|
@proxy.generate_explicit_type
|
|
|
|
end
|
|
|
|
|
|
|
|
def generate_explicit_type=(generate_explicit_type)
|
|
|
|
@proxy.generate_explicit_type = generate_explicit_type
|
|
|
|
end
|
|
|
|
|
|
|
|
def allow_unqualified_element
|
|
|
|
@proxy.allow_unqualified_element
|
|
|
|
end
|
|
|
|
|
|
|
|
def allow_unqualified_element=(allow_unqualified_element)
|
|
|
|
@proxy.allow_unqualified_element = allow_unqualified_element
|
|
|
|
end
|
|
|
|
|
|
|
|
def headerhandler
|
|
|
|
@proxy.headerhandler
|
|
|
|
end
|
|
|
|
|
|
|
|
def streamhandler
|
|
|
|
@proxy.streamhandler
|
|
|
|
end
|
|
|
|
|
2004-07-03 09:33:20 -04:00
|
|
|
def test_loopback_response
|
2004-12-20 08:50:15 -05:00
|
|
|
@proxy.test_loopback_response
|
|
|
|
end
|
|
|
|
|
|
|
|
def reset_stream
|
|
|
|
@proxy.reset_stream
|
2004-07-03 09:33:20 -04:00
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def invoke(headers, body)
|
2004-12-20 08:50:15 -05:00
|
|
|
if headers and !headers.is_a?(SOAPHeader)
|
|
|
|
headers = create_header(headers)
|
|
|
|
end
|
2003-12-03 23:05:51 -05:00
|
|
|
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)
|
2004-12-20 08:50:15 -05:00
|
|
|
@proxy.call(name, *params)
|
2003-12-03 23:05:51 -05:00
|
|
|
end
|
|
|
|
|
2004-12-20 08:50:15 -05:00
|
|
|
def add_rpc_method(name_as, soapaction, name, param_def)
|
2003-12-03 23:05:51 -05:00
|
|
|
qname = XSD::QName.new(@namespace, name_as)
|
2004-12-20 08:50:15 -05:00
|
|
|
@proxy.add_rpc_method(qname, soapaction, name, param_def)
|
2003-12-03 23:05:51 -05:00
|
|
|
add_rpc_method_interface(name, param_def)
|
|
|
|
end
|
|
|
|
|
2004-12-20 08:50:15 -05:00
|
|
|
def add_document_method(name_as, soapaction, name, param_def)
|
|
|
|
qname = XSD::QName.new(@namespace, name_as)
|
|
|
|
@proxy.add_document_method(qname, soapaction, name, param_def)
|
|
|
|
add_document_method_interface(name, param_def)
|
|
|
|
end
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def add_rpc_method_interface(name, param_def)
|
2004-12-21 10:08:56 -05:00
|
|
|
param_count = 0
|
2004-12-20 08:50:15 -05:00
|
|
|
@proxy.operation[name].each_param_name(RPC::SOAPMethod::IN,
|
2003-12-03 23:05:51 -05:00
|
|
|
RPC::SOAPMethod::INOUT) do |param_name|
|
2004-12-21 10:08:56 -05:00
|
|
|
param_count += 1
|
2003-12-03 23:05:51 -05:00
|
|
|
end
|
2004-12-21 10:08:56 -05:00
|
|
|
sclass = class << @host; self; end
|
|
|
|
sclass.__send__(:define_method, name, proc { |*arg|
|
|
|
|
unless arg.size == param_count
|
|
|
|
raise ArgumentError.new(
|
|
|
|
"wrong number of arguments (#{arg.size} for #{param_count})")
|
|
|
|
end
|
|
|
|
@servant.call(name, *arg)
|
|
|
|
})
|
2004-07-03 09:33:20 -04:00
|
|
|
@host.method(name)
|
2003-12-03 23:05:51 -05:00
|
|
|
end
|
|
|
|
|
2004-12-20 08:50:15 -05:00
|
|
|
def add_document_method_interface(name, paramname)
|
2004-12-21 10:08:56 -05:00
|
|
|
sclass = class << @host; self; end
|
|
|
|
sclass.__send__(:define_method, name, proc { |param|
|
|
|
|
@servant.call(name, param)
|
|
|
|
})
|
2004-12-20 08:50:15 -05:00
|
|
|
@host.method(name)
|
2004-07-03 09:33:20 -04:00
|
|
|
end
|
|
|
|
|
2004-12-20 08:50:15 -05:00
|
|
|
private
|
2004-07-03 09:33:20 -04:00
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def set_wiredump_file_base(name)
|
|
|
|
if @wiredump_file_base
|
2004-12-20 08:50:15 -05:00
|
|
|
@proxy.set_wiredump_file_base(@wiredump_file_base + "_#{ name }")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def create_header(headers)
|
|
|
|
header = SOAPHeader.new()
|
|
|
|
headers.each do |content, mustunderstand, encodingstyle|
|
|
|
|
header.add(SOAPHeaderItem.new(content, mustunderstand, encodingstyle))
|
2003-12-03 23:05:51 -05:00
|
|
|
end
|
2004-12-20 08:50:15 -05:00
|
|
|
header
|
2003-12-03 23:05:51 -05:00
|
|
|
end
|
|
|
|
|
2003-12-05 08:26:26 -05:00
|
|
|
def setup_options
|
|
|
|
if opt = Property.loadproperty(::SOAP::PropertyName)
|
2004-12-20 08:50:15 -05:00
|
|
|
opt = opt["client"]
|
2003-12-05 08:26:26 -05:00
|
|
|
end
|
|
|
|
opt ||= Property.new
|
|
|
|
opt.add_hook("protocol.mandatorycharset") do |key, value|
|
2004-12-20 08:50:15 -05:00
|
|
|
@proxy.mandatorycharset = value
|
2003-12-03 23:05:51 -05:00
|
|
|
end
|
2003-12-05 08:26:26 -05:00
|
|
|
opt.add_hook("protocol.wiredump_file_base") do |key, value|
|
2004-12-20 08:50:15 -05:00
|
|
|
@wiredump_file_base = value
|
2003-12-03 23:05:51 -05:00
|
|
|
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
|