Im working with ruby 1.9.2, rails 3.2.1, and mysql, I have a rest app, but the links dont works,when I go to the localhost:3000 I get:
Errno::ENOENT in WsController#registro No such file or directory - C:/Ruby192/PROYECTOS/loteriab/doc/loteria_registro.wsdl Rails.root: C:/Ruby192/PROYECTOS/loteriab Application Trace | Framework Trace | Full Trace app/controllers/ws_controller.rb:43:in `get_result' app/controllers/ws_controller.rb:33:in `registro'
here is code:
my view.html.erb
> <div id="menu"> <ul> <li> <%= link_to "login", root_path %><p > >es el proceso mediante el cual se controla el acceso individual al webservice de loteria mediante la identificación del usuario > utilizando credenciales provistas por el usuarioUn usuario</p> <%= > link_to "registro", root_path %> > > > > <%= link_to " login ", "ws/registro" %> > </li> </ul> </div>
my routes:
root :to => 'ws#inicio'
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
match ':controller(/:action(/:id))(.:format)'
end
my controller:
require 'savon'
class WsController < ApplicationController def inicio end
def login
data = {"Version" => "xx",
"CodEmpresa" => "xx",
"Rut" => "1579xxxxx-x",
"Clave" => "xxxx",
"SO" => "xx",
"Tipodispositivo" => "xx"}
response = get_result("loteria_autentificacion", data)
render :text => response
end
def registro
data = {"Version" => "01",
"CodEmpresa" => "01",
"CodAgente" => "01",
"Rut" => "1579xxxxx-x",
"email" => "xxxx@xxxxxxx.com",
"Clave" => "xxxx",
"SO" => "xx",
"Tipodispositivo" => "xx"}
response = get_result("loteria_registro", data)
render :xml => response end
def get_result(service, data)
client = Savon::Client.new do
wsdl.document = File.expand_path("#{Rails.root}/doc/#{service}.wsdl", __FILE__)
end
response = client.request :wsdl, service do
soap.body = data
end
return response.to_xml end end
This line in your code,
wsdl.document = File.expand_path("#{Rails.root}/doc/#{service}.wsdl", __FILE__)is telling savon to look for the WSDL at “C:/Ruby192/PROYECTOS/loteriab/doc/loteria_registro.wsdl”.The error is saying that the WSDL file, loteria_registro.wsdl, is not where the code line specifies. Either download the WSD and place it there or change the
wsdl.documentto point to the Web Service.