2012-11-05 26 views
0

我想配置我的Rails應用程序使用此代碼跟一個肥皂Web服務:Savon HTTP :: ERROR但沒有更多信息?

client = Savon::Client.new do 
    wsdl.document = "http://services.carsolize.com/BookingServices/dynamicdataservice.svc?wsdl" 
end 

response = client.request "ServiceRequest", "xmlns" => "http://tempuri.org/" do |soap, wsdl| 
    client.http.headers["SOAPAction"] = '"http://tempuri.org/IDynamicDataService/ServiceRequest"' 
    soap.body = { 
    "rqst" => { 
     "Credentials" => { 
     "UserName" => 'user', 
     "Password" => 'pass' 
     }, 
     "RequestType" => "Login", 
     "TypeOfService" => "Unknown", 
    }, 
    } 
end 

但我得到的是一個薩翁:: HTTP ::錯誤的HomeController#指數(並沒有更多的信息)對於以響應開始的行。

+0

爲什麼你有雙引號內的單引號?你想把引號當作字符串的一部分嗎? –

回答

0

我一直試圖做這樣

client = Savon.client 'http://services.carsolize.com/BookingServices/dynamicdataservice.svc?wsdl' 

username = '*********' 
password = '*********' 

response = client.request :wsdl, :login do 
    http.headers["SOAPAction"] = '"http://tempuri.org/IDynamicDataService/ServiceRequest"' 
    soap.xml = "<s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'><s:Body><ServiceRequest xmlns='http://tempuri.org/'><rqst xmlns:i='http://www.w3.org/2001/XMLSchema-instance'><Credentials xmlns=''> 
    <Password>#{password}</Password><UserName>#{username}</UserName></Credentials><RequestType xmlns=''>Login</RequestType><TypeOfService xmlns=''>Unknown</TypeOfService></rqst></ServiceRequest></s:Body></s:Envelope>" 
end 

,它工作正常