Class: QBWC::SoapWrapper

Inherits:
Object
  • Object
show all
Includes:
QBWC
Defined in:
lib/qbwc/soap_wrapper.rb

Constant Summary

Constants included from QBWC

VERSION

Class Method Summary collapse

Methods included from QBWC

add_job, api=, configure, on_error=

Class Method Details

.initialize_singletonObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/qbwc/soap_wrapper.rb', line 7

def self.initialize_singleton
  @router = ::SOAP::RPC::Router.new('QBWebConnectorSvcSoap')
  @router.mapping_registry = DefaultMappingRegistry::EncodedRegistry
  @router.literal_mapping_registry = DefaultMappingRegistry::LiteralRegistry
  @conn_data = ::SOAP::StreamHandler::ConnectionData.new

  servant = QBWebConnectorSvcSoap.new
  QBWebConnectorSvcSoap::Methods.each do |definitions|
    opt = definitions.last
    if opt[:request_style] == :document
      @router.add_document_operation(servant, *definitions)
    else
      @router.add_rpc_operation(servant, *definitions)
    end
  end
end

.route_request(request) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/qbwc/soap_wrapper.rb', line 24

def self.route_request(request)
  @conn_data.receive_string = request.raw_post
  @conn_data.receive_contenttype = request.content_type
  @conn_data.soapaction = nil

  @router.external_ces = nil 
  res_data = @router.route(@conn_data) 
  res_data.send_string
end