Class: Soap4juddi::XML

Inherits:
Object
  • Object
show all
Defined in:
lib/soap4juddi/xml.rb

Instance Method Summary collapse

Instance Method Details

#content_typeObject



30
31
32
# File 'lib/soap4juddi/xml.rb', line 30

def content_type
  'text/xml;charset=UTF-8'
end

#element_with_key_value(element, key, value, attributes = nil) ⇒ Object



3
4
5
# File 'lib/soap4juddi/xml.rb', line 3

def element_with_key_value(element, key, value, attributes = nil)
  element_with_value(element, "#{key}:#{value}", attributes)
end

#element_with_value(element, value, attributes = nil) ⇒ Object



7
8
9
10
11
12
# File 'lib/soap4juddi/xml.rb', line 7

def element_with_value(element, value, attributes = nil)
  validate_element(element)
  xml = "<urn:#{element}"
  xml = append_key_value_attributes_to_xml(xml, attributes) if attributes
  xml += ">#{value}</urn:#{element}>"
end

#envelope_header_body(text, version = 3) ⇒ Object



19
20
21
# File 'lib/soap4juddi/xml.rb', line 19

def envelope_header_body(text, version = 3)
  "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:urn='urn:uddi-org:api_v#{version.to_s}'> <soapenv:Header/> <soapenv:Body>#{text.to_s}</soapenv:Body> </soapenv:Envelope>"
end

#extract_value(soap, key) ⇒ Object



14
15
16
17
# File 'lib/soap4juddi/xml.rb', line 14

def extract_value(soap, key)
  validate_text(soap, 'text') and validate_text(key, 'key')
  extract_value_in_quotes_using_key(soap, key)
end

#soap_envelope(message, urn = nil, attributes = nil) ⇒ Object



23
24
25
26
27
28
# File 'lib/soap4juddi/xml.rb', line 23

def soap_envelope(message, urn = nil, attributes = nil)
  validate_text(urn, 'urn') if urn
  validate_text(attributes, 'attributes') if attributes
  text = inject_urn_and_attributes_into_message(message, urn, attributes)
  envelope_header_body(text, 2)
end