Class: ActionService::Protocol::Soap::SoapProtocol
- Inherits:
-
AbstractProtocol
- Object
- AbstractProtocol
- ActionService::Protocol::Soap::SoapProtocol
- Defined in:
- lib/action_service/protocol/soap.rb
Instance Attribute Summary
Attributes inherited from AbstractProtocol
Instance Method Summary collapse
- #marshal_exception(exception) ⇒ Object
- #marshal_response(request_info, export_info, return_value, strict = true) ⇒ Object
- #request_info ⇒ Object
- #request_supported?(request) ⇒ Boolean
- #unmarshal_request(request_info, export_info, strict = true) ⇒ Object
Methods inherited from AbstractProtocol
Constructor Details
This class inherits a constructor from ActionService::Protocol::AbstractProtocol
Instance Method Details
#marshal_exception(exception) ⇒ Object
80 81 82 |
# File 'lib/action_service/protocol/soap.rb', line 80 def marshal_exception(exception) ServiceResponseInfo.new(create_exception_response(exception), 'text/xml') end |
#marshal_response(request_info, export_info, return_value, strict = true) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/action_service/protocol/soap.rb', line 53 def marshal_response(request_info, export_info, return_value, strict=true) returns = export_info[:returns] create_param_def = lambda do |ret| map_types(ret) mapping = mapper.lookup(ret[0]) ret = [mapping.ruby_klass] retval = fixup_array_types(mapping, return_value) validate_types(request_info.public_method_name, ret, [retval], :out) retval = ruby_to_soap(retval) param_def = [['retval', 'return', mapping.registry_mapping]] [param_def, ret, retval] end if returns || !strict if returns param_def, returns, return_value = create_param_def.call(returns) else if strict param_def = [] else param_def, returns, return_value = create_param_def.call([return_value.class]) end end qname = XSD::QName.new(mapper.custom_namespace, request_info.public_method_name) response = SOAP::RPC::SOAPMethodResponse.new(qname, param_def) response.retval = return_value if returns ServiceResponseInfo.new(create_response(response), 'text/xml') end |
#request_info ⇒ Object
84 85 86 |
# File 'lib/action_service/protocol/soap.rb', line 84 def request_info @request_info end |
#request_supported?(request) ⇒ Boolean
88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/action_service/protocol/soap.rb', line 88 def request_supported?(request) soap_action = extract_soap_action(request) return false unless soap_action service_name = request.parameters['action'] public_method_name = soap_action.gsub(/^[\/]+/, '').split(/[\/]+/)[-1] @request_info = ServiceRequestInfo.new(service_name, public_method_name, request.raw_post, request.env['HTTP_CONTENT_TYPE'] || 'text/xml') true end |
#unmarshal_request(request_info, export_info, strict = true) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/action_service/protocol/soap.rb', line 31 def unmarshal_request(request_info, export_info, strict=true) expects = export_info[:expects] = lambda do envelope = SOAP::Processor.unmarshal(request_info.raw_body) request = envelope.body.request params = request.collect{|k, v| request[k]} soap_to_ruby_array(params) end if expects || !strict if expects map_types(expects) params = .call validate_types(request_info.public_method_name, expects, params, :in) if expects params else if strict [] else .call end end end |