* 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 - Stream handler.
|
|
|
|
# Copyright (C) 2000, 2001, 2003 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'
|
2003-12-03 23:05:51 -05:00
|
|
|
require 'soap/property'
|
2003-09-24 11:18:44 -04:00
|
|
|
|
|
|
|
|
|
|
|
module SOAP
|
|
|
|
|
|
|
|
|
|
|
|
class StreamHandler
|
|
|
|
Client = begin
|
|
|
|
require 'http-access2'
|
|
|
|
if HTTPAccess2::VERSION < "2.0"
|
|
|
|
raise LoadError.new("http-access/2.0 or later is required.")
|
|
|
|
end
|
|
|
|
HTTPAccess2::Client
|
|
|
|
rescue LoadError
|
|
|
|
STDERR.puts "Loading http-access2 failed. Net/http is used." if $DEBUG
|
|
|
|
require 'soap/netHttpClient'
|
|
|
|
SOAP::NetHttpClient
|
|
|
|
end
|
|
|
|
|
|
|
|
RUBY_VERSION_STRING = "ruby #{ RUBY_VERSION } (#{ RUBY_RELEASE_DATE }) [#{ RUBY_PLATFORM }]"
|
|
|
|
|
|
|
|
class ConnectionData
|
|
|
|
attr_accessor :send_string
|
|
|
|
attr_accessor :send_contenttype
|
|
|
|
attr_accessor :receive_string
|
|
|
|
attr_accessor :receive_contenttype
|
* 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
|
|
|
attr_accessor :is_fault
|
2003-09-24 11:18:44 -04:00
|
|
|
|
* 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
|
|
|
def initialize(send_string = nil)
|
|
|
|
@send_string = send_string
|
2003-09-24 11:18:44 -04:00
|
|
|
@send_contenttype = nil
|
|
|
|
@receive_string = nil
|
|
|
|
@receive_contenttype = nil
|
* 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
|
|
|
@is_fault = false
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
attr_accessor :endpoint_url
|
|
|
|
|
|
|
|
def initialize(endpoint_url)
|
|
|
|
@endpoint_url = endpoint_url
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.parse_media_type(str)
|
|
|
|
if /^#{ MediaType }(?:\s*;\s*charset=([^"]+|"[^"]+"))?$/i !~ str
|
* 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
|
|
|
return nil
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
charset = $1
|
|
|
|
charset.gsub!(/"/, '') if charset
|
* 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
|
|
|
charset || 'us-ascii'
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.create_media_type(charset)
|
|
|
|
"#{ MediaType }; charset=#{ charset }"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
class HTTPPostStreamHandler < StreamHandler
|
|
|
|
include SOAP
|
|
|
|
|
|
|
|
public
|
|
|
|
|
* 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
|
|
|
attr_reader :client
|
2003-12-03 23:05:51 -05:00
|
|
|
attr_accessor :wiredump_file_base
|
2003-09-24 11:18:44 -04:00
|
|
|
|
|
|
|
NofRetry = 10 # [times]
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def initialize(endpoint_url, options)
|
2003-09-24 11:18:44 -04:00
|
|
|
super(endpoint_url)
|
2003-12-03 23:05:51 -05:00
|
|
|
@client = Client.new(nil, "SOAP4R/#{ Version }")
|
2003-09-24 11:18:44 -04:00
|
|
|
@wiredump_file_base = nil
|
2003-12-03 23:05:51 -05:00
|
|
|
@charset = @wiredump_dev = nil
|
|
|
|
@options = options
|
|
|
|
set_options
|
|
|
|
@client.debug_dev = @wiredump_dev
|
2004-07-03 09:33:20 -04:00
|
|
|
@cookie_store = nil
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_loopback_response
|
|
|
|
@client.test_loopback_response
|
2003-09-24 11:18:44 -04:00
|
|
|
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
|
|
|
def inspect
|
|
|
|
"#<#{self.class}:#{endpoint_url}>"
|
|
|
|
end
|
|
|
|
|
* 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
|
|
|
def send(conn_data, soapaction = nil, charset = @charset)
|
|
|
|
send_post(conn_data, soapaction, charset)
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def reset
|
|
|
|
@client.reset(@endpoint_url)
|
2004-07-03 09:33:20 -04:00
|
|
|
@client.save_cookie_store if @cookie_store
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
def set_options
|
|
|
|
@client.proxy = @options["proxy"]
|
|
|
|
@options.add_hook("proxy") do |key, value|
|
|
|
|
@client.proxy = value
|
|
|
|
end
|
|
|
|
@client.no_proxy = @options["no_proxy"]
|
|
|
|
@options.add_hook("no_proxy") do |key, value|
|
|
|
|
@client.no_proxy = value
|
|
|
|
end
|
2003-12-03 23:19:12 -05:00
|
|
|
if @client.respond_to?(:protocol_version=)
|
|
|
|
@client.protocol_version = @options["protocol_version"]
|
|
|
|
@options.add_hook("protocol_version") do |key, value|
|
|
|
|
@client.protocol_version = value
|
|
|
|
end
|
2003-12-03 23:05:51 -05:00
|
|
|
end
|
|
|
|
set_cookie_store_file(@options["cookie_store_file"])
|
|
|
|
@options.add_hook("cookie_store_file") do |key, value|
|
|
|
|
set_cookie_store_file(value)
|
|
|
|
end
|
|
|
|
@charset = @options["charset"] || XSD::Charset.charset_label($KCODE)
|
|
|
|
@options.add_hook("charset") do |key, value|
|
|
|
|
@charset = value
|
|
|
|
end
|
|
|
|
@wiredump_dev = @options["wiredump_dev"]
|
|
|
|
@options.add_hook("wiredump_dev") do |key, value|
|
|
|
|
@wiredump_dev = value
|
|
|
|
@client.debug_dev = @wiredump_dev
|
|
|
|
end
|
2004-07-03 09:33:20 -04:00
|
|
|
ssl_config = @options["ssl_config"] ||= ::SOAP::Property.new
|
|
|
|
set_ssl_config(ssl_config)
|
|
|
|
ssl_config.add_hook(true) do |key, value|
|
|
|
|
set_ssl_config(ssl_config)
|
|
|
|
end
|
2003-12-03 23:05:51 -05:00
|
|
|
basic_auth = @options["basic_auth"] ||= ::SOAP::Property.new
|
|
|
|
set_basic_auth(basic_auth)
|
|
|
|
basic_auth.add_hook do |key, value|
|
|
|
|
set_basic_auth(basic_auth)
|
|
|
|
end
|
|
|
|
@options.lock(true)
|
2004-07-03 09:33:20 -04:00
|
|
|
ssl_config.unlock
|
2003-12-03 23:05:51 -05:00
|
|
|
basic_auth.unlock
|
|
|
|
end
|
|
|
|
|
|
|
|
def set_basic_auth(basic_auth)
|
|
|
|
basic_auth.values.each do |url, userid, passwd|
|
|
|
|
@client.set_basic_auth(url, userid, passwd)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def set_cookie_store_file(value)
|
2004-07-03 09:33:20 -04:00
|
|
|
@cookie_store = value
|
|
|
|
@client.set_cookie_store(@cookie_store) if @cookie_store
|
|
|
|
end
|
|
|
|
|
|
|
|
def set_ssl_config(ssl_config)
|
|
|
|
ssl_config.each do |key, value|
|
|
|
|
cfg = @client.ssl_config
|
|
|
|
case key
|
|
|
|
when 'client_cert'
|
|
|
|
cfg.client_cert = cert_from_file(value)
|
|
|
|
when 'client_key'
|
|
|
|
cfg.client_key = key_from_file(value)
|
|
|
|
when 'client_ca'
|
|
|
|
cfg.client_ca = value
|
|
|
|
when 'ca_path'
|
|
|
|
cfg.set_trust_ca(value)
|
|
|
|
when 'ca_file'
|
|
|
|
cfg.set_trust_ca(value)
|
|
|
|
when 'crl'
|
|
|
|
cfg.set_crl(value)
|
|
|
|
when 'verify_mode'
|
|
|
|
cfg.verify_mode = ssl_config_int(value)
|
|
|
|
when 'verify_depth'
|
|
|
|
cfg.verify_depth = ssl_config_int(value)
|
|
|
|
when 'options'
|
|
|
|
cfg.options = value
|
|
|
|
when 'ciphers'
|
|
|
|
cfg.ciphers = value
|
|
|
|
when 'verify_callback'
|
|
|
|
cfg.verify_callback = value
|
|
|
|
when 'cert_store'
|
|
|
|
cfg.cert_store = value
|
|
|
|
else
|
|
|
|
raise ArgumentError.new("unknown ssl_config property #{key}")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def ssl_config_int(value)
|
|
|
|
if value.nil? or value.empty?
|
|
|
|
nil
|
|
|
|
else
|
|
|
|
begin
|
|
|
|
Integer(value)
|
|
|
|
rescue ArgumentError
|
|
|
|
::SOAP::Property::Util.const_from_name(value)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def cert_from_file(filename)
|
|
|
|
OpenSSL::X509::Certificate.new(File.open(filename) { |f| f.read })
|
2003-12-03 23:05:51 -05:00
|
|
|
end
|
|
|
|
|
2004-07-03 09:33:20 -04:00
|
|
|
def key_from_file(filename)
|
|
|
|
OpenSSL::PKey::RSA.new(File.open(filename) { |f| f.read })
|
2003-12-03 23:05:51 -05:00
|
|
|
end
|
|
|
|
|
* 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
|
|
|
def send_post(conn_data, soapaction, charset)
|
|
|
|
conn_data.send_contenttype ||= StreamHandler.create_media_type(charset)
|
2003-09-24 11:18:44 -04:00
|
|
|
|
|
|
|
if @wiredump_file_base
|
|
|
|
filename = @wiredump_file_base + '_request.xml'
|
|
|
|
f = File.open(filename, "w")
|
* 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
|
|
|
f << conn_data.send_string
|
2003-09-24 11:18:44 -04:00
|
|
|
f.close
|
|
|
|
end
|
|
|
|
|
|
|
|
extra = {}
|
* 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
|
|
|
extra['Content-Type'] = conn_data.send_contenttype
|
2003-09-24 11:18:44 -04:00
|
|
|
extra['SOAPAction'] = "\"#{ soapaction }\""
|
* 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
|
|
|
send_string = conn_data.send_string
|
2003-09-24 11:18:44 -04:00
|
|
|
|
2003-12-03 23:05:51 -05:00
|
|
|
@wiredump_dev << "Wire dump:\n\n" if @wiredump_dev
|
2003-09-24 11:18:44 -04:00
|
|
|
begin
|
* 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
|
|
|
res = @client.post(@endpoint_url, send_string, extra)
|
2003-09-24 11:18:44 -04:00
|
|
|
rescue
|
|
|
|
@client.reset(@endpoint_url)
|
|
|
|
raise
|
|
|
|
end
|
2003-12-03 23:05:51 -05:00
|
|
|
@wiredump_dev << "\n\n" if @wiredump_dev
|
2003-09-24 11:18:44 -04:00
|
|
|
|
|
|
|
receive_string = res.content
|
|
|
|
|
|
|
|
if @wiredump_file_base
|
|
|
|
filename = @wiredump_file_base + '_response.xml'
|
|
|
|
f = File.open(filename, "w")
|
|
|
|
f << receive_string
|
|
|
|
f.close
|
|
|
|
end
|
|
|
|
|
|
|
|
case res.status
|
|
|
|
when 405
|
|
|
|
raise PostUnavailableError.new("#{ res.status }: #{ res.reason }")
|
|
|
|
when 200, 500
|
|
|
|
# Nothing to do.
|
|
|
|
else
|
|
|
|
raise HTTPStreamError.new("#{ res.status }: #{ res.reason }")
|
|
|
|
end
|
|
|
|
|
* 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
|
|
|
conn_data.receive_string = receive_string
|
|
|
|
conn_data.receive_contenttype = res.contenttype
|
|
|
|
conn_data
|
2003-09-24 11:18:44 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
CRLF = "\r\n"
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
end
|