lib/savon/soap/xml.rb in savon-0.9.7 vs lib/savon/soap/xml.rb in savon-0.9.8
- old
+ new
@@ -123,10 +123,18 @@
attr_accessor :namespace
# Accessor for the <tt>Savon::WSSE</tt> object.
attr_accessor :wsse
+ # Returns the SOAP request encoding. Defaults to "UTF-8".
+ def encoding
+ @encoding ||= "UTF-8"
+ end
+
+ # Sets the SOAP request encoding.
+ attr_writer :encoding
+
# Accepts a +block+ and yields a <tt>Builder::XmlMarkup</tt> object to let you create
# custom body XML.
def body
@body = yield builder(nil) if block_given?
@body
@@ -159,10 +167,10 @@
end
private
# Returns a new <tt>Builder::XmlMarkup</tt> object.
- def builder(directive_tag = :xml, attrs = {})
+ def builder(directive_tag = :xml, attrs = { :encoding => encoding })
builder = Builder::XmlMarkup.new
builder.instruct!(directive_tag, attrs) if directive_tag
builder
end