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.
VERSION | = | Version = '1.5.5' |
PropertyName | = | 'soap/property' |
EnvelopeNamespace | = | 'http://schemas.xmlsoap.org/soap/envelope/' |
EncodingNamespace | = | 'http://schemas.xmlsoap.org/soap/encoding/' |
LiteralNamespace | = | 'http://xml.apache.org/xml-soap/literalxml' |
NextActor | = | 'http://schemas.xmlsoap.org/soap/actor/next' |
EleEnvelope | = | 'Envelope' |
EleHeader | = | 'Header' |
EleBody | = | 'Body' |
EleFault | = | 'Fault' |
EleFaultString | = | 'faultstring' |
EleFaultActor | = | 'faultactor' |
EleFaultCode | = | 'faultcode' |
EleFaultDetail | = | 'detail' |
AttrMustUnderstand | = | 'mustUnderstand' |
AttrEncodingStyle | = | 'encodingStyle' |
AttrActor | = | 'actor' |
AttrRoot | = | 'root' |
AttrArrayType | = | 'arrayType' |
AttrOffset | = | 'offset' |
AttrPosition | = | 'position' |
ValueArray | = | 'Array' |
EleEnvelopeName | = | XSD::QName.new(EnvelopeNamespace, EleEnvelope).freeze |
EleHeaderName | = | XSD::QName.new(EnvelopeNamespace, EleHeader).freeze |
EleBodyName | = | XSD::QName.new(EnvelopeNamespace, EleBody).freeze |
EleFaultName | = | XSD::QName.new(EnvelopeNamespace, EleFault).freeze |
EleFaultStringName | = | XSD::QName.new(nil, EleFaultString).freeze |
EleFaultActorName | = | XSD::QName.new(nil, EleFaultActor).freeze |
EleFaultCodeName | = | XSD::QName.new(nil, EleFaultCode).freeze |
EleFaultDetailName | = | XSD::QName.new(nil, EleFaultDetail).freeze |
AttrMustUnderstandName | = | XSD::QName.new(EnvelopeNamespace, AttrMustUnderstand).freeze |
AttrEncodingStyleName | = | XSD::QName.new(EnvelopeNamespace, AttrEncodingStyle).freeze |
AttrRootName | = | XSD::QName.new(EncodingNamespace, AttrRoot).freeze |
AttrArrayTypeName | = | XSD::QName.new(EncodingNamespace, AttrArrayType).freeze |
AttrOffsetName | = | XSD::QName.new(EncodingNamespace, AttrOffset).freeze |
AttrPositionName | = | XSD::QName.new(EncodingNamespace, AttrPosition).freeze |
ValueArrayName | = | XSD::QName.new(EncodingNamespace, ValueArray).freeze |
Base64Literal | = | 'base64' |
SOAPNamespaceTag | = | 'env' |
XSDNamespaceTag | = | 'xsd' |
XSINamespaceTag | = | 'xsi' |
MediaType | = | 'text/xml' |
TypeMap | = | { XSD::XSDAnySimpleType::Type => SOAPAnySimpleType, XSD::XSDString::Type => SOAPString, XSD::XSDBoolean::Type => SOAPBoolean, XSD::XSDDecimal::Type => SOAPDecimal, XSD::XSDFloat::Type => SOAPFloat, XSD::XSDDouble::Type => SOAPDouble, XSD::XSDDuration::Type => SOAPDuration, XSD::XSDDateTime::Type => SOAPDateTime, XSD::XSDTime::Type => SOAPTime, XSD::XSDDate::Type => SOAPDate, XSD::XSDGYearMonth::Type => SOAPGYearMonth, XSD::XSDGYear::Type => SOAPGYear, XSD::XSDGMonthDay::Type => SOAPGMonthDay, XSD::XSDGDay::Type => SOAPGDay, XSD::XSDGMonth::Type => SOAPGMonth, XSD::XSDHexBinary::Type => SOAPHexBinary, XSD::XSDBase64Binary::Type => SOAPBase64, XSD::XSDAnyURI::Type => SOAPAnyURI, XSD::XSDQName::Type => SOAPQName, XSD::XSDInteger::Type => SOAPInteger, XSD::XSDNonPositiveInteger::Type => SOAPNonPositiveInteger, XSD::XSDNegativeInteger::Type => SOAPNegativeInteger, XSD::XSDLong::Type => SOAPLong, XSD::XSDInt::Type => SOAPInt, XSD::XSDShort::Type => SOAPShort, XSD::XSDByte::Type => SOAPByte, XSD::XSDNonNegativeInteger::Type => SOAPNonNegativeInteger, XSD::XSDUnsignedLong::Type => SOAPUnsignedLong, XSD::XSDUnsignedInt::Type => SOAPUnsignedInt, XSD::XSDUnsignedShort::Type => SOAPUnsignedShort, XSD::XSDUnsignedByte::Type => SOAPUnsignedByte, XSD::XSDPositiveInteger::Type => SOAPPositiveInteger, SOAP::SOAPBase64::Type => SOAPBase64, } |
NO_PROXY_HOSTS | = | ['localhost'] |
connect_timeout | [RW] | |
debug_dev | [RW] | |
no_proxy | [RW] | |
protocol_version | [RW] | |
proxy | [R] | |
receive_timeout | [RW] | |
send_timeout | [RW] | |
ssl_config | [RW] |
# File lib/soap/netHttpClient.rb, line 33 33: def initialize(proxy = nil, agent = nil) 34: @proxy = proxy ? URI.parse(proxy) : nil 35: @agent = agent 36: @debug_dev = nil 37: @session_manager = SessionManager.new 38: @no_proxy = @ssl_config = @protocol_version = nil 39: @connect_timeout = @send_timeout = @receive_timeout = nil 40: end
# File lib/soap/netHttpClient.rb, line 98 98: def get_content(url, header = {}) 99: unless url.is_a?(URI) 100: url = URI.parse(url) 101: end 102: extra = header.dup 103: extra['User-Agent'] = @agent if @agent 104: res = start(url) { |http| 105: http.get(url.request_uri, extra) 106: } 107: res.body 108: end
# File lib/soap/netHttpClient.rb, line 86 86: def post(url, req_body, header = {}) 87: unless url.is_a?(URI) 88: url = URI.parse(url) 89: end 90: extra = header.dup 91: extra['User-Agent'] = @agent if @agent 92: res = start(url) { |http| 93: http.post(url.request_uri, req_body, extra) 94: } 95: Response.new(res) 96: end
# File lib/soap/netHttpClient.rb, line 46 46: def proxy=(proxy) 47: if proxy.nil? 48: @proxy = nil 49: else 50: if proxy.is_a?(URI) 51: @proxy = proxy 52: else 53: @proxy = URI.parse(proxy) 54: end 55: if @proxy.scheme == nil or @proxy.scheme.downcase != 'http' or 56: @proxy.host == nil or @proxy.port == nil 57: raise ArgumentError.new("unsupported proxy `#{proxy}'") 58: end 59: end 60: reset_all 61: @proxy 62: end
# File lib/soap/netHttpClient.rb, line 78 78: def reset(url) 79: # no persistent connection. ignored. 80: end
# File lib/soap/netHttpClient.rb, line 82 82: def reset_all 83: # no persistent connection. ignored. 84: end
# File lib/soap/netHttpClient.rb, line 74 74: def save_cookie_store(filename) 75: raise NotImplementedError.new 76: end
# File lib/soap/netHttpClient.rb, line 64 64: def set_basic_auth(uri, user_id, passwd) 65: # net/http does not handle url. 66: @basic_auth = [user_id, passwd] 67: raise NotImplementedError.new("basic_auth is not supported under soap4r + net/http.") 68: end
# File lib/soap/netHttpClient.rb, line 70 70: def set_cookie_store(filename) 71: raise NotImplementedError.new 72: end
# File lib/soap/netHttpClient.rb, line 42 42: def test_loopback_response 43: raise NotImplementedError.new("not supported for now") 44: end
# File lib/soap/netHttpClient.rb, line 123 123: def create_connection(url) 124: proxy_host = proxy_port = nil 125: unless no_proxy?(url) 126: proxy_host = @proxy.host 127: proxy_port = @proxy.port 128: end 129: http = Net::HTTP::Proxy(proxy_host, proxy_port).new(url.host, url.port) 130: if http.respond_to?(:set_debug_output) 131: http.set_debug_output(@debug_dev) 132: end 133: http.open_timeout = @connect_timeout if @connect_timeout 134: http.read_timeout = @receive_timeout if @receive_timeout 135: case url 136: when URI::HTTPS 137: if SSLEnabled 138: http.use_ssl = true 139: else 140: raise RuntimeError.new("Cannot connect to #{url} (OpenSSL is not installed.)") 141: end 142: when URI::HTTP 143: # OK 144: else 145: raise RuntimeError.new("Cannot connect to #{url} (Not HTTP.)") 146: end 147: http 148: end
# File lib/soap/netHttpClient.rb, line 152 152: def no_proxy?(uri) 153: if !@proxy or NO_PROXY_HOSTS.include?(uri.host) 154: return true 155: end 156: if @no_proxy 157: @no_proxy.scan(/([^:,]*)(?::(\d+))?/) do |host, port| 158: if /(\A|\.)#{Regexp.quote(host)}\z/i =~ uri.host && 159: (!port || uri.port == port.to_i) 160: return true 161: end 162: end 163: else 164: false 165: end 166: end