class WsdlMapper::Runtime::S8rBase

Public Class Methods

new(type_directory, default_namespace = nil) click to toggle source

@param [WsdlMapper::Serializers::TypeDirectory] type_directory @param [String] default_namespace Specify a `default_namespace` to skip namespace prefixes

# 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

Public Instance Methods

build(x, envelope) click to toggle source

Serializes the `envelope` using `x` @param [WsdlMapper::Serializers::SerializerCore] x Serializer instance to use @param [WsdlMapper::SvcDesc::Envelope] envelope

# 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) click to toggle source

@abstract @param [WsdlMapper::Serializers::SerializerCore] x Serializer instance to use @param [WsdlMapper::Runtime::Body] body noinspection RubyUnusedLocalVariable

# File lib/wsdl_mapper/runtime/s8r_base.rb, line 52
def build_body(x, body)
  raise NotImplementedError
end
build_header(x, header) click to toggle source

@abstract @param [WsdlMapper::Serializers::SerializerCore] x Serializer instance to use @param [WsdlMapper::Runtime::Header] header noinspection RubyUnusedLocalVariable

# File lib/wsdl_mapper/runtime/s8r_base.rb, line 44
def build_header(x, header)
  raise NotImplementedError
end
to_doc(envelope) click to toggle source

Serializes the `envelope` and returns a {Nokogiri::XML::Document} @param [WsdlMapper::SvcDesc::Envelope] envelope @return [Nokogiri::XML::Document] XML document containing the encoded `envelope`

# 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) click to toggle source

Serializes the `envelope` and returns an XML string @param [WsdlMapper::SvcDesc::Envelope] envelope @return [String] `envelope` serialized as XML

# 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