I have a SOAP web service created with washout that has an action with a parameter of type base64Binary(Which I assume is the equivalent of byte[] in C#).
I'm sending the following variable to my web service parameter:
file_data = Base64.encode64(File.binread("/path/to/my/file"))
It comes back with the error:
RuntimeError (Invalid WashOut simple type: base64Binary)
Am I not creating the datatype correctly from my file path?
Here is the controller for the web service:
class ServiceController < ApplicationController
include WashOut::SOAP
soap_action "import_file",
:args => { :data => :base64Binary, :name => :string},
:return => :string
def import_file
render :soap => ("response")
end
# You can use all Rails features like filtering, too. A SOAP controller
# is just like a normal controller with a special routing.
before_filter :dump_parameters
def dump_parameters
Rails.logger.debug params.inspect
end
end
Here is the code for my client:
require 'savon'
class ServiceTester
def self.initiate
# create a client for your SOAP service
client = Savon.client do
wsdl "http://localhost:3000/service/wsdl"
end
file_data = Base64.encode64(File.binread("/path/to/my/file"))
response = client.call(:import_file, message: { data: file_data, name: "myfilename" })
end
end