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) ⇒ Object
- #request_info(request) ⇒ Object
- #request_supported?(request) ⇒ Boolean
- #unmarshal_request(request_info, export_info) ⇒ Object
Methods inherited from AbstractProtocol
Constructor Details
This class inherits a constructor from ActionService::Protocol::AbstractProtocol
Instance Method Details
#marshal_exception(exception) ⇒ Object
58 59 60 |
# File 'lib/action_service/protocol/soap.rb', line 58 def marshal_exception(exception) ServiceResponseInfo.new(create_exception_response(exception), 'text/xml') end |
#marshal_response(request_info, export_info, return_value) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/action_service/protocol/soap.rb', line 42 def marshal_response(request_info, export_info, return_value) returns = export_info[:returns] if returns map_types(returns) mapping = mapper.lookup(returns[0]) return_value = fixup_array_types(mapping, return_value) end validate_types(request_info.public_method_name, returns, [return_value], :out) return_value = ruby_to_soap(return_value) param_def = returns ? [['retval', 'return', mapping.registry_mapping]] : [] qname = XSD::QName.new(mapper.custom_namespace, request_info.public_method_name) response = SOAP::RPC::SOAPMethodResponse.new(qname, param_def) response.retval = return_value ServiceResponseInfo.new(create_response(response), 'text/xml') end |
#request_info(request) ⇒ Object
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/action_service/protocol/soap.rb', line 62 def request_info(request) soap_action = extract_soap_action(request) service_name = request.parameters['action'] public_method_name = soap_action.gsub(/^[\/]+/, '').split(/[\/]+/)[-1] ServiceRequestInfo.new(service_name, public_method_name, request.raw_post, request.env['HTTP_CONTENT_TYPE'] || 'text/xml', :soap => { :action => soap_action }) end |
#request_supported?(request) ⇒ Boolean
73 74 75 |
# File 'lib/action_service/protocol/soap.rb', line 73 def request_supported?(request) extract_soap_action(request) ? true : false end |
#unmarshal_request(request_info, export_info) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/action_service/protocol/soap.rb', line 31 def unmarshal_request(request_info, export_info) expects = export_info[:expects] map_types(expects) if expects envelope = SOAP::Processor.unmarshal(request_info.raw_body) request = envelope.body.request params = request.collect{|k, v| request[k]} params = soap_to_ruby_array(params) validate_types(request_info.public_method_name, expects, params, :in) if expects params end |