Class: Starapi::SoapServiceFacade::ExecuteSP

Inherits:
Base
  • Object
show all
Defined in:
lib/starapi/soap_service_facade/execute_sp.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#construct_envelope, #handle_error, #process_response

Instance Attribute Details

#request_xmlObject (readonly)

Returns the value of attribute request_xml.



29
30
31
# File 'lib/starapi/soap_service_facade/execute_sp.rb', line 29

def request_xml
  @request_xml
end

#responseObject (readonly)

Returns the value of attribute response.



29
30
31
# File 'lib/starapi/soap_service_facade/execute_sp.rb', line 29

def response
  @response
end

Instance Method Details

#envelope_execute_sp(input_xml) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/starapi/soap_service_facade/execute_sp.rb', line 31

def envelope_execute_sp(input_xml)
  envelope = construct_envelope do |xml|
    xml.ExecuteSP("xmlns" => Starapi.namespace) do
      xml.user Starapi.user
      xml.password Starapi.password
      xml.spName "RS_sp_EAI_Output"
      xml.paramList do
        xml.string "input_xml;#{input_xml}"
      end
      xml.outputParamList do
        xml.string "output_xml;8000"
      end
      xml.langCode "en-us"
    end
  end
end

#soap_execute_sp!(input_xml) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/starapi/soap_service_facade/execute_sp.rb', line 48

def soap_execute_sp!(input_xml)
  @request_xml = envelope_execute_sp(input_xml).to_xml
  @response = Typhoeus::Request.post(Starapi.service_url,
                                     :body    => @request_xml,
                                     :headers => {
                                       'Content-Type' => "text/xml; charset=utf-8",
                                       'Host' => '198.61.141.129',
                                       'SOAPAction'=>  '"http://www.opsolve.com/RS/webservices/ExecuteSP"',
                                       'Content-Length' => @request_xml.length
                                     })
                                     @response = process_response(@response)
end