2012-02-09 52 views
0

林用Ruby 1.9.2工作,導軌3.2.1,和MySQL,我有一個休息的應用程序,但鏈接不工作,當我去到本地主機:3000我得到:鏈接在其餘應用

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' 

這裏是代碼:

我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> 

我的路線:

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 

我的控制器:

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" => "[email protected]", 
     "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 

回答

0

這行代碼,wsdl.document = File.expand_path("#{Rails.root}/doc/#{service}.wsdl", __FILE__)告訴薩翁來尋找WSDL在「C:/ Ruby192/PROYECTOS/loteriab/DOC/loteria_registro.wsdl」。

錯誤是說WSDL文件loteria_registro.wsdl不在代碼行指定的位置。請下載WSD並將其放置在那裏,或者將wsdl.document更改爲指向Web服務。

+0

謝謝...它適用於我 – suely 2012-02-23 12:43:09

+0

@suely太棒了!繼續打勾,然後如果這解決了問題 – ScottJShea 2012-02-23 13:26:29

相關問題