From ff1b89a96d0f103ff0c917c458ddd3e36e9b3718 Mon Sep 17 00:00:00 2001 From: nahi Date: Tue, 6 Jan 2004 02:20:51 +0000 Subject: * 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 --- lib/soap/streamHandler.rb | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) (limited to 'lib/soap/streamHandler.rb') diff --git a/lib/soap/streamHandler.rb b/lib/soap/streamHandler.rb index d6b9c3bdca..0d08a00bd8 100644 --- a/lib/soap/streamHandler.rb +++ b/lib/soap/streamHandler.rb @@ -33,21 +33,14 @@ class StreamHandler attr_accessor :send_contenttype attr_accessor :receive_string attr_accessor :receive_contenttype + attr_accessor :is_fault - def initialize - @send_string = nil + def initialize(send_string = nil) + @send_string = send_string @send_contenttype = nil @receive_string = nil @receive_contenttype = nil - @bag = {} - end - - def [](idx) - @bag[idx] - end - - def []=(idx, value) - @bag[idx] = value + @is_fault = false end end @@ -59,7 +52,7 @@ class StreamHandler def self.parse_media_type(str) if /^#{ MediaType }(?:\s*;\s*charset=([^"]+|"[^"]+"))?$/i !~ str - raise StreamError.new("Illegal media type."); + return nil end charset = $1 charset.gsub!(/"/, '') if charset @@ -96,8 +89,8 @@ public "#<#{self.class}:#{endpoint_url}>" end - def send(soap_string, soapaction = nil, charset = @charset) - send_post(soap_string, soapaction, charset) + def send(conn_data, soapaction = nil, charset = @charset) + send_post(conn_data, soapaction, charset) end def reset @@ -163,25 +156,24 @@ private raise NotImplementedError.new end - def send_post(soap_string, soapaction, charset) - data = ConnectionData.new - data.send_string = soap_string - data.send_contenttype = StreamHandler.create_media_type(charset) + def send_post(conn_data, soapaction, charset) + conn_data.send_contenttype ||= StreamHandler.create_media_type(charset) if @wiredump_file_base filename = @wiredump_file_base + '_request.xml' f = File.open(filename, "w") - f << soap_string + f << conn_data.send_string f.close end extra = {} - extra['Content-Type'] = data.send_contenttype + extra['Content-Type'] = conn_data.send_contenttype extra['SOAPAction'] = "\"#{ soapaction }\"" + send_string = conn_data.send_string @wiredump_dev << "Wire dump:\n\n" if @wiredump_dev begin - res = @client.post(@endpoint_url, soap_string, extra) + res = @client.post(@endpoint_url, send_string, extra) rescue @client.reset(@endpoint_url) raise @@ -206,10 +198,9 @@ private raise HTTPStreamError.new("#{ res.status }: #{ res.reason }") end - data.receive_string = receive_string - data.receive_contenttype = res.contenttype - - return data + conn_data.receive_string = receive_string + conn_data.receive_contenttype = res.contenttype + conn_data end CRLF = "\r\n" -- cgit v1.2.3