Class: WsdlMapper::Runtime::S8rBase

Inherits:
Object
  • Object
show all
Defined in:
lib/wsdl_mapper/runtime/s8r_base.rb

Direct Known Subclasses

InputS8r, OutputS8r

Instance Method Summary collapse

Constructor Details

#initialize(type_directory, default_namespace = nil) ⇒ S8rBase

Returns a new instance of S8rBase.

Parameters:



9
10
11
12
# File 'lib/wsdl_mapper/runtime/s8r_base.rb', line 9

def initialize(type_directory, default_namespace = nil)
  @type_directory = type_directory
  @default_namespace = default_namespace
end

Instance Method Details

#build(x, envelope) ⇒ Object

Serializes the envelope using x

Parameters:



33
34
35
36
37
38
# File 'lib/wsdl_mapper/runtime/s8r_base.rb', line 33

def build(x, envelope)
  x.complex(nil, ['http://schemas.xmlsoap.org/soap/envelope/', 'Envelope'], []) do |x|
    build_header(x, envelope.header)
    build_body(x, envelope.body)
  end
end

#build_body(x, body) ⇒ Object

This method is abstract.

noinspection RubyUnusedLocalVariable

Parameters:

Raises:

  • (NotImplementedError)


52
53
54
# File 'lib/wsdl_mapper/runtime/s8r_base.rb', line 52

def build_body(x, body)
  raise NotImplementedError
end

#build_header(x, header) ⇒ Object

This method is abstract.

noinspection RubyUnusedLocalVariable

Parameters:

Raises:

  • (NotImplementedError)


44
45
46
# File 'lib/wsdl_mapper/runtime/s8r_base.rb', line 44

def build_header(x, header)
  raise NotImplementedError
end

#to_doc(envelope) ⇒ Nokogiri::XML::Document

Serializes the envelope and returns a Nokogiri::XML::Document

Parameters:

Returns:

  • (Nokogiri::XML::Document)

    XML document containing the encoded envelope



24
25
26
27
28
# File 'lib/wsdl_mapper/runtime/s8r_base.rb', line 24

def to_doc(envelope)
  core = WsdlMapper::Serializers::SerializerCore.new resolver: @type_directory, default_namespace: @default_namespace
  build core, envelope
  core.to_doc
end

#to_xml(envelope) ⇒ String

Serializes the envelope and returns an XML string

Parameters:

Returns:

  • (String)

    envelope serialized as XML



17
18
19
# File 'lib/wsdl_mapper/runtime/s8r_base.rb', line 17

def to_xml(envelope)
  to_doc(envelope).to_xml save_with: Nokogiri::XML::Node::SaveOptions::NO_DECLARATION
end