mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05: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
This commit is contained in:
parent
8a8dd65199
commit
ff1b89a96d
26 changed files with 476 additions and 218 deletions
|
@ -40,7 +40,6 @@ class CGIStub < Logger::Application
|
|||
@method = ENV['REQUEST_METHOD']
|
||||
@size = ENV['CONTENT_LENGTH'].to_i || 0
|
||||
@contenttype = ENV['CONTENT_TYPE']
|
||||
@charset = nil
|
||||
@soapaction = ENV['HTTP_SOAPAction']
|
||||
@source = stream
|
||||
@body = nil
|
||||
|
@ -48,7 +47,6 @@ class CGIStub < Logger::Application
|
|||
|
||||
def init
|
||||
validate
|
||||
@charset = StreamHandler.parse_media_type(@contenttype)
|
||||
@body = @source.read(@size)
|
||||
self
|
||||
end
|
||||
|
@ -61,8 +59,8 @@ class CGIStub < Logger::Application
|
|||
@soapaction
|
||||
end
|
||||
|
||||
def charset
|
||||
@charset
|
||||
def contenttype
|
||||
@contenttype
|
||||
end
|
||||
|
||||
def to_s
|
||||
|
@ -142,8 +140,8 @@ class CGIStub < Logger::Application
|
|||
@router.add_method(receiver, qname, nil, name, param_def)
|
||||
end
|
||||
|
||||
def route(request_string, charset)
|
||||
@router.route(request_string, charset)
|
||||
def route(conn_data)
|
||||
@router.route(conn_data)
|
||||
end
|
||||
|
||||
def create_fault_response(e)
|
||||
|
@ -157,32 +155,30 @@ private
|
|||
|
||||
httpversion = WEBrick::HTTPVersion.new('1.0')
|
||||
@response = WEBrick::HTTPResponse.new({:HTTPVersion => httpversion})
|
||||
conn_data = nil
|
||||
begin
|
||||
log(INFO) { "Received a request from '#{ @remote_user }@#{ @remote_host }'." }
|
||||
# SOAP request parsing.
|
||||
@request = SOAPRequest.new.init
|
||||
@response['Status'] = 200
|
||||
req_charset = @request.charset
|
||||
req_string = @request.dump
|
||||
log(DEBUG) { "XML Request: #{req_string}" }
|
||||
res_string, is_fault = route(req_string, req_charset)
|
||||
log(DEBUG) { "XML Response: #{res_string}" }
|
||||
|
||||
@response['Cache-Control'] = 'private'
|
||||
if req_charset
|
||||
@response['content-type'] = "#{@mediatype}; charset=\"#{req_charset}\""
|
||||
else
|
||||
@response['content-type'] = @mediatype
|
||||
end
|
||||
if is_fault
|
||||
conn_data = ::SOAP::StreamHandler::ConnectionData.new
|
||||
conn_data.receive_string = @request.dump
|
||||
conn_data.receive_contenttype = @request.contenttype
|
||||
log(DEBUG) { "XML Request: #{conn_data.receive_string}" }
|
||||
conn_data = route(conn_data)
|
||||
log(DEBUG) { "XML Response: #{conn_data.send_string}" }
|
||||
if conn_data.is_fault
|
||||
@response['Status'] = 500
|
||||
end
|
||||
@response.body = res_string
|
||||
rescue Exception
|
||||
res_string = create_fault_response($!)
|
||||
@response['Cache-Control'] = 'private'
|
||||
@response['content-type'] = @mediatype
|
||||
@response.body = conn_data.send_string
|
||||
@response['content-type'] = conn_data.send_contenttype
|
||||
rescue Exception
|
||||
conn_data = create_fault_response($!)
|
||||
@response['Cache-Control'] = 'private'
|
||||
@response['Status'] = 500
|
||||
@response.body = conn_data.send_string
|
||||
@response['content-type'] = conn_data.send_contenttype || @mediatype
|
||||
ensure
|
||||
buf = ''
|
||||
@response.send_response(buf)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue