| Class | SOAP::RPC::Proxy |
| In: |
soap/rpc/proxy.rb
|
| Parent: | Object |
| allow_unqualified_element | [RW] | |
| default_encodingstyle | [RW] | |
| mandatorycharset | [RW] | |
| method | [R] | |
| soapaction | [RW] |
# File soap/rpc/proxy.rb, line 33 def initialize(streamhandler, soapaction = nil) @streamhandler = streamhandler @soapaction = soapaction @method = {} @mandatorycharset = nil @allow_unqualified_element = false @default_encodingstyle = nil end
# File soap/rpc/proxy.rb, line 71 def add_method(qname, soapaction, name, param_def) @method[name] = SOAPMethodRequest.new(qname, param_def, soapaction) end
# File soap/rpc/proxy.rb, line 115 def call(req_header, name, *values) req = create_request(name, *values) invoke(req_header, req.method, req.method.soapaction || @soapaction) end
# File soap/rpc/proxy.rb, line 120 def check_fault(body) if body.fault raise SOAP::FaultError.new(body.fault) end end
# File soap/rpc/proxy.rb, line 75 def create_request(name, *values) if (@method.key?(name)) method = @method[name] method.encodingstyle = @default_encodingstyle if @default_encodingstyle else raise SOAP::RPC::MethodDefinitionError.new( "Method: #{ name } not defined.") end Request.new(method, values) end
# File soap/rpc/proxy.rb, line 86 def invoke(req_header, req_body, soapaction = nil) if req_header and !req_header.is_a?(SOAPHeader) req_header = create_header(req_header) end if !req_body.is_a?(SOAPBody) req_body = SOAPBody.new(req_body) end opt = create_options opt[:external_content] = nil req_env = SOAPEnvelope.new(req_header, req_body) send_string = Processor.marshal(req_env, opt) conn_data = StreamHandler::ConnectionData.new(send_string) if ext = opt[:external_content] mime = MIMEMessage.new ext.each do |k, v| mime.add_attachment(v.data) end mime.add_part(conn_data.send_string + "\r\n") mime.close conn_data.send_string = mime.content_str conn_data.send_contenttype = mime.headers['content-type'].str end conn_data = @streamhandler.send(conn_data, soapaction) if conn_data.receive_string.empty? return nil, nil end unmarshal(conn_data, opt) end