using Savon version 3.x (the current master branch found https://github.com/savonrb/savon).
currently to generate a soap request in savon 3 you define the body of the message as a hash, ex:
operation.body = {
Search: {
accountID: 23,
accountStatus: 'closed'
}
}
response = operation.call
from the hash, savon will generate the complete soap message xml (envelope, headers, etc..) and pass that message onto HttpClient to post the request to your soap endpoint.
instead of a hash, i'd like to be able to pass in a complete xml message as my request, ex: my_xml_request_message =' ..... lots more nested nodes, namespaces and tons of attributes, etc ..... '
it appears that body
is sent to build
to create the soap request, and is then posted by call
:
https://github.com/savonrb/savon/blob/master/lib/savon/operation.rb#L79
def call
raw_response = @http.post(endpoint, http_headers, build)
Response.new(raw_response)
end
so i thinking was to monkey patch? call
to allow me to override build
with my xml block, ex:
def call
raw_response = @http.post(endpoint, http_headers, my_xml_request_message)
Response.new(raw_response)
end
that's where we're getting stuck - it's not clear to me if my xml is getting created or posted correctly. or if this is the correct way to proceed...
thanks in advance for any help!