Class: SOAP::RPC::Proxy
- Inherits:
-
Object
- Object
- SOAP::RPC::Proxy
- Defined in:
- lib/adwords4r/soap4rpatches.rb
Instance Attribute Summary collapse
-
#callbackhandler ⇒ Object
Returns the value of attribute callbackhandler.
Instance Method Summary collapse
-
#call(name, *params) ⇒ Object
This method is a copy of the one included in soap4r, with the additions marked below, to enable the callback.
Instance Attribute Details
#callbackhandler ⇒ Object
Returns the value of attribute callbackhandler.
100 101 102 |
# File 'lib/adwords4r/soap4rpatches.rb', line 100 def callbackhandler @callbackhandler end |
Instance Method Details
#call(name, *params) ⇒ Object
This method is a copy of the one included in soap4r, with the additions marked below, to enable the callback.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/adwords4r/soap4rpatches.rb', line 104 def call(name, *params) # name must be used only for lookup op_info = lookup_operation(name) mapping_opt = create_mapping_opt req_header = create_request_header req_body = SOAPBody.new( op_info.request_body(params, @mapping_registry, @literal_mapping_registry, mapping_opt) ) reqopt = create_encoding_opt( :soapaction => op_info.soapaction || @soapaction, :envelopenamespace => @options["soap.envelope.requestnamespace"], :default_encodingstyle => @default_encodingstyle || op_info.request_default_encodingstyle, :use_default_namespace => op_info.use_default_namespace || @use_default_namespace ) resopt = create_encoding_opt( :envelopenamespace => @options["soap.envelope.responsenamespace"], :default_encodingstyle => @default_encodingstyle || op_info.response_default_encodingstyle ) if reqopt[:generate_explicit_type].nil? reqopt[:generate_explicit_type] = (op_info.request_use == :encoded) end if resopt[:generate_explicit_type].nil? resopt[:generate_explicit_type] = (op_info.response_use == :encoded) end env = route(req_header, req_body, reqopt, resopt) ### Patch starts here ### if op_info.response_use.nil? unless callbackhandler.nil? callbackhandler.on_callback(name, @endpoint_url, env, params) end return nil end fault = false = nil begin unless env fault = true = 'Empty SOAP response' raise EmptyResponseError end receive_headers(env.header) begin check_fault(env.body) rescue ::SOAP::FaultError => e fault = true = e.to_s op_info.raise_fault(e, @mapping_registry, @literal_mapping_registry) end ensure unless callbackhandler.nil? callbackhandler.on_callback(name, @endpoint_url, env, params, fault, ) end end ### Patch ends here ### if @return_response_as_xml resopt[:response_as_xml] else op_info.response_obj(env.body, @mapping_registry, @literal_mapping_registry, mapping_opt) end end |